Example #1
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);
                }
            }
        }
Example #2
0
 public static void SendFareError(FareErrorLog fare, decimal price)
 {
     try
     {
         IMailServiceProvider mail         = new MailServiceProvider();
         string       receptionMailAddress = SystemParamService.QueryString(SystemParamType.SystemReceptionMailAddress);
         string       serviceMailAdderess  = SystemParamService.QueryString(SystemParamType.SystemServiceMailAddress);
         string       serviceMailPassword  = SystemParamService.QueryString(SystemParamType.SystemServiceMailPassword);
         string       title   = "记录价格变动信息";
         string       content = B3BEmailSender.GetFareCOnetnt(fare, price);
         MailMessages message = new MailMessages("B3b系统邮件", receptionMailAddress, title, content, serviceMailAdderess, serviceMailPassword, "QQ");
         mail.SendMessage(message);
     }
     catch (Exception ex)
     {
         Service.LogService.SaveExceptionLog(ex, "发送邮件异常");
     }
 }