Esempio n. 1
0
        private void GetNormalValue(string type)
        {
            if (hidBunks.Value == "")
            {
                ShowMessage("舱位不能为空!");
                return;
            }
            VoyageType voyage = VoyageType.RoundTrip;

            LimitType DerpartrueFilghtType = LimitType.None;

            if (radYiXia.Checked)
            {
                DerpartrueFilghtType = LimitType.Include;
            }
            if (radBuXian.Checked)
            {
                DerpartrueFilghtType = LimitType.None;
            }
            if (radBuYiXia.Checked)
            {
                DerpartrueFilghtType = LimitType.Exclude;
            }

            LimitType returnFilghtType = LimitType.None;

            if (radReturnYiXia.Checked)
            {
                returnFilghtType = LimitType.Include;
            }
            if (radReturnBuXian.Checked)
            {
                returnFilghtType = LimitType.None;
            }
            if (radReturnBuYiXia.Checked)
            {
                returnFilghtType = LimitType.Exclude;
            }
            string weekStr = "";

            if (mon.Checked)
            {
                weekStr += "1,";
            }
            if (tue.Checked)
            {
                weekStr += "2,";
            }
            if (wed.Checked)
            {
                weekStr += "3,";
            }
            if (thur.Checked)
            {
                weekStr += "4,";
            }
            if (fri.Checked)
            {
                weekStr += "5,";
            }
            if (sat.Checked)
            {
                weekStr += "6,";
            }
            if (sun.Checked)
            {
                weekStr += "7,";
            }
            if (weekStr != "")
            {
                weekStr = weekStr.Substring(0, weekStr.Length - 1);
            }

            RoundTripPolicy roundTrips = PolicyManageService.GetRoundTripPolicy(Guid.Parse(Request.QueryString["Id"]));

            try
            {
                if (type == "Update")
                {
                    var roundTrip = new RoundTripPolicy
                    {
                        Airline                    = lblAirline.Text,
                        Arrival                    = txtArrivalAirports.AirportsCode.Join("/"),
                        Departure                  = txtDepartureAirports.AirportsCode.Join("/"),
                        AutoAudit                  = chkAuto.Checked,
                        ChangePNR                  = chkChangePNR.Checked,
                        DepartureDateEnd           = DateTime.Parse(txtDepartrueEnd.Text),
                        DepartureDatesFilter       = "",
                        DepartureWeekFilter        = weekStr,
                        DepartureDateFilter        = txtPaiChu.Text,
                        DepartureDateStart         = DateTime.Parse(txtDepartrueStart.Text),
                        DepartureDatesFilterType   = DateMode.Date,
                        DepartureFlightsFilter     = txtDepartrueFilght.Text,
                        DepartureFlightsFilterType = DerpartrueFilghtType,
                        ReturnDateStart            = DateTime.Parse(txtReturnStart.Text),
                        ReturnDateEnd              = DateTime.Parse(txtReturnEnd.Text),
                        DrawerCondition            = txtDrawerCondition.Text,
                        Remark                  = txtRemark.Text,
                        ReturnDatesFilter       = "",
                        ReturnFlightsFilter     = txtReturnFilght.Text,
                        ReturnFlightsFilterType = returnFilghtType,
                        StartPrintDate          = DateTime.Parse(txtProvideDate.Text),
                        SubordinateCommission   = decimal.Parse(txtSubordinateCommission.Text) / 100,
                        ProfessionCommission    = decimal.Parse(txtProfessionCommission.Text) / 100,
                        InternalCommission      = decimal.Parse(txtInternalCommission.Text) / 100,
                        TravelDays              = 0,
                        TicketType              = chkTicket.Text == "B2B" ? TicketType.B2B : TicketType.BSP,
                        Berths                  = hidBunks.Value,
                        VoyageType              = voyage,
                        ReturnDatesFilterType   = DateMode.Date,
                        OfficeCode              = dropOffice.SelectedItem.Text,
                        BeforehandDays          = short.Parse(txtTiQianDays.Text),
                        ChangeRegulation        = selChangeRegulation.Text,
                        EndorseRegulation       = selEndorseRegulation.Text,
                        InvalidRegulation       = selInvalidRegulation.Text,
                        RefundRegulation        = selRefundRegulation.Text,
                        Price      = decimal.Parse(txtPrice.Text),
                        Audited    = roundTrips.Audited,
                        AuditTime  = roundTrips.AuditTime,
                        CreateTime = roundTrips.CreateTime,
                        Creator    = roundTrips.Creator,
                        Freezed    = roundTrips.Freezed,
                        Owner      = roundTrips.Owner,
                        Suspended  = roundTrips.Suspended,
                        Id         = Guid.Parse(Request.QueryString["Id"])
                    };
                    PolicyManageService.UpdateRoundTripPolicy(roundTrip, this.CurrentUser.UserName);
                }
                if (type == "Copy")
                {
                    var roundTripInfo = new RoundTripPolicyReleaseInfo
                    {
                        BasicInfo = new RoundTripPolicyBasicInfo
                        {
                            Airline                    = ddlAirline.SelectedValue,
                            Arrival                    = txtArrivalAirports.AirportsCode.Join("/"),
                            Departure                  = txtDepartureAirports.AirportsCode.Join("/"),
                            DepartureDatesFilter       = "",
                            DepartureDatesFilterType   = DateMode.Date,
                            DepartureFlightsFilter     = txtDepartrueFilght.Text,
                            DepartureFlightsFilterType = DerpartrueFilghtType,
                            Remark                  = txtRemark.Text,
                            DrawerCondition         = txtDrawerCondition.Text,
                            ReturnDatesFilter       = "",
                            ReturnFlightsFilter     = txtReturnFilght.Text,
                            ReturnFlightsFilterType = returnFilghtType,
                            TravelDays              = 0,
                            VoyageType              = voyage,
                            ReturnDatesFilterType   = DateMode.Date,
                            OfficeCode              = dropOffice.SelectedItem.Text,
                            Owner             = this.CurrentUser.Owner,
                            BeforehandDays    = short.Parse(txtTiQianDays.Text),
                            ChangeRegulation  = selChangeRegulation.Text,
                            EndorseRegulation = selEndorseRegulation.Text,
                            InvalidRegulation = selInvalidRegulation.Text,
                            RefundRegulation  = selRefundRegulation.Text
                        }
                    };
                    var list = new List <RoundTripPolicyRebateInfo>
                    {
                        new RoundTripPolicyRebateInfo
                        {
                            DepartureWeekFilter   = weekStr,
                            DepartureDateFilter   = txtPaiChu.Text,
                            AutoAudit             = chkAuto.Checked,
                            ChangePNR             = chkChangePNR.Checked,
                            DepartureDateEnd      = DateTime.Parse(txtDepartrueEnd.Text),
                            DepartureDateStart    = DateTime.Parse(txtDepartrueStart.Text),
                            ReturnDateStart       = DateTime.Parse(txtReturnStart.Text),
                            ReturnDateEnd         = DateTime.Parse(txtReturnEnd.Text),
                            StartPrintDate        = DateTime.Parse(txtProvideDate.Text),
                            SubordinateCommission = decimal.Parse(txtSubordinateCommission.Text) / 100,
                            ProfessionCommission  = decimal.Parse(txtProfessionCommission.Text) / 100,
                            InternalCommission    = decimal.Parse(txtInternalCommission.Text) / 100,
                            TicketType            = chkTicket.Text == "B2B" ? TicketType.B2B : TicketType.BSP,
                            Berths = hidBunks.Value,
                            Price  = decimal.Parse(txtPrice.Text)
                        }
                    };
                    roundTripInfo.Rebates = list;
                    PolicyManageService.ReleaseRoundTripPolicies(roundTripInfo, this.CurrentUser.UserName);
                }
                if (Request.QueryString["Check"] == "view")
                {
                    RegisterScript(
                        type == "Update"
                            ? "alert('修改成功');window.location.href='./back_to_policy_view.aspx'"
                            : "alert('复制成功');window.location.href='./back_to_policy_view.aspx'", true);
                }
                else
                {
                    RegisterScript(
                        type == "Update"
                            ? "alert('修改成功');window.location.href='./back_to_policy_manage.aspx'"
                            : "alert('复制成功');window.location.href='./back_to_policy_manage.aspx'", true);
                }
            }
            catch (FormatException)
            {
                ShowMessage("输入字符格式不正确,请重新输入");
            }
            catch (Exception ex)
            {
                ShowExceptionMessage(ex, type == "Update" ? "修改往返政策" : "复制往返政策");
            }
        }