Exemple #1
0
        public static PNRPair ReserveSeat(IEnumerable <FlightView> flights, IEnumerable <PassengerView> passengers)
        {
            PassengerType passengerType   = passengers.First().PassengerType;
            var           reservationInfo = new ReservationInfo
            {
                AgentPhoneNumber = SystemParamService.ContactInPNR,
                Segements        = flights.Select(f => new ReservationSegmentInfo
                {
                    Carrier              = f.AirlineCode,
                    InternalNumber       = f.FlightNo,
                    ClassOfService       = f.BunkCode,
                    Date                 = f.Departure.Time,
                    DepartureAirportCode = f.Departure.Code,
                    ArrivalAirportCode   = f.Arrival.Code,
                }).ToList(),
                Passengers = passengers.Select(p => new ReservationPassengerInfo
                {
                    Name = p.Name,
                    Type = p.PassengerType,
                    CertificateNumber = p.Credentials,
                    CertificateType   = p.CredentialsType,
                    MobilephoneNumber = p.Phone,
                    Birthday          = p.BirthDay
                }).ToList(),
            };
            ExecuteResult <ReservedPnr> execResult = CommandService.ReserveTickets(reservationInfo, BasePage.OwnerOEMId);

            if (execResult.Success)
            {
                PNRPair pnrCode = execResult.Result.PnrPair;
                var     opLog   = new OperationLog(OperationModule.其他, OperationType.Else, BasePage.LogonUser.UserName,
                                                   OperatorRole.Purchaser, "订座记录", string.Format("PNR:{0}\n组织结构名称:{1}\n管理员帐号:{2}\n操作人:{3}\nIP:{4}\n乘机人:{5}\n航班信息:{6}",
                                                                                                 pnrCode.ToListString("|"), BasePage.LogonCompany.CompanyName, BasePage.LogonCompany.UserName, BasePage.LogonUser.UserName,
                                                                                                 IPAddressLocator.GetRequestIP(HttpContext.Current.Request),
                                                                                                 passengers.Select(p => p.Name + "_" + p.CredentialsType.ToString() + "_" + p.Credentials + "_" + p.Phone).Join("|"),
                                                                                                 flights.Select(p => p.AirlineCode + p.FlightNo + "_" + p.BunkCode + "_" + p.Departure.Time).Join("|")));
                LogService.SaveOperationLog(opLog);
                CommandService.ValidatePNR(execResult.Result, passengerType);

                return(execResult.Result.PnrPair);
            }
            else
            {
                throw new CustomException("订座失败");
            }
        }