63 lines
1.4 KiB
C#
63 lines
1.4 KiB
C#
|
namespace Web12306.Servers.TrainSuggestion
|
|||
|
{
|
|||
|
using System;
|
|||
|
using Newtonsoft.Json;
|
|||
|
|
|||
|
public class AlternativeLine
|
|||
|
{
|
|||
|
public AlternativeStation From { get; private set; }
|
|||
|
|
|||
|
public AlternativeStation To { get; private set; }
|
|||
|
|
|||
|
public string LineName { get; private set; }
|
|||
|
|
|||
|
[JsonProperty("tid")]
|
|||
|
public string TrainId { get; set; }
|
|||
|
|
|||
|
public string TrainCode { get; set; }
|
|||
|
|
|||
|
TimeSpan? _elTimeSpan;
|
|||
|
|
|||
|
public double ExtraPrice { get; set; }
|
|||
|
|
|||
|
public char BasePriceSeat { get; set; }
|
|||
|
|
|||
|
public double BasePrice { get; set; }
|
|||
|
|
|||
|
public int Radio { get; set; }
|
|||
|
|
|||
|
public string Date { get; set; }
|
|||
|
|
|||
|
public bool IsCrossDate { get; set; }
|
|||
|
|
|||
|
public TimeSpan ElapsedTime
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (!_elTimeSpan.HasValue)
|
|||
|
{
|
|||
|
_elTimeSpan = To.ArriveTime - From.ArriveTime;
|
|||
|
if (_elTimeSpan.Value.Ticks < 0)
|
|||
|
_elTimeSpan = _elTimeSpan.Value.Add(new TimeSpan(1, 0, 0, 0));
|
|||
|
}
|
|||
|
|
|||
|
return _elTimeSpan.Value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// <20><><EFBFBD><EFBFBD> <see cref="AlternativeLine" /> <20><><EFBFBD><EFBFBD>ʵ<EFBFBD><CAB5>(AlternativeLine)
|
|||
|
/// </summary>
|
|||
|
/// <param name="from"></param>
|
|||
|
/// <param name="to"></param>
|
|||
|
public AlternativeLine(AlternativeStation from, AlternativeStation to, DateTime date, bool isCrossDate)
|
|||
|
{
|
|||
|
From = from;
|
|||
|
To = to;
|
|||
|
IsCrossDate = isCrossDate;
|
|||
|
Date = date.ToString("yyyy-MM-dd");
|
|||
|
|
|||
|
LineName = From.Name + ";" + To.Name + (isCrossDate ? ";" + Date : "");
|
|||
|
}
|
|||
|
}
|
|||
|
}
|