private static void saveImportInfo(HttpContext context, ReservedPnr pnrContent, PNRPair associatePNR, OrderSource orderSource, PriceView patPrice, PriceView maxpatPrice, PassengerType passengerType) { bool fdSuccess = true; IEnumerable <FlightView> reservedFlights = ReserveViewConstuctor.GetQueryFlightView(pnrContent.Voyage.Segments, pnrContent.Voyage.Type, pnrContent.Passengers.First().Type, pnrContent.IsTeam, patPrice); if (maxpatPrice != null && maxpatPrice.Fare != 0 && pnrContent.Voyage.Type == ItineraryType.OneWay && passengerType == PassengerType.Adult) { var flight = reservedFlights.First(); if (flight.Fare != maxpatPrice.Fare && flight.Fare != 0 && (flight.BunkType == BunkType.Economic || flight.BunkType == BunkType.FirstOrBusiness)) { FareErrorLog fare = new FareErrorLog { Carrier = flight.AirlineCode, Departure = flight.Departure.Code, Arrival = flight.Arrival.Code, FlightDate = flight.Departure.Time.Date, Bunk = flight.BunkCode, Fare = patPrice.Fare, }; if (PNRHelper.RequireFD(reservedFlights)) { try { flight.Fare = patPrice.Fare = PriceCheckService.CheckFd(flight.AirlineCode, flight.Departure.Code, flight.Arrival.Code, flight.BunkCode, flight.Departure.Time); fare.IsTreatment = true; } catch (Exception ex) { LogService.SaveExceptionLog(ex, string.Format("{0}{1}{2}{3}({4})", flight.AirlineCode, flight.Departure.Code, flight.Arrival.Code, flight.BunkCode, flight.Departure.Time)); fare.IsTreatment = false; fdSuccess = false; } } else { fdSuccess = false; B3BEmailSender.SendFareError(fare, flight.Fare); } LogService.SaveFareErrorLog(fare); } } OrderView orderView = GetOrderView(orderSource, pnrContent, associatePNR, reservedFlights, passengerType); orderView.FdSuccess = fdSuccess; orderView.PatContent = pnrContent.PatRawData; orderView.PnrContent = pnrContent.PnrRawData; orderView.UseBPNR = !pnrContent.UsedCrsCode; orderView.PATPrice = patPrice; context.Session["ReservedFlights"] = reservedFlights; context.Session["OrderView"] = orderView; }
private static PnrImportResult importAdultOrder(HttpContext context, ReservedPnr adultPNRContent, OrderSource orderSource, PriceView patPrice, PriceView maxpatPrice) { CheckFligtTime(adultPNRContent); IEnumerable <FlightView> reservedFlights = ReserveViewConstuctor.GetQueryFlightView(adultPNRContent.Voyage.Segments, adultPNRContent.Voyage.Type, PassengerType.Adult, adultPNRContent.IsTeam, patPrice); bool isFreeTicket = adultPNRContent.Voyage.Segments.Any() && reservedFlights.First().BunkType.Value == BunkType.Free; //如果遇到证件号不全体提编码 if (adultPNRContent.Passengers.Any(p => string.IsNullOrEmpty(p.CertificateNumber)) && !PNRPair.IsNullOrEmpty(adultPNRContent.PnrPair)) { var pnr = adultPNRContent.PnrPair.PNR; ExecuteResult <ReservedPnr> rtResult = CommandService.GetReservedPnr(adultPNRContent.PnrPair, BasePage.OwnerOEMId); if (rtResult.Success && !rtResult.Result.HasCanceled) { string patContent = adultPNRContent.PatRawData; adultPNRContent = rtResult.Result; adultPNRContent.PnrPair.PNR = pnr; adultPNRContent.PatRawData = patContent; } } CommandService.ValidatePNR(adultPNRContent, PassengerType.Adult); if (!isFreeTicket && patPrice == null) { return(new PnrImportResult(false, "需要输入PAT内容", true)); } if (isFreeTicket) { Segment segment = adultPNRContent.Voyage.Segments.First(); Flight flight = FlightQueryService.QueryFlight(segment.AirportPair.Departure, segment.AirportPair.Arrival, segment.Date.AddHours(segment.DepartureTime.Hour).AddMinutes(segment.DepartureTime.Minute), segment.AirlineCode, segment.InternalNo, BasePage.OwnerOEMId); if (flight != null) { patPrice = new PriceView { Total = flight.BAF.Adult + flight.AirportFee, Fare = 0m, AirportTax = flight.AirportFee, BunkerAdjustmentFactor = flight.BAF.Adult }; } } if (patPrice == null) { throw new CustomException("缺少PAT内容"); } //if (adultPNRContent.Price != null) throw new CustomException("成人编码中不能包含票价组项"); saveImportInfo(context, adultPNRContent, null, orderSource, patPrice, maxpatPrice, PassengerType.Adult); return(new PnrImportResult(true)); }
/// <summary> /// 从PNR中解析航班信息 /// </summary> /// <param name="adultPNRCode">PNR编码</param> /// <param name="context">页面请求上下文</param> public static Tuple <IEnumerable <FlightView>, IEnumerable <Passenger> > AnalysisPNR(string adultPNRCode, HttpContext context) { ExecuteResult <ReservedPnr> pnrContent = getPNRContent(adultPNRCode); if (pnrContent.Success) { CommandService.ValidatePNR(pnrContent.Result, PassengerType.Adult); IEnumerable <FlightView> flightViews = ReserveViewConstuctor.GetQueryFlightView(pnrContent.Result.Voyage.Segments, pnrContent.Result.Voyage.Type, pnrContent.Result.Passengers.First().Type, pnrContent.Result.IsTeam, null); var result = new Tuple <IEnumerable <FlightView>, IEnumerable <Passenger> >(flightViews, pnrContent.Result.Passengers); return(result); } throw new CustomException("提取成人编码信息失败:" + pnrContent.Message); }
private void commitPassengerInfos() { var passengers = Session["UpgradePassengers"] as IEnumerable <PassengerView>; var flights = getFlights(); var applyform = Session["UpgradeApplyformView"] as UpgradeApplyformView; applyform.PNRSource = OrderSource.PlatformOrder; foreach (var item in applyform.Items) { item.Flight = ReserveViewConstuctor.GetOrderFlightView(flights.First(f => f.Departure.Code == item.Flight.Departure && f.Arrival.Code == item.Flight.Arrival)); } applyform.NewPNR = PNRHelper.ReserveSeat(flights, passengers); if (PNRHelper.RequirePat(flights, PolicyType.Normal)) { applyform.PATPrice = PNRHelper.Pat(applyform.NewPNR, flights, passengers.First().PassengerType); } Session.Remove("UpgradePassengers"); Session.Remove("UpgradeApplyformView"); Session["ApplyformView"] = applyform; Session["Passengers"] = passengers; }