public static Flight QueryFlight(UpperString departure, UpperString arrival, DateTime flightTime, UpperString airline, string flightNo, Guid oemId) { if (departure.IsNullOrEmpty()) { throw new ArgumentNullException("departure"); } if (arrival.IsNullOrEmpty()) { throw new ArgumentNullException("arrival"); } if (arrival.IsNullOrEmpty()) { throw new ArgumentNullException("airline"); } if (string.IsNullOrWhiteSpace(flightNo)) { throw new ArgumentNullException("flightNo"); } // 查询历史数据 var repository = FlightQuery.Repository.Factory.CreateRepository(); var flightHistoryRecord = repository.Query(departure.Value, arrival.Value, flightTime, true); IEnumerable <Command.Domain.FlightQuery.Flight> commandFlights = null; if (flightHistoryRecord == null || string.IsNullOrWhiteSpace(flightHistoryRecord.Content)) { // 如果历史数据中没有,则查询航班 //var execResult = CommandService.QuerySingleFlight(departure.Value, arrival.Value, flightTime); //if(execResult.Success) { // commandFlights = execResult.Result; //} else { // throw new CustomException("查询航班失败"); //} commandFlights = FlightDatasCenter.GetFlights(departure.Value, arrival.Value, flightTime.Date, airline.Value, oemId); } else { commandFlights = Command.Domain.Utility.Parser.GetFlights(flightHistoryRecord.Content); if (!commandFlights.Any(f => f.Airline == airline.Value && f.FlightNo == flightNo)) { commandFlights = FlightDatasCenter.GetFlights(departure.Value, arrival.Value, flightTime.Date, airline.Value, oemId); } } var flight = commandFlights.FirstOrDefault(f => f.Airline == airline.Value && f.FlightNo == flightNo); return(FlightProcessor.GetFlight(flight, flightTime.Date)); }
/// <summary> /// 从历史数据中查询航班信息 /// </summary> public static Dictionary <DateTime, IEnumerable <Flight> > QueryFlightFromHistory(UpperString departure, UpperString arrival, IEnumerable <DateTime> flightDates) { if (departure.IsNullOrEmpty()) { throw new ArgumentNullException("departure"); } if (arrival.IsNullOrEmpty()) { throw new ArgumentNullException("arrival"); } var result = new Dictionary <DateTime, IEnumerable <Flight> >(); if (flightDates.Any()) { //var voyageSetting = FoundationService.QueryFixedNavigation(departure, arrival); var repository = FlightQuery.Repository.Factory.CreateRepository(); //if(voyageSetting == null) { // var flightHistoryRecord = repository.Query(departure.Value, arrival.Value, flightDates.First(), false); // var flights = processFlights(flightHistoryRecord); // foreach(var item in flightDates) { // result.Add(item, flights); // } //} else { foreach (var flightDate in flightDates) { var flightHistoryRecord = repository.Query(departure.Value, arrival.Value, flightDate, true); result.Add(flightDate, processFlights(flightHistoryRecord)); } //} } return(result); }
/// <summary> /// 查询航空公司 /// </summary> /// <param name="code">航空公司代码</param> public static Airline QueryAirline(UpperString code) { if (code.IsNullOrEmpty()) { return(null); } return(AirlineCollection.Instance[code]); }
/// <summary> /// 查询退改签客规 /// </summary> /// <param name="id">客规ID</param> public static RefundAndReschedulingBase QueryRefundAndReschedulingNewBase(UpperString airline) { if (airline.IsNullOrEmpty()) { throw new ArgumentNullException("airline"); } var repository = ChinaPay.B3B.Service.Foundation.Repository.Factory.CreateRefundAndReschedulingNewRepository(); return(repository.Query(airline)); }
internal void AddExtended(UpperString item) { if (!item.IsNullOrEmpty()) { if (_extended.Contains(item.Value)) { throw new Core.Exception.RepeatedItemException("不能添加重复的子舱位代码"); } _extended.Add(item.Value); } }
public static FixedNavigationView QueryFixedNavigation(UpperString departure, UpperString arrival) { if (departure.IsNullOrEmpty()) { throw new ArgumentNullException("departure"); } if (arrival.IsNullOrEmpty()) { throw new ArgumentNullException("arrival"); } return(Foundation.Domain.FixedNavigations.Instance.Query(departure, arrival)); }
bool isValidAirport(UpperString repositoryAirport, UpperString requestAirport) { return(repositoryAirport.IsNullOrEmpty() || repositoryAirport.Value == requestAirport.Value); }