Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        public static void SaveImportInfo(ReservedPnr pnrContent, PNRPair associatePNR, PriceView minPatPrice,
                                          PassengerType passengerType, PriceView maxPatPrice, out bool fdSuccess)
        {
            fdSuccess = true;
            IEnumerable <FlightView> reservedFlights = ReserveViewConstuctor.GetQueryFlightView(pnrContent.Voyage.Segments, pnrContent.Voyage.Type,
                                                                                                pnrContent.Passengers.First().Type, pnrContent.IsTeam, minPatPrice);

            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        = maxPatPrice.Fare,
                        IsTreatment = true
                    };

                    if (PNRHelper.RequireFD(reservedFlights))
                    {
                        try
                        {
                            flight.Fare = minPatPrice.Fare = PriceCheckService.CheckFd(flight.AirlineCode, flight.Departure.Code, flight.Arrival.Code,
                                                                                       flight.BunkCode, flight.Departure.Time);
                        }
                        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;
                        fare.IsTreatment = true;
                        B3BEmailSender.SendFareError(fare, flight.Fare);
                    }
                    LogService.SaveFareErrorLog(fare);
                    //B3BEmailSender.SendFareError(fare, flight.Fare);
                }
            }
        }
Exemplo n.º 3
0
        internal static PriceView Pat(PNRPair pnr, IEnumerable <FlightView> flights, PassengerType passengerType)
        {
            ExecuteResult <IEnumerable <PriceView> > execResult = CommandService.QueryPriceByPNR(pnr, passengerType, BasePage.OwnerOEMId);

            if (execResult.Success)
            {
                var     currentFare = flights.Sum(f => f.Fare);
                decimal maxFare     = execResult.Result.Any(item => item.Fare == currentFare)
                                      ? currentFare : execResult.Result.Max(item => item.Fare);
                PriceView minPriceView = execResult.Result.FirstOrDefault(item => item.Fare == maxFare);
                // 检查是否与基础数据中的价格相同,不同则记录日志
                if (flights.Count() == 1)
                {
                    FlightView flight = flights.First();
                    if (flight.BunkType.HasValue && (flight.BunkType.Value == BunkType.Economic || flight.BunkType.Value == BunkType.FirstOrBusiness) && flight.Fare != maxFare &&
                        passengerType == PassengerType.Adult)
                    {
                        var fare = new FareErrorLog
                        {
                            Carrier     = flight.AirlineCode,
                            Departure   = flight.Departure.Code,
                            Arrival     = flight.Arrival.Code,
                            FlightDate  = flight.Departure.Time.Date,
                            Bunk        = flight.BunkCode,
                            Fare        = maxFare,
                            IsTreatment = true
                        };
                        if (RequireFD(flights))
                        {
                            PriceCheckService.CheckFd(flight.AirlineCode, flight.Departure.Code, flight.Arrival.Code,
                                                      fare.FlightDate);
                        }
                        else
                        {
                            fare.IsTreatment = false;
                            B3BEmailSender.SendFareError(fare, flight.Fare);
                        }
                        LogService.SaveFareErrorLog(fare);
                    }
                }
                return(minPriceView);
            }
            return(null);
        }