示例#1
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());
        }
        private void policyRadioButtons_CheckedChanged(object sender, EventArgs e)
        {
            IUserPolicy policy;

            switch ((sender as RadioButton)?.Text)
            {
            case "Standard":
                policy = new StandardPolicy();
                break;

            case "Advanced":
                policy = new VariablePolicy();
                break;

            case "Special":
                policy = new SpecialPolicy();
                break;

            default:
                throw new ApplicationException("Unknown policy");
            }
            _repo = new UserRepo(policy);
        }
        private void InitlblData()
        {
            SpecialPolicy Special = PolicyManageService.GetSpecialPolicy(Guid.Parse(Request.QueryString["id"].ToString()));

            if (Special != null)
            {
                lowTr.Visible         = false;
                hidIds.Value          = Request.QueryString["id"];
                lblAirline.Text       = Special.Airline;
                lblVoyage.Text        = Special.VoyageType.GetDescription();
                lblOfficeNo.Text      = Special.OfficeCode;
                lblSpecialType.Text   = Special.Type.GetDescription();
                lblDeparture.Text     = Special.Departure;
                lblArrival.Text       = Special.Arrival;
                lblDepartureDate.Text = (Special.DepartureDateStart == null ? "" : Special.DepartureDateStart.ToString("yyyy-MM-dd")) + "至" + (Special.DepartureDateEnd == null ? "" : Special.DepartureDateEnd.ToString("yyyy-MM-dd"));
                lblOutWithFilght.Text = Special.DepartureFlightsFilterType == LimitType.None ? "所有" : (Special.DepartureFlightsFilterType == LimitType.Include ? "适用:" + Special.DepartureFlightsFilter : "不适用:" + Special.DepartureFlightsFilter);
                lblExceptDay.Text     = Special.DepartureDateFilter;
                //lblDepartureWeekFilter.Text = PublicClass.StringOperation.TransferToChinese(Special.DepartureDatesFilter);
                lblCreateTime.Text = Special.ProvideDate.ToString("yyyy-MM-dd");
                lblCustomCode.Text = Special.CustomCode;
                lblRetreat.Text    = "作废规定:" + Special.InvalidRegulation + "<br />"
                                     + "改签规定:" + Special.ChangeRegulation + "<br />"
                                     + "签转规定:" + Special.EndorseRegulation + "<br />"
                                     + "退票规定:" + Special.RefundRegulation + "<br />";

                lblDays.Text                = Special.BeforehandDays > -1 ? Special.BeforehandDays + "天" : "";
                lblChang.Text               = Special.ConfirmResource ? "需要" : "不需要";
                lblDrawerCondition.Text     = Special.DrawerCondition;
                lblRemark.Text              = Special.Remark;
                lblPrintBeforeTwoHours.Text = Special.PrintBeforeTwoHours ? "可以" : "不可以";
                if (Special.Freezed)
                {
                    this.btnunlock.Visible = true;
                    this.btnlock.Visible   = false;
                    this.unlock.Visible    = true;
                    [email protected]     = false;
                }
                else
                {
                    this.btnunlock.Visible = false;
                    this.btnlock.Visible   = true;
                    this.unlock.Visible    = false;
                    [email protected]     = true;
                }
                if (Special.PlatformAudited)
                {
                    btnTongGuo.Visible   = false;
                    btnUnTongGuo.Visible = true;
                }
                else
                {
                    btnTongGuo.Visible   = true;
                    btnUnTongGuo.Visible = false;
                }
                if (Special.PriceType == PriceType.Price)
                {
                    lblPrice.Text = Special.Price == -1 ? "" : "¥" + Special.Price.TrimInvaidZero();
                    if (Special.IsInternal)
                    {
                        lblInternal.Text = "¥" + Special.InternalCommission.TrimInvaidZero();
                    }
                    else
                    {
                        internalTitle.Visible = false;
                        internalValue.Visible = false;
                    }
                    lblSubOrdinate.Text = Special.SubordinateCommission.TrimInvaidZero() == "-1" ? "" : "¥" + Special.SubordinateCommission.TrimInvaidZero();
                    if (Special.IsPeer)
                    {
                        lblProfession.Text = "¥" + Special.ProfessionCommission.TrimInvaidZero();
                    }
                    else
                    {
                        professionTitle.Visible = false;
                        professionValue.Visible = false;
                    }
                }
                else
                {
                    lblPrice.Text = Special.Price == -0.01M ? "" : "直减 " + (Special.Price * 100).TrimInvaidZero() + "%";
                    if (Special.IsInternal)
                    {
                        lblInternal.Text = (Special.InternalCommission * 100).TrimInvaidZero() + "%";
                    }
                    else
                    {
                        internalTitle.Visible = false;
                        internalValue.Visible = false;
                    }
                    lblSubOrdinate.Text = Special.SubordinateCommission == -1 ? "" : (Special.SubordinateCommission * 100).TrimInvaidZero() + "%";
                    if (Special.IsPeer)
                    {
                        lblProfession.Text = (Special.ProfessionCommission * 100).TrimInvaidZero() + "%";
                    }
                    else
                    {
                        professionTitle.Visible = false;
                        professionValue.Visible = false;
                    }
                }
                if (Special.Type == SpecialProductType.CostFree)
                {
                    lblPrice.Text              = Special.Price == -1 ? "" : "¥" + Special.Price.TrimInvaidZero();
                    freeTicket.Visible         = true;
                    productNumberTitle.Visible = false;
                    productNumberValue.Visible = false;
                    lblExceptAirlines.Text     = Special.ExceptAirways;
                    if (Special.SynBlackScreen)
                    {
                        lblIsSynsy.Text = "同步:舱位 " + Special.Berths;
                    }
                    else
                    {
                        lblIsSynsy.Text = "不同步:可提供产品数量 " + Special.ResourceAmount;
                    }
                }
                if (Special.Type == SpecialProductType.Bloc || Special.Type == SpecialProductType.Business)
                {
                    productNumberTitle.Visible = false;
                    productNumberValue.Visible = false;

                    bussiness.Visible = true;
                    if (Special.Type == SpecialProductType.Bloc)
                    {
                        this.lblTicketType.Text = Special.TicketType.GetDescription();
                    }
                    else
                    {
                        this.ticketTypeTitle.Visible = false;
                        this.ticketTypeValue.Visible = false;
                    }
                    lowTr.Visible    = true;
                    lblLowtype.Text  = Special.LowNoType.GetDescription();
                    lblLowPrice.Text = Special.LowNoType == LowNoType.LowInterval ? (Special.LowNoType == LowNoType.LowInterval ? "票面价区间:" + Special.LowNoMinPrice.TrimInvaidZero() + "元(包含)至" + Special.LowNoMaxPrice.TrimInvaidZero() + "元(包含)" : "") : "无";
                }
                if (Special.Type == SpecialProductType.LowToHigh)
                {
                    productNumberTitle.Visible = false;
                    productNumberValue.Visible = false;

                    bussiness.Visible = true;

                    this.ticketTypeTitle.Visible = false;
                    this.ticketTypeValue.Visible = false;
                    lowTr.Visible = false;

                    lblPrice.Text = "";
                    if (Special.IsInternal)
                    {
                        lblInternal.Text = "返佣:" + (Special.InternalCommission * 100).TrimInvaidZero() + "%";
                    }
                    else
                    {
                        internalTitle.Visible = false;
                        internalValue.Visible = false;
                    }
                    lblSubOrdinate.Text = "返佣:" + (Special.SubordinateCommission == -1 ? "" : (Special.SubordinateCommission * 100).TrimInvaidZero() + "%");
                    if (Special.IsPeer)
                    {
                        lblProfession.Text = "返佣:" + (Special.ProfessionCommission * 100).TrimInvaidZero() + "%";
                    }
                    else
                    {
                        professionTitle.Visible = false;
                        professionValue.Visible = false;
                    }
                }
                else
                {
                    lblPrice.Text = Special.Price == -1 ? "" : "¥" + Special.Price.TrimInvaidZero();
                }

                lblExceptAirlines.Text = Special.ExceptAirways;

                lblNum.Text   = Special.ResourceAmount == -1 ? "" : Special.ResourceAmount + "张";
                lblBunks.Text = Special.Berths;
            }
        }
        /// <summary>
        /// 新增特价政策
        /// </summary>
        /// <param name="policy"></param>
        public void AddSpeaiaPolicy(RequestSpecialPolicy policy)
        {
            var           currentUser = AuthManager.GetCurrentUser();
            var           builder     = AggregationFactory.CreateBuiler <LocalPolicyBuilder>();
            SpecialPolicy localPolicy = builder.CreateSpecialPolicy(Mapper.Map <RequestSpecialPolicy, SpecialPolicy>(policy));

            localPolicy.CreateMan = currentUser.OperatorName;
            localPolicy.RoleType  = currentUser.Type;
            localPolicy.Code      = currentUser.Code;
            if (currentUser.Type == "Supplier")
            {
                localPolicy.CarrierCode = currentUser.CarrierCode;
                var bm = this.businessmanRepository.FindAllNoTracking(p => p.Code == currentUser.CarrierCode).OfType <Carrier>().FirstOrDefault();
                if (bm != null)
                {
                    localPolicy.CarrierWeek             = bm.RestWork.WeekDay;
                    localPolicy.Carrier_AnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.ServiceOnLineTime,
                        EndTime   = bm.NormalWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_ReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.ServiceOnLineTime,
                        EndTime   = bm.NormalWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.WorkOnLineTime,
                        EndTime   = bm.NormalWork.WorkUnLineTime
                    };
                    localPolicy.Carrier_WeekAnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.ServiceOnLineTime,
                        EndTime   = bm.RestWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WeekReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.ServiceOnLineTime,
                        EndTime   = bm.RestWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WeekWorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.WorkOnLineTime,
                        EndTime   = bm.RestWork.WorkUnLineTime
                    };
                }
                var supbm = this.businessmanRepository.FindAllNoTracking(p => p.Code == currentUser.Code).OfType <Supplier>().FirstOrDefault();
                if (supbm != null)
                {
                    localPolicy.SupplierWeek    = supbm.SupRestWork.WeekDay;
                    localPolicy.AnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupNormalWork.ServiceOnLineTime,
                        EndTime   = supbm.SupNormalWork.ServiceUnLineTime
                    };;
                    localPolicy.ReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupNormalWork.ServiceOnLineTime,
                        EndTime   = supbm.SupNormalWork.ServiceUnLineTime
                    };;
                    localPolicy.WorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupNormalWork.WorkOnLineTime,
                        EndTime   = supbm.SupNormalWork.WorkUnLineTime
                    };
                    localPolicy.WeekAnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupRestWork.ServiceOnLineTime,
                        EndTime   = supbm.SupRestWork.ServiceUnLineTime
                    };;
                    localPolicy.WeekReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupRestWork.ServiceOnLineTime,
                        EndTime   = supbm.SupRestWork.ServiceUnLineTime
                    };;
                    localPolicy.WeeKWorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = supbm.SupRestWork.WorkOnLineTime,
                        EndTime   = supbm.SupRestWork.WorkUnLineTime
                    };
                }
            }
            else
            {
                localPolicy.CarrierCode = currentUser.Code;
                var bm = this.businessmanRepository.FindAllNoTracking(p => p.Code == currentUser.Code).OfType <Carrier>().FirstOrDefault();
                if (bm != null)
                {
                    localPolicy.CarrierWeek             = bm.RestWork.WeekDay;
                    localPolicy.Carrier_AnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.ServiceOnLineTime,
                        EndTime   = bm.NormalWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_ReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.ServiceOnLineTime,
                        EndTime   = bm.NormalWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.NormalWork.WorkOnLineTime,
                        EndTime   = bm.NormalWork.WorkUnLineTime
                    };
                    localPolicy.Carrier_WeekAnnulTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.ServiceOnLineTime,
                        EndTime   = bm.RestWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WeekReturnTicketTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.ServiceOnLineTime,
                        EndTime   = bm.RestWork.ServiceUnLineTime
                    };;
                    localPolicy.Carrier_WeekWorkTime = new BPiaoBao.DomesticTicket.Platform.Plugin.StartAndEndTime
                    {
                        StartTime = bm.RestWork.WorkOnLineTime,
                        EndTime   = bm.RestWork.WorkUnLineTime
                    };
                }
            }
            unitOfWorkRepository.PersistCreationOf(localPolicy);
            unitOfWork.Commit();
        }