/// <summary> /// 取得本站與到達站間的票價 /// </summary> /// <param name="arrival">到達站</param> /// <param name="trainType">列車類型</param> /// <param name="fareType">票價類型</param> /// <returns>票價</returns> public static int GetFaresPrice(this Station THIS, Station arrival, TrainLevels trainType, FareTypes fareType) { return THIS.GetFaresPriceAsync(arrival, trainType, fareType).GetAwaiter().GetResult(); }
/// <summary> /// 取得本站與到達站間的票價 /// </summary> /// <param name="arrival">到達站</param> /// <param name="trainType">列車類型</param> /// <param name="fareType">票價類型</param> /// <returns>票價</returns> public static int GetFaresPrice(this Station THIS, Station arrival, TrainLevels trainType, FareTypes fareType) { return(THIS.GetFaresPriceAsync(arrival, trainType, fareType).GetAwaiter().GetResult()); }
/// <summary> /// 非同步取得本站與到達站間的票價 /// </summary> /// <param name="arrival">到達站</param> /// <param name="trainType">列車類型</param> /// <param name="fareType">票價類型</param> /// <returns>票價</returns> public static async Task<int> GetFaresPriceAsync(this Station THIS, Station arrival, TrainLevels trainType, FareTypes fareType) { return await Fare.GetFaresPriceAsync(THIS, arrival, trainType, fareType); }
/// <summary> /// 將列車類型轉換為主要列車類型(如普悠瑪為自強號) /// </summary> /// <param name="type">列車等級</param> /// <returns>主要列車等級</returns> public static TrainLevels Convert(TrainLevels type) { return (TrainLevels)((int)Math.Round(((int)type)/ 10.0) * 10); }
/// <summary> /// 非同步取得本站與到達站間的票價 /// </summary> /// <param name="arrival">到達站</param> /// <param name="trainType">列車類型</param> /// <param name="fareType">票價類型</param> /// <returns>票價</returns> public static async Task <int> GetFaresPriceAsync(this Station THIS, Station arrival, TrainLevels trainType, FareTypes fareType) { return(await Fare.GetFaresPriceAsync(THIS, arrival, trainType, fareType)); }
/// <summary> /// 取得兩站點間的票價 /// </summary> /// <param name="starting">起始站</param> /// <param name="arrival">到達站</param> /// <param name="trainType">列車類型</param> /// <param name="fareType">票價類型</param> /// <returns>票價</returns> public static int GetFaresPrice(Station starting, Station arrival, TrainLevels trainType, FareTypes fareType) { return GetFaresPriceAsync(starting, arrival, trainType, fareType).GetAwaiter().GetResult(); }
/// <summary> /// 非同步取得兩站點間的票價 /// </summary> /// <param name="starting">起始站</param> /// <param name="arrival">到達站</param> /// <param name="trainType">列車類型</param> /// <param name="fareType">票價類型</param> /// <returns>票價</returns> public static async Task<int> GetFaresPriceAsync(Station starting, Station arrival, TrainLevels trainType, FareTypes fareType) { return (await GetFaresAsync(starting, arrival)) .Where(x => x.TrainType == TrainLevelsConverter.Convert(trainType) && x.FareType == fareType) .First().Price; }
/// <summary> /// 將列車類型轉換為主要列車類型(如普悠瑪為自強號) /// </summary> /// <param name="type">列車等級</param> /// <returns>主要列車等級</returns> public static TrainLevels Convert(TrainLevels type) { return((TrainLevels)((int)Math.Round(((int)type) / 10.0) * 10)); }
/// <summary> /// 取得兩站點間的票價 /// </summary> /// <param name="starting">起始站</param> /// <param name="arrival">到達站</param> /// <param name="trainType">列車類型</param> /// <param name="fareType">票價類型</param> /// <returns>票價</returns> public static int GetFaresPrice(Station starting, Station arrival, TrainLevels trainType, FareTypes fareType) { return(GetFaresPriceAsync(starting, arrival, trainType, fareType).GetAwaiter().GetResult()); }
/// <summary> /// 非同步取得兩站點間的票價 /// </summary> /// <param name="starting">起始站</param> /// <param name="arrival">到達站</param> /// <param name="trainType">列車類型</param> /// <param name="fareType">票價類型</param> /// <returns>票價</returns> public static async Task <int> GetFaresPriceAsync(Station starting, Station arrival, TrainLevels trainType, FareTypes fareType) { return((await GetFaresAsync(starting, arrival)) .Where(x => x.TrainType == TrainLevelsConverter.Convert(trainType) && x.FareType == fareType) .First().Price); }