Esempio n. 1
0
        string AppendPNR(PNRPair pnr, string tip)
        {
            if (PNRPair.IsNullOrEmpty(pnr))
            {
                return(string.Empty);
            }
            if (RenderedPNR.Any(pnr.Equals))
            {
                return(string.Empty);
            }
            var result = new StringBuilder(" ");

            result.Append(tip);
            if (!string.IsNullOrWhiteSpace(pnr.PNR))
            {
                result.AppendFormat(PNRFORMAT, pnr.PNR.ToUpper(), "小");
            }
            result.Append(" ");
            if (!string.IsNullOrWhiteSpace(pnr.BPNR))
            {
                result.AppendFormat(PNRFORMAT, pnr.BPNR.ToUpper(), "大");
            }
            RenderedPNR.Add(pnr);
            return(result.ToString());
        }
Esempio n. 2
0
        internal PriceView Pat(PNRPair pnr, IEnumerable <FlightView> flights, PassengerType passengerType)
        {
            ExecuteResult <IEnumerable <PriceView> > execResult = CommandService.QueryPriceByPNR(pnr, passengerType, Guid.Empty);

            if (execResult.Success)
            {
                decimal   minFare      = execResult.Result.Min(item => item.Fare);
                PriceView minPriceView = execResult.Result.First(item => item.Fare == minFare);
                // 检查是否与基础数据中的价格相同,不同则记录日志
                if (flights.Count() == 1)
                {
                    FlightView flight = flights.First();
                    if (flight.BunkType.HasValue && (flight.BunkType.Value == BunkType.Economic || flight.BunkType.Value == BunkType.FirstOrBusiness) && flight.Fare != minFare &&
                        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       = minFare
                        };
                        LogService.SaveFareErrorLog(fare);
                        //B3BEmailSender.SendFareError(fare, flight.Fare);
                    }
                }
                return(minPriceView);
            }
            return(null);
        }
Esempio n. 3
0
 string checkReservationPNRValidity(Guid oemId)
 {
     if (!PNRPair.IsNullOrEmpty(this.ReservationPNR))
     {
         var executeResult = CommandService.GetReservedPnr(ReservationPNR, oemId);
         if (executeResult.Success)
         {
             CommandService.ValidatePNR(executeResult.Result, IsChildrenOrder ? PassengerType.Child : PassengerType.Adult);
             if (Source == OrderSource.PlatformOrder && executeResult.Result.Passengers != null && executeResult.Result.Passengers.Join(PNRInfos.First().Passengers, p => p.Name, p => p.Name, (p, q) => p).Count() != executeResult.Result.Passengers.Count)
             {
                 LogService.SaveExceptionLog(new Exception("乘机人信息不符")
                 {
                     Source = "编码验证"
                 },
                                             "订单号:" + Id + ",编码内容中的乘机人姓名为:" + string.Join(",", executeResult.Result.Passengers.Select(p => p.Name)));
             }
         }
         else
         {
             //throw new CustomException("编码提取失败");
             if (OrderSource.PlatformOrder != Source)
             {
                 return("暂时无法验证您导入编码的位置是否有效,请您自行确认");
             }
             else
             {
                 LogService.SaveExceptionLog(new CustomException(string.Format("由于编码内容提取失败,平台预订的编码:{0} 未进行有效性验证,时间:{1:yyyy-MM-dd HH:mm}", ReservationPNR.ToListString(), DateTime.Now)));
             }
         }
     }
     return(string.Empty);
 }
Esempio n. 4
0
        public RequestResult <IEnumerable <ExternalPolicyView> > Match(PNRPair pnrPair, ExternalPolicyFilter filter)
        {
            RequestResult <IEnumerable <ExternalPolicyView> > result;
            var request  = string.Empty;
            var response = string.Empty;

            try {
                var platform = new IBEService {
                    Url     = Platform.Address,
                    Timeout = Platform.Timeout
                };
                var signValue = new Dictionary <string, string>
                {
                    { "userName", Platform.UserName },
                    { "pnr", pnrPair.PNR }
                };
                var signText = Sign(signValue);
                request = GetRequestValue(signValue, signText);
                var matchResponse = platform.PnrMatchAirp(Platform.UserName, pnrPair.PNR, signText);
                response = matchResponse;
                result   = parseMatchResponse(matchResponse, filter);
            } catch (Exception ex) {
                LogService.SaveExceptionLog(ex, "通过编码匹配易行政策");
                result = new RequestResult <IEnumerable <ExternalPolicyView> > {
                    Success    = false,
                    ErrMessage = "系统错误,请联系平台"
                };
                response = ex.Message;
            }
            SaveRequestLog(response, request, "匹配政策");
            return(result);
        }
Esempio n. 5
0
        /// <summary>
        /// 生成订单
        /// </summary>
        public string ProduceOrder(Guid policyId, PolicyType policyType, Guid publisher, string officeNo, string source, int choise, bool needAUTH, bool HasSubsidized,
                                   bool IsUsePatPrice, bool forbidChnagePNR)
        {
            var           orderView     = Session["OrderView"] as OrderView;
            var           flights       = Session["ReservedFlights"] as IEnumerable <FlightView>;
            MatchedPolicy matchedPolicy = MatchedPolicyCache.FirstOrDefault(p => p.Id == policyId);

            if (matchedPolicy == null)
            {
                throw new CustomException("政策选择超时");
            }
            if (flights.First().BunkType != null && orderView.Source == OrderSource.PlatformOrder &&
                (flights.First().BunkType == BunkType.Free || matchedPolicy.OriginalPolicy is SpecialPolicyInfo && ((SpecialPolicyInfo)matchedPolicy.OriginalPolicy).Type == SpecialProductType.LowToHigh))
            {
                SpecialPolicy policy = PolicyManageService.GetSpecialPolicy(policyId);
                //低打高返和集团票性质一样 不需要去订坐 2013-4-3 wangsl
                //if (policy != null && (policy.SynBlackScreen||policy.Type==SpecialProductType.LowToHigh))
                if (policy != null && policy.SynBlackScreen)
                {
                    PNRPair pnr = PNRHelper.ReserveSeat(flights, orderView.Passengers);
                    orderView.PNR = pnr;
                }
            }
            Order order = OrderProcessService.ProduceOrder(orderView, matchedPolicy, CurrentUser, BasePage.OwnerOEMId, forbidChnagePNR, (AuthenticationChoise)choise);

            FlightQuery.ClearFlightQuerySessions();
            if (order.Source == OrderSource.PlatformOrder && !PNRPair.IsNullOrEmpty(order.ReservationPNR) && !String.IsNullOrWhiteSpace(order.Product.OfficeNo))
            {
                if (needAUTH)
                {
                    authorize(order.ReservationPNR, officeNo, source, BasePage.OwnerOEMId);
                }
            }
            return(order.Id.ToString());
        }
Esempio n. 6
0
        ///// <summary>
        ///// 根据旅客订座记录编号,获取其详细信息。(此方法没有被外部调用)
        ///// </summary>
        ///// <param name="pnrCode">编码</param>
        ///// <returns>执行结果</returns>
        //private static ExecuteResult<IssuedPNR> GetTeamPNRDetail(string pnrCode)
        //{
        //    var rtnCommand = new RTNCommand(pnrCode);
        //    rtnCommand.Execute();
        //    var issuedPNR = Parser.GetPNRDetail(rtnCommand.ReturnString);
        //    return GetExecuteResult(issuedPNR, rtnCommand.ReturnString);
        //}

        ///// <summary>
        ///// 根据旅客订座记录编号,获取其详细信息。
        ///// </summary>
        ///// <param name="pnrPair">PNR</param>
        ///// <returns>执行结果</returns>
        //private static ExecuteResult<IssuedPNR> GetPNRDetail(PNRPair pnrPair, bool isTeam)
        //{
        //    if (PNRPair.IsNullOrEmpty(pnrPair))
        //    {
        //        throw new ArgumentException("编码错误");
        //    }
        //    // 优先通过大编码获取信息,
        //    return isTeam && !string.IsNullOrWhiteSpace(pnrPair.BPNR) ? GetTeamPNRDetail(pnrPair.BPNR) : GetPNRDetail(pnrPair);
        //}

        ///// <summary>
        ///// 根据旅客订座记录编号,获取其详细信息。
        ///// </summary>
        ///// <param name="pnrPair">PNR</param>
        ///// <returns>执行结果</returns>
        //private static ExecuteResult<IssuedPNR> GetPNRDetail(PNRPair pnrPair)
        //{
        //    if (PNRPair.IsNullOrEmpty(pnrPair))
        //    {
        //        throw new ArgumentException("编码错误");
        //    }

        //    var commandString = string.Empty;
        //    IssuedPNR issuedPNR = null;

        //    if (!string.IsNullOrWhiteSpace(pnrPair.BPNR))
        //    {
        //        var rtCommand = new RTCommand(pnrPair.BPNR, CommandType.PNRExtraction, ReturnResultType.All);
        //        rtCommand.Execute();
        //        commandString = rtCommand.ReturnString;
        //    }
        //    else
        //    {
        //        var rtxCommand = new RTXCommand(pnrPair.PNR);
        //        rtxCommand.Execute();
        //        commandString = rtxCommand.ReturnString;
        //    }

        //    switch (Parser.GetPassengerConsistsType(commandString))
        //    {
        //        case PassengerConsistsType.Individual:
        //            issuedPNR = Parser.GetPNRDetail(commandString);
        //            break;
        //        case PassengerConsistsType.Group:
        //            // 通过上面的数据,解析出PNRPair;
        //            PNRPair result = Parser.GetPnrPair(commandString);
        //            // 这里用大编提取数据,切记切记,用小编提取不到;
        //            return GetTeamPNRDetail(string.IsNullOrWhiteSpace(result.BPNR) ? result.PNR : result.BPNR);
        //        default:
        //            break;
        //    }

        //    return GetExecuteResult<IssuedPNR>(issuedPNR, commandString);
        //}
        #endregion

        /// <summary>
        ///
        /// </summary>
        /// <param name="pnrPair"></param>
        /// <param name="oemId"> </param>
        /// <returns></returns>
        /// <remarks>
        /// 由于在订座后立即提取了编码信息,所在所有的调用此方法时都应该是用大系统提取,所以,这里先写死了;
        /// </remarks>
        public static ExecuteResult <ReservedPnr> GetReservedPnr(PNRPair pnrPair, Guid oemId)
        {
            if (PNRPair.IsNullOrEmpty(pnrPair))
            {
                throw new ArgumentException("编码错误");
            }

            var userName = "******";

            ExecuteResult <ReservedPnr> reservedPnrInfo;
            var repository = Factory.CreateCommandRepository();

            // 防止出现问题,检查输入编码;
            pnrPair = Domain.Utility.Parser.SwitchPnrPair(pnrPair);

            if (!string.IsNullOrWhiteSpace(pnrPair.BPNR))//若大系统编码为空,则使用大系统提大编码
            {
                reservedPnrInfo = repository.Rt(pnrPair.BPNR, userName);
            }
            else
            {
                reservedPnrInfo = repository.Rtx(pnrPair.PNR, userName);
            }

            if (reservedPnrInfo.Success)
            {
                PidManagementService.SaveCounter(oemId, true);
            }

            return(reservedPnrInfo);
        }
Esempio n. 7
0
        /// <summary>
        /// 查询订票后价格
        /// </summary>
        /// <returns>执行结果</returns>
        public static ExecuteResult <IEnumerable <PriceView> > QueryPriceByPNR(PNRPair pnrPair, PassengerType passengerType, Guid oemId)
        {
            // 参数验证
            if (PNRPair.IsNullOrEmpty(pnrPair))
            {
                throw new ArgumentException("旅客订座记录编码");
            }

            // 这里到底是执行了RT还是RTX呢,PAT现在只在执行订座时会提,所以提取时应使用的订座配置;
            const ConfigUseType type = ConfigUseType.Reserve;
            var userName             = GetUserName(oemId, type);

            if (userName == null)
            {
                return(new ExecuteResult <IEnumerable <PriceView> >
                {
                    Result = null,
                    Success = false,
                    Message = "OEM未设置可用配置,且没有设置使用平台配置。"
                });
            }

            var repository = Factory.CreateCommandRepository();
            var result     = repository.PnrPat(pnrPair.PNR, passengerType, userName);

            if (result.Success)
            {
                PidManagementService.SaveCounter(oemId, HasUsePlatformConfig(oemId, type));
            }

            return(result);
        }
Esempio n. 8
0
        /// <summary>
        /// 根据给出的旅客订座记录编号和姓名,修改旅客证件号码。
        /// </summary>
        /// <param name="pnrPair">旅客订座记录编号</param>
        /// <param name="name">旅客姓名</param>
        /// <param name="oldNumber">原证件号</param>
        /// <param name="newNumber">新证件号</param>
        /// <param name="type">证件类型</param>
        /// <param name="oemId">OEM编号</param>
        /// <returns></returns>
        public static ExecuteResult <ReservedPnr> ModifyCertificateNumber(PNRPair pnrPair, string name, string oldNumber, string newNumber, CredentialsType type, Guid oemId)
        {
            // 参数验证
            if (PNRPair.IsNullOrEmpty(pnrPair))
            {
                throw new ArgumentException("旅客订座记录编码");
            }

            var userName = "******";

            try
            {
                var repository = Factory.CreateCommandRepository();
                PidManagementService.SaveCounter(oemId, true);
                var result = repository.SsrFoid(pnrPair.PNR, name, oldNumber, newNumber, type, userName);

                if (result.Success)
                {
                    PidManagementService.SaveCounter(oemId, true);
                }

                return(result);
            }
            catch (Exception e)
            {
                return(new ExecuteResult <ReservedPnr>()
                {
                    Success = false,
                    Message = e.Message,
                    Result = null
                });
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 将待授权的旅客订座记录编号的权限授予指定的OfficeNo
        /// </summary>
        /// <param name="pnrPair">待授权的旅客订座记录编号</param>
        /// <param name="officeNo">待授权的OfficeNo</param>
        /// <param name="oemId"> </param>
        /// <returns></returns>
        /// <remarks>
        /// 使用在订好编码后,向出票方授权;
        /// </remarks>
        public static ExecuteResult <string> AuthorizeByOfficeNo(PNRPair pnrPair, string officeNo, Guid oemId)
        {
            // 参数验证
            if (PNRPair.IsNullOrEmpty(pnrPair))
            {
                throw new ArgumentException("旅客订座记录编码");
            }
            const ConfigUseType type = ConfigUseType.Reserve;
            var userName             = GetUserName(oemId, type);

            var officeNumber = GetOfficeNumber(oemId, type);

            if (userName == null || officeNumber == null)
            {
                return(new ExecuteResult <string>
                {
                    Result = null,
                    Success = false,
                    Message = "OEM未设置可用配置,且没有设置使用平台配置。"
                });
            }
            var repository = Factory.CreateCommandRepository();
            var result     = repository.Authorize(pnrPair.PNR, officeNumber, new string[] { officeNo }, userName);

            if (result.Success)
            {
                PidManagementService.SaveCounter(oemId, true);
            }

            return(result);
        }
Esempio n. 10
0
        internal PNRInfo UpdateContentForRefund(RefundOrScrapApplyform refundOrScrapApplyform)
        {
            PNRInfo            result     = null;
            IEnumerable <Guid> passengers = refundOrScrapApplyform.GetAppliedPassengers();
            IEnumerable <Guid> flights    = refundOrScrapApplyform.GetAppliedFlights();

            if (isAllPassengers(passengers) && isAllFlights(flights))
            {
                removeAll();
            }
            else if (isAllPassengers(passengers))
            {
                removeFlights(flights);
            }
            else if (isAllFlights(flights))
            {
                removePassengers(passengers);
            }
            else
            {
                if (PNRPair.IsNullOrEmpty(refundOrScrapApplyform.NewPNR))
                {
                    throw new CustomException("未提供分离后的新编码");
                }
                result = separate(refundOrScrapApplyform.NewPNR, passengers);
                result.removeFlights(flights);
            }
            return(result);
        }
Esempio n. 11
0
 /// <summary>
 /// 验证在指定时间内是否有存在相同编码的订单
 /// </summary>
 /// <param name="pnr"></param>
 /// <param name="timeFrom"></param>
 /// <param name="timeTo"></param>
 /// <param name="companyId"> </param>
 /// <returns></returns>
 public static decimal ExistsPNR(PNRPair pnr, DateTime timeFrom, DateTime timeTo, Guid companyId)
 {
     using (var command = Factory.CreateCommand())
     {
         var repository = Factory.CreateOrderRepository(command);
         return(repository.ExistsPNR(pnr, timeFrom, timeTo, companyId));
     }
 }
Esempio n. 12
0
        /// <summary>
        /// 通过编码内容和pat内容获取政策
        /// </summary>
        /// <param name="pnrPair">编码</param>
        /// <param name="pnrContent">编码内容</param>
        /// <param name="patContent">PAT内容</param>
        /// <param name="filter">过滤条件</param>
        public static RequestResult <IEnumerable <ExternalPolicyView> > Match(PNRPair pnrPair, string pnrContent, string patContent, ExternalPolicyFilter filter)
        {
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            if (string.IsNullOrWhiteSpace(pnrContent))
            {
                return(new RequestResult <IEnumerable <ExternalPolicyView> > {
                    Success = false,
                    ErrMessage = "缺少rt内容"
                });
            }
            else if (string.IsNullOrWhiteSpace(patContent))
            {
                return(new RequestResult <IEnumerable <ExternalPolicyView> > {
                    Success = false,
                    ErrMessage = "缺少pat内容"
                });
            }
            else
            {
                pnrContent = pnrContent.RemovePrintedContent().RemoveETermSpecialContentOnWeb();
                var matchedResult = new List <ExternalPolicyView>();
                var platforms     = new List <Processor.PlatformBase> {
                    Yeexing.Platform.Instance, _517Na.Platform.Instance
                };
                var validPlatforms = platforms.Where(p => p.Setting != null && p.Setting.Enabled).ToList();
                if (validPlatforms.Count > 1)
                {
                    Parallel.ForEach(validPlatforms, platform => {
                        var processor   = platform.GetPolicyProcessor();
                        var matchResult = processor.Match(pnrPair, pnrContent, patContent, filter);
                        if (matchResult.Success)
                        {
                            matchedResult.AddRange(matchResult.Result);
                        }
                    });
                }
                else
                {
                    foreach (var platform in validPlatforms)
                    {
                        var processor   = platform.GetPolicyProcessor();
                        var matchResult = processor.Match(pnrPair, pnrContent, patContent, filter);
                        if (matchResult.Success)
                        {
                            matchedResult.AddRange(matchResult.Result);
                        }
                    }
                }
                return(new RequestResult <IEnumerable <ExternalPolicyView> > {
                    Success = true,
                    Result = matchedResult
                });
            }
        }
Esempio n. 13
0
        protected override string ExecuteCore()
        {
            var flights    = Context.GetParameterValue("flights");
            var passengers = Context.GetParameterValue("passengers");
            var contact    = Context.GetParameterValue("contact");
            var policyType = Context.GetParameterValue("policyType");

            Vaild(flights, passengers, contact, policyType, InterfaceSetting);

            DataTransferObject.Order.OrderView orderView = new DataTransferObject.Order.OrderView();
            bindOrderView(flights, passengers, contact, orderView);
            var pnrh = new PNRHelper();

            try
            {
                if ((PolicyType)byte.Parse(policyType) != PolicyType.Special)
                {
                    PNRPair pnr = pnrh.ReserveSeat(loadFlightView(flights, passengers), orderView.Passengers, Employee, Company);
                    orderView.PNR = pnr;
                }
                if (pnrh.RequirePat(loadFlightView(flights, passengers), (PolicyType)byte.Parse(policyType)))
                {
                    orderView.PATPrice = pnrh.Pat(orderView.PNR, loadFlightView(flights, passengers), PassengerType.Adult);
                }
                MatchedPolicy policy = QueryPolicies((PolicyType)byte.Parse(policyType), flights, passengers, orderView);
                if (policy != null)
                {
                    if (policy.PolicyType == PolicyType.Special)
                    {
                        var p = PolicyManageService.GetSpecialPolicy(policy.Id);
                        if (p != null && p.SynBlackScreen)
                        {
                            PNRPair pnr = pnrh.ReserveSeat(loadFlightView(flights, passengers), orderView.Passengers, Employee, Company);
                            orderView.PNR = pnr;
                        }
                    }
                    orderView.IsTeam = false;
                    orderView.Source = OrderSource.InterfaceReservaOrder;
                    Order order = OrderProcessService.ProduceOrder(orderView, policy, Employee, Guid.Empty, false);
                    if (order.Source == OrderSource.InterfaceReservaOrder && !PNRPair.IsNullOrEmpty(order.ReservationPNR) && !String.IsNullOrWhiteSpace(order.Product.OfficeNo))
                    {
                        if (policy.NeedAUTH && !string.IsNullOrEmpty(policy.OfficeNumber))
                        {
                            authorize(order.ReservationPNR, policy.OfficeNumber);
                        }
                    }
                    return("<id>" + order.Id + "</id><payable>" + (policy.ConfirmResource ? 0 : 1) + "</payable>" + ReturnStringUtility.GetOrder(order));
                }
            }
            catch (Exception ex)
            {
                InterfaceInvokeException.ThrowCustomMsgException(ex.Message);
            }
            InterfaceInvokeException.ThrowCustomMsgException("生成订单失败,没有对应直达航班!");
            return("");
        }
Esempio n. 14
0
        internal static ExternalOrder NewExternalOrder(OrderView orderView, PolicyMatch.MatchedPolicy matchedPolicy, DataTransferObject.Organization.EmployeeDetailInfo employee, AuthenticationChoise choise = AuthenticationChoise.NoNeedAUTH)
        {
            if (!orderView.Flights.Any())
            {
                throw new ArgumentNullException("orderView", "缺少航段信息");
            }
            if (!orderView.Passengers.Any())
            {
                throw new ArgumentNullException("orderView", "缺少乘机人信息");
            }
            if (matchedPolicy == null)
            {
                throw new CustomException("无相关政策信息");
            }

            #region  构造BASE
            var result = new ExternalOrder
            {
                Contact          = orderView.Contact,
                ReservationPNR   = PNRPair.IsNullOrEmpty(orderView.PNR) ? null : orderView.PNR,
                IsReduce         = orderView.IsReduce,
                IsTeam           = orderView.IsTeam,
                AssociateOrderId = orderView.AssociateOrderId,
                AssociatePNR     = orderView.AssociatePNR,
                Source           = orderView.Source,
                Choise           = choise,
                CustomNo         = matchedPolicy.OriginalPolicy == null ? string.Empty : matchedPolicy.OriginalPolicy.CustomCode,
                VisibleRole      = OrderRole.Platform | OrderRole.Purchaser,
                ForbidChangPNR   = false,
                NeedAUTH         = matchedPolicy.OriginalPolicy == null ? matchedPolicy.NeedAUTH : matchedPolicy.OriginalPolicy.NeedAUTH
            };
            var deduction      = Deduction.GetDeduction(matchedPolicy);
            var product        = ProductInfo.GetProductInfo(matchedPolicy);
            var specialProduct = product as SpeicalProductInfo;
            if (specialProduct != null && !hasETDZPermission(matchedPolicy.Provider, specialProduct))
            {
                result.Supplier = getSupplierInfo(matchedPolicy, specialProduct);
            }
            else
            {
                result.Provider = getProvider(matchedPolicy, product);
            }
            result.IsCustomerResource = ProductInfo.IsCustomerResource(matchedPolicy);
            result.IsStandby          = ProductInfo.IsStandby(matchedPolicy);
            result.Purchaser          = getPurchaserInfo(employee, deduction);
            var pnrInfo = PNRInfo.GetPNRInfo(orderView, matchedPolicy);
            result.AddPNRInfo(pnrInfo);
            result.TripType = pnrInfo.TripType;
            result.Status   = result.RequireConfirm ? OrderStatus.Applied : OrderStatus.Ordered;
            if (result.Status == OrderStatus.Applied)
            {
                result.VisibleRole |= result.IsThirdRelation ? OrderRole.Supplier : OrderRole.Provider;
            }
            #endregion
            return(result);
        }
Esempio n. 15
0
        /// <summary>
        /// 资源方确认成功
        /// </summary>
        internal bool ConfirmResourceSuccessful(PNRPair pnrCode, decimal?patPrice, Guid oemId)
        {
            checkConfirmResource();
            var fareRevised = updateOrderForResource(pnrCode, patPrice, oemId);

            if (!IsThirdRelation || patPrice.HasValue)
            {
                Status = OrderStatus.Ordered;
            }
            return(fareRevised);
        }
Esempio n. 16
0
 /// <summary>
 /// 添加编码信息
 /// </summary>
 internal void AddPNRInfo(PNRInfo pnrInfo)
 {
     if (null == pnrInfo)
     {
         throw new ArgumentNullException("pnrInfo", "编码信息不能为空");
     }
     if (_pnrInfos.Exists(item => PNRPair.Equals(item.Code, pnrInfo.Code)))
     {
         throw new RepeatedItemException("不能重复加入同一编码");
     }
     _pnrInfos.Add(pnrInfo);
 }
Esempio n. 17
0
        public static void ValidatePNR(ReservedPnr reservedPnr, Common.Enums.PassengerType passengerType)
        {
            if (reservedPnr.HasCanceled)
            {
                throw new PNRCanceledExceptioin(passengerType.GetDescription() + "订座记录已取消");
            }
            if (PNRPair.IsNullOrEmpty(reservedPnr.PnrPair))
            {
                throw new ArgumentException("缺少编码");
            }

            if (reservedPnr.Passengers == null || reservedPnr.Passengers.Count == 0)
            {
                throw new CustomException(passengerType.GetDescription() + "编码缺少乘机人信息");
            }
            if (reservedPnr.Passengers.First().Type != passengerType)
            {
                throw new CustomException(passengerType.GetDescription() + "编码错误(不是" + passengerType.GetDescription() + "编码)");
            }

            if (reservedPnr.Voyage.Segments == null || reservedPnr.Voyage.Segments.Count == 0)
            {
                throw new CustomException(passengerType.GetDescription() + "编码缺少航班信息");
            }
            var errorPassenger = reservedPnr.Passengers.FirstOrDefault(item => string.IsNullOrWhiteSpace(item.CertificateNumber));

            if (errorPassenger != null)
            {
                throw new CustomException(passengerType.GetDescription() + "编码乘机人 [" + errorPassenger.Name + "] 缺少有效的 SSR FOID 项");
            }

            foreach (var item in reservedPnr.Voyage.Segments)
            {
                if (item.Status == "DW")
                {
                    throw new PNRAlternateStateException(passengerType.GetDescription() + "订座记录处于候补状态");
                }
                if (!(item.Status.Contains("K") || item.Status == "RR" ||
                      (item.Status == "NN" && System.Configuration.ConfigurationManager.AppSettings["NNStatusAirline"].Contains(item.AirlineCode))))
                {
                    throw new SellOutException("用户所定航班已销售完毕");
                }
            }
            if (reservedPnr.IsTeam && reservedPnr.TotalNumber != reservedPnr.ActualNumber)
            {
                throw new CustomException("团队成员数量与团队编码成员数不一致");
            }
            if (reservedPnr.NeedFill)
            {
                throw new CustomException("缺口程编码,需要搭桥");
            }
        }
Esempio n. 18
0
        /// <summary>
        /// 根据旅客订座记录编号,验证编码是否有效。
        /// </summary>
        /// <param name="pnrPair">旅客订座记录编号</param>
        /// <param name="passengerType"> </param>
        /// <param name="oemId"> </param>
        public static void ValidatePNR(PNRPair pnrPair, Common.Enums.PassengerType passengerType, Guid oemId)
        {
            ExecuteResult <ReservedPnr> executeResult = GetReservedPnr(pnrPair, oemId);

            if (executeResult.Success)
            {
                ValidatePNR(executeResult.Result, passengerType);
            }
            else
            {
                throw new ParseException(passengerType.GetDescription() + "编码解析失败");
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 得到被取消的旅客订座记录编号
        /// </summary>
        /// <param name="str">待解析字串</param>
        /// <returns>旅客订座记录编号</returns>
        public static PNRPair GetCanceledPNRCode(string str)
        {
            PNRPair pnrPair = null;
            Regex   pattern = new Regex(RegexUtil.XEPNRCmdRegex);
            Match   match   = pattern.Match(str);

            if (match.Success)
            {
                pnrPair = new PNRPair(match.Groups["PNRCode"].Value, null);
            }

            return(pnrPair);
        }
Esempio n. 20
0
        /// <summary>
        /// 提供资源
        /// </summary>
        internal bool SupplyResource(PNRPair pnrCode, decimal?patPrice, Guid oemId)
        {
            checkSupplyResource();
            var fareRevised = updateOrderForResource(pnrCode, patPrice, oemId);

            if (!IsThirdRelation || patPrice.HasValue)
            {
                Status = Status == OrderStatus.PaidForSupply ? OrderStatus.PaidForETDZ : OrderStatus.Ordered;
            }
            VisibleRole         |= OrderRole.Provider;
            this.IsEmergentOrder = false;
            return(fareRevised);
        }
Esempio n. 21
0
 private bool authorize(PNRPair pnr, string officeNo)
 {
     try
     {
         CommandService.AuthorizeByOfficeNo(pnr, officeNo, Guid.Empty);
         return(true);
     }
     catch (Exception ex)
     {
         LogService.SaveExceptionLog(ex);
         return(false);
     }
 }
Esempio n. 22
0
 public void InitData(Service.Order.Domain.Order order, Service.Order.Domain.PNRInfo pnrInfo, Mode mode)
 {
     this.m_pnrCode    = pnrInfo.Code;
     m_ETDZPNR         = order.ETDZPNR;
     m_reservePNR      = order.ReservationPNR;
     m_adultPNR        = order.AssociatePNR;
     m_IsChildrenOrder = order.IsChildrenOrder;
     this.passenger.InitData(order, pnrInfo.Passengers, mode, pnrInfo.Flights);
     this.voyage.InitData(order, pnrInfo.Flights, mode);
     this.divOperation.Visible     = mode == Mode.Apply;
     this.divPNRCodeInfo.Visible   = mode != Mode.Supply;
     this.btnApplyUpgrade.Visible  = order.Product.ProductType != ProductType.Special && order.Product.ProductType != ProductType.Team && (order.TripType == ItineraryType.OneWay || order.TripType == ItineraryType.Roundtrip);
     this.btnApplyPostpone.Visible = order.Product.ProductType != ProductType.Special;
 }
Esempio n. 23
0
        public RequestResult <IEnumerable <ExternalPolicyView> > Match(PNRPair pnrPair, string pnrContent, string patContent, ExternalPolicyFilter filter)
        {
            RequestResult <IEnumerable <ExternalPolicyView> > result;
            var request  = string.Empty;
            var response = string.Empty;

            try {
                pnrContent = pnrContent.Trim().TrimEnd('>');
                patContent = patContent.Trim().TrimEnd('>');
                var requestModel = new _51bookMatchPolicy.getPolicyByPnrTxtRequest {
                    agencyCode                  = Platform.UserName,
                    pnrTxt                      = pnrContent,
                    pataTxt                     = patContent,
                    needSpeRulePolicy           = 0,
                    needSpePricePolicySpecified = true,
                    needSpePricePolicy          = 1,
                    needSpeRulePolicySpecified  = true,
                    onlyOnWorking               = 0,
                    onlyOnWorkingSpecified      = true,
                    allowSwitchPnr              = 1,
                    allowSwitchPnrSpecified     = true
                };
                var signValue = new Dictionary <string, string>
                {
                    { "agencyCode", Platform.UserName },
                    { "allowSwitchPnr", requestModel.allowSwitchPnr.ToString() },
                    { "needSpePricePolicy", requestModel.needSpePricePolicy.ToString() },
                    { "needSpeRulePolicy", requestModel.needSpeRulePolicy.ToString() },
                    { "onlyOnWorking", requestModel.onlyOnWorking.ToString() }
                };
                requestModel.sign = Sign(signValue);
                var platform = new _51bookMatchPolicy.GetPolicyByPnrTxtServiceImpl_1_0Service {
                    Url     = Platform.Address_GetPolicyByPnrText,
                    Timeout = Platform.Timeout
                };
                request = GetModelString(requestModel);
                var responseModel = platform.getPolicyByPnrTxt(requestModel);
                response = GetModelString(responseModel);
                result   = parseResponse(responseModel, filter);
            } catch (Exception ex) {
                LogService.SaveExceptionLog(ex, "通过编码匹配51book政策");
                result = new RequestResult <IEnumerable <ExternalPolicyView> > {
                    Success    = false,
                    ErrMessage = "系统错误,请联系平台"
                };
                response = ex.Message;
            }
            SaveRequestLog(request, response, "匹配政策");
            return(result);
        }
Esempio n. 24
0
        private string PNRRender(PNRPair pnrPair)
        {
            string pnrString = string.Empty;

            if (!string.IsNullOrEmpty(pnrPair.PNR))
            {
                pnrString += string.Format(PNRFORMAT, pnrPair.PNR, "小");
            }
            if (!string.IsNullOrEmpty(pnrPair.BPNR))
            {
                pnrString += string.Format(PNRFORMAT, pnrPair.BPNR, "大");
            }
            return(pnrString);
        }
Esempio n. 25
0
        bool updateOrderForResource(PNRPair pnrCode, decimal?patPrice, Guid oemId)
        {
            if (PNRPair.IsNullOrEmpty(pnrCode))
            {
                throw new CustomException("编码信息不能为空");
            }
            var  pnrInfo     = this._pnrInfos.First();
            bool fareRevised = false;

            fareRevised    = pnrInfo.UpdateContentForResource(pnrCode, (Product as SpeicalProductInfo).SpeicalProductType != SpecialProductType.OtherSpecial, patPrice, IsStandby, oemId, PNRInfos.First().PNRContent != string.Empty, IsThirdRelation);
            ReservationPNR = pnrInfo.Code;
            SupplyTime     = DateTime.Now;
            return(fareRevised);
        }
Esempio n. 26
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);
                }
            }
        }
Esempio n. 27
0
        internal PNRPair FillTicketNos(PNRPair etdzPNR, ETDZMode mode, string settleCode, IEnumerable <TicketNoView.Item> ticketNoItems, Guid oemId)
        {
            PNRPair result = validateTicketNos(etdzPNR, ticketNoItems, oemId);

            foreach (Passenger passenger in Passengers)
            {
                TicketNoView.Item ticketNos = ticketNoItems.FirstOrDefault(item => string.Compare(item.Name, passenger.Name, StringComparison.OrdinalIgnoreCase) == 0);
                if (ticketNos == null)
                {
                    throw new CustomException("缺少乘机人[" + passenger.Name + "]的票号信息。");
                }
                passenger.FillTicketNos(settleCode, ticketNos.TicketNos, mode);
            }
            Code = result;
            return(result);
        }
Esempio n. 28
0
        /// <summary>
        /// 判断对应的起飞机场的旅客订座记录是否被取消。
        /// </summary>
        /// <param name="airport"></param>
        /// <returns></returns>
        public bool PnrCodeCancelled(string airport)
        {
            if (airport == null)
            {
                throw new ArgumentNullException("airport");
            }
            if (ExchangeList.FirstStop.Airport != airport && (ExchangeList.SecondStop == null || ExchangeList.SecondStop.Airport != airport))
            {
                //throw new ArgumentNullException("airport");
                return(true);   //在航段不存在的情况下 默认为验证通过
            }

            var exchangeDetail = ExchangeList.FirstStop.Airport == airport ? ExchangeList.FirstStop : ExchangeList.SecondStop;

            return(PNRPair.IsNullOrEmpty(exchangeDetail.PnrPair));
        }
Esempio n. 29
0
        /// <summary>
        /// 出票方同意退/废票
        /// 不会退款,仅提交财务审核
        /// </summary>
        internal IEnumerable <Service.Distribution.Domain.Bill.Refund.RefundFlight> AgreeByProvider(RefundProcessView processView, string operatorAccount, string operatorName)
        {
            checkProcessByBusiness();
            if (RequireSeparatePNR && PNRPair.IsNullOrEmpty(processView.NewPNR))
            {
                throw new CustomException("未提供分离后的新编码");
            }
            NewPNR = processView.NewPNR;
            var refundFlights = AgreeByProviderExecuteCore(processView);

            Status          = RefundApplyformStatus.AgreedByProviderBusiness;
            Operator        = operatorName;
            OperatorAccount = operatorAccount;
            Processed();
            return(refundFlights);
        }
Esempio n. 30
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("订座失败");
            }
        }