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(""); }
/// <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()); }