using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using TrainInfomationProviderService.StationInfo; namespace TrainInfomationProviderService.TrainInfo.Entities { public class TrainStop { private string _name; [JsonProperty("c")] public string Code { get; set; } [JsonProperty("i")] public int Index { get; set; } [JsonProperty("a")] public TimeSpan? Arrive { get; set; } [JsonProperty("l")] public TimeSpan? Left { get; set; } [JsonProperty("d")] public int Days { get; set; } /// /// 停靠时间 /// [JsonIgnore] public TimeSpan StopTime { get { if (Arrive == null || Left == null) return TimeSpan.MaxValue; return Left.Value - Arrive.Value; } } [JsonIgnore] public string Name { get { if (string.IsNullOrEmpty(_name) && StationManager.Instance.Storage != null) { if (!string.IsNullOrEmpty(Code)) _name = StationManager.Instance.Storage.Stations.GetValue(Code).SelectValue(s => s.Name); else _name = string.Empty; } return _name; } } } }