2014-11-21 20:32:36 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Newtonsoft.Json;
|
2014-11-27 23:25:36 +08:00
|
|
|
|
using TrainInfomationProviderService.StationInfo;
|
2014-11-21 20:32:36 +08:00
|
|
|
|
|
|
|
|
|
namespace TrainInfomationProviderService.TrainInfo.Entities
|
|
|
|
|
{
|
|
|
|
|
public class TrainStop
|
|
|
|
|
{
|
2014-11-27 23:25:36 +08:00
|
|
|
|
private string _name;
|
|
|
|
|
|
2014-11-21 20:32:36 +08:00
|
|
|
|
[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; }
|
|
|
|
|
|
2014-11-27 23:25:36 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 停靠时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
[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;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-11-21 20:32:36 +08:00
|
|
|
|
}
|
|
|
|
|
}
|