コード例 #1
0
ファイル: FlightQueryService.cs プロジェクト: 842549829/Pool
        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));
        }
コード例 #2
0
ファイル: FlightQueryService.cs プロジェクト: 842549829/Pool
        /// <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);
        }
コード例 #3
0
 /// <summary>
 /// 查询航空公司
 /// </summary>
 /// <param name="code">航空公司代码</param>
 public static Airline QueryAirline(UpperString code)
 {
     if (code.IsNullOrEmpty())
     {
         return(null);
     }
     return(AirlineCollection.Instance[code]);
 }
コード例 #4
0
        /// <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));
        }
コード例 #5
0
 internal void AddExtended(UpperString item)
 {
     if (!item.IsNullOrEmpty())
     {
         if (_extended.Contains(item.Value))
         {
             throw new Core.Exception.RepeatedItemException("不能添加重复的子舱位代码");
         }
         _extended.Add(item.Value);
     }
 }
コード例 #6
0
 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));
 }
コード例 #7
0
ファイル: BunkCollection.cs プロジェクト: 842549829/Pool
 bool isValidAirport(UpperString repositoryAirport, UpperString requestAirport)
 {
     return(repositoryAirport.IsNullOrEmpty() || repositoryAirport.Value == requestAirport.Value);
 }