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" ? "修改往返政策" : "复制往返政策"); } }
private bool GetNormalValue(string type) { VoyageType voyage = VoyageType.OneWay; LimitType DerpartrueFilghtType = LimitType.None; if (radYiXia.Checked) { DerpartrueFilghtType = LimitType.Include; } if (radBuXian.Checked) { DerpartrueFilghtType = LimitType.None; } if (radBuYiXia.Checked) { DerpartrueFilghtType = LimitType.Exclude; } LimitType RetrurnFilghtType = LimitType.None; if (radReturnYiXia.Checked) { RetrurnFilghtType = LimitType.Include; } if (radReturnBuXian.Checked) { RetrurnFilghtType = LimitType.None; } if (radReturnBuYiXia.Checked) { RetrurnFilghtType = LimitType.Exclude; } string RetrurnFilght = txtReturnFilght.Text; 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); } try { if (type == "Update") { var bargains = PolicyManageService.GetBargainPolicy(Guid.Parse(Request.QueryString["Id"])); var bargain = new BargainPolicy { OfficeCode = dropOffice.SelectedItem == null ? "" : hidOfficeNo.Value, ImpowerOffice = dropOffice.SelectedItem == null ? false : Convert.ToBoolean(dropOffice.SelectedValue), IsInternal = neibuTh.Visible, IsPeer = tong.Visible, CustomCode = ddlCustomCode.Visible ? ddlCustomCode.SelectedValue.Trim() : lblCustomerCode.Text, Airline = lblAirline.Text, Transit = "", //DepartureDatesFilter = "", //DepartureDatesFilterType = DateMode.Date, Arrival = txtArrivalAirports.AirportsCode.Join("/"), AutoAudit = chkAuto.Checked, ChangePNR = chkChangePNR.Checked, Departure = txtDepartureAirports.AirportsCode.Join("/"), DepartureDateEnd = DateTime.Parse(txtDepartrueEnd.Text), DepartureWeekFilter = weekStr, DepartureDateFilter = txtPaiChu.Text, DepartureDateStart = DateTime.Parse(txtDepartrueStart.Text), DepartureFlightsFilter = DerpartrueFilghtType == LimitType.None ? "" : txtDepartrueFilght.Text, DepartureFlightsFilterType = DerpartrueFilghtType, ReturnFlightsFilterType = RetrurnFilghtType, ReturnFlightsFilter = RetrurnFilghtType == LimitType.None ? "" : RetrurnFilght, Remark = txtRemark.Text.Replace("\r", "").Replace("\n", ""), ExceptAirways = txtOutWithFilght.Text, DrawerCondition = txtDrawerCondition.Text.Replace("\r", "").Replace("\n", ""), StartPrintDate = DateTime.Parse(txtProvideDate.Text), SubordinateCommission = decimal.Parse(txtSubordinateCommission.Text) / 100, ProfessionCommission = tong.Visible ? decimal.Parse(txtProfessionCommission.Text) / 100 : -1M, InternalCommission = neibuTh.Visible ? decimal.Parse(txtInternalCommission.Text) / 100 : -1M, ChangeRegulation = selChangeRegulation.Text, EndorseRegulation = selEndorseRegulation.Text, RefundRegulation = selRefundRegulation.Text, InvalidRegulation = selInvalidRegulation.Text, TicketType = chkTicket.Text == "B2B" ? TicketType.B2B : TicketType.BSP, Berths = hidBunks.Value, //Price = discount.Visible ? ( // selPrice.SelectedIndex == 0 // ? decimal.Parse(txtPrice.Text == "" ? "-1" : txtPrice.Text) // : decimal.Parse(txtDiscount.Text == "" ? "-1" : txtDiscount.Text) / 100) : -1, PriceType = discount.Visible && selPrice.Visible ? (PriceType)(int.Parse(selPrice.Value)) : PriceType.Price, BeforehandDays = txtTiQianDays.Text == "" ? (short)0 : short.Parse(txtTiQianDays.Text), MostBeforehandDays = txtMostTiQianDays.Text == "" ? (short)-1 : short.Parse(txtMostTiQianDays.Text), Creator = this.CurrentUser.UserName, CreateTime = bargains.CreateTime, Suspended = bargains.Suspended, AuditTime = bargains.AuditTime, Audited = bargains.Audited, Freezed = bargains.Freezed, Owner = bargains.Owner, MultiSuitReduce = chkddlc.Checked, PrintBeforeTwoHours = chkPrintBeforeTwoHours.Checked, Id = Guid.Parse(Request.QueryString["Id"]) }; if (titlePolicy.InnerText.Trim() == "单程") { bargain.Departure = txtDepartureAirports.AirportsCode.Join("/"); bargain.Arrival = txtArrivalAirports.AirportsCode.Join("/"); bargain.VoyageType = VoyageType.OneWay; bargain.TravelDays = 0; bargain.Price = selPrice.SelectedIndex == 0 ? decimal.Parse(txtPrice.Text == "" ? "-1" : txtPrice.Text) : (selPrice.SelectedIndex == 1 ? decimal.Parse(txtDiscount.Text == "" ? "-100" : txtDiscount.Text) / 100 : -1); } else if (titlePolicy.InnerText.Trim() == "往返") { if (hidShifa.Value == "" || hidShifa.Value == "2") { bargain.Departure = txtShifaAirports.Code; bargain.Arrival = txtZhongzhuanAirports.AirportsCode.Join("/"); } else { bargain.Departure = txtZhongzhuanAirports.AirportsCode.Join("/"); bargain.Arrival = txtShifaAirports.Code; } bargain.VoyageType = VoyageType.RoundTrip; bargain.TravelDays = short.Parse(txtChuxing.Text == "" ? "0" : txtChuxing.Text); bargain.Price = selPrice.SelectedIndex == 0 ? decimal.Parse(txtPrice.Text == "" ? "-1" : txtPrice.Text) : -1; } else if (titlePolicy.InnerText.Trim() == "中转联程") { bargain.Departure = txtDepartureAirports.AirportsCode.Join("/"); bargain.Transit = txtArrivalAirports.AirportsCode.Join("/"); bargain.Arrival = txtZhongzhuanAirports.AirportsCode.Join("/"); bargain.VoyageType = VoyageType.TransitWay; bargain.TravelDays = 0; bargain.Price = -1; bargain.PriceType = PriceType.Commission; } if (bargain.Departure.Trim() == "") { RegisterScript("alert('出发地不能为空,请选择至少一个城市作为出发地!');"); return(false); } if (bargain.VoyageType == VoyageType.TransitWay && bargain.Transit.Trim() == "") { RegisterScript("alert('中转地不能为空,请选择至少一个城市作为出发地!');"); return(false); } if (bargain.Arrival.Trim() == "") { RegisterScript("alert('到达地不能为空,请选择至少一个城市作为出发地!');"); return(false); } PolicyManageService.UpdateBargainPolicy(bargain, this.CurrentUser.UserName); } if (type == "Copy") { var bargainInfo = new BargainPolicyReleaseInfo { BasicInfo = new BargainPolicyBasicInfo { OfficeCode = dropOffice.SelectedItem == null ? "" : hidOfficeNo.Value, ImpowerOffice = dropOffice.SelectedItem == null ? false : Convert.ToBoolean(dropOffice.SelectedValue), IsInternal = neibuTh.Visible, IsPeer = tong.Visible, CustomCode = ddlCustomCode.Visible ? ddlCustomCode.SelectedValue.Trim() : lblCustomerCode.Text, Airline = ddlAirline.SelectedValue, Arrival = txtArrivalAirports.AirportsCode.Join("/"), Departure = txtDepartureAirports.AirportsCode.Join("/"), //DepartureDatesFilter = "", Transit = "", //DepartureDatesFilterType = DateMode.Date, DepartureFlightsFilter = DerpartrueFilghtType == LimitType.None ? "" : txtDepartrueFilght.Text, DepartureFlightsFilterType = DerpartrueFilghtType, ReturnFlightsFilter = RetrurnFilghtType == LimitType.None ? "" : RetrurnFilght, ReturnFlightsFilterType = RetrurnFilghtType, Remark = txtRemark.Text.Replace("\r", "").Replace("\n", ""), ExceptAirways = txtOutWithFilght.Text, DrawerCondition = txtDrawerCondition.Text.Replace("\r", "").Replace("\n", ""), ChangeRegulation = selChangeRegulation.Text, EndorseRegulation = selEndorseRegulation.Text, RefundRegulation = selRefundRegulation.Text, InvalidRegulation = selInvalidRegulation.Text, VoyageType = voyage, Owner = this.CurrentUser.Owner } }; if (titlePolicy.InnerText.Trim() == "单程") { bargainInfo.BasicInfo.Departure = txtDepartureAirports.AirportsCode.Join("/"); bargainInfo.BasicInfo.Arrival = txtArrivalAirports.AirportsCode.Join("/"); bargainInfo.BasicInfo.VoyageType = VoyageType.OneWay; } else if (titlePolicy.InnerText.Trim() == "往返") { if (hidShifa.Value == "" || hidShifa.Value == "2") { bargainInfo.BasicInfo.Departure = txtShifaAirports.Code; bargainInfo.BasicInfo.Arrival = txtZhongzhuanAirports.AirportsCode.Join("/"); } else { bargainInfo.BasicInfo.Departure = txtZhongzhuanAirports.AirportsCode.Join("/"); bargainInfo.BasicInfo.Arrival = txtShifaAirports.Code; } bargainInfo.BasicInfo.VoyageType = VoyageType.RoundTrip; } else if (titlePolicy.InnerText.Trim() == "中转联程") { bargainInfo.BasicInfo.Departure = txtDepartureAirports.AirportsCode.Join("/"); bargainInfo.BasicInfo.Transit = txtArrivalAirports.AirportsCode.Join("/"); bargainInfo.BasicInfo.Arrival = txtZhongzhuanAirports.AirportsCode.Join("/"); bargainInfo.BasicInfo.VoyageType = VoyageType.TransitWay; } var list = new List <BargainPolicyRebateInfo> { new BargainPolicyRebateInfo { BeforehandDays = txtTiQianDays.Text == "" ? (short)0 : short.Parse(txtTiQianDays.Text), TravelDays = txtChuxing.Text == "" ? (short)0 : short.Parse(txtChuxing.Text), AutoAudit = chkAuto.Checked, ChangePNR = chkChangePNR.Checked, DepartureDateEnd = DateTime.Parse(txtDepartrueEnd.Text), DepartureDateStart = DateTime.Parse(txtDepartrueStart.Text), StartPrintDate = DateTime.Parse(txtProvideDate.Text), SubordinateCommission = decimal.Parse(txtSubordinateCommission.Text), ProfessionCommission = tong.Visible ? decimal.Parse(txtProfessionCommission.Text):-1M, InternalCommission = neibuTh.Visible ? decimal.Parse(txtInternalCommission.Text): -1M, TicketType = chkTicket.Text == "B2B" ? TicketType.B2B : TicketType.BSP, Berths = hidBunks.Value, DepartureDateFilter = txtPaiChu.Text, DepartureWeekFilter = weekStr, MultiSuitReduce = chkddlc.Checked, PrintBeforeTwoHours = chkPrintBeforeTwoHours.Checked, MostBeforehandDays = txtMostTiQianDays.Text == "" ? (short)-1 : short.Parse(txtMostTiQianDays.Text), PriceType = discount.Visible && selPrice.Visible ? (PriceType)(int.Parse(selPrice.Value)) : PriceType.Price, Price = discount.Visible ? (selPrice.SelectedIndex == 0 ? decimal.Parse(txtPrice.Text == "" ? "-1" : txtPrice.Text) : (selPrice.SelectedIndex == 1 ? decimal.Parse(txtDiscount.Text == "" ? "-100" : txtDiscount.Text): -1)) : -1 } }; bargainInfo.Rebates = list; if (titlePolicy.InnerText.Trim() == "中转联程") { bargainInfo.Rebates[0].TravelDays = 0; bargainInfo.Rebates[0].Price = -1; bargainInfo.Rebates[0].PriceType = PriceType.Commission; } if (bargainInfo.BasicInfo.Departure.Trim() == "") { RegisterScript("alert('出发地不能为空,请选择至少一个城市作为出发地!');"); return(false); } if (bargainInfo.BasicInfo.VoyageType == VoyageType.TransitWay && bargainInfo.BasicInfo.Transit.Trim() == "") { RegisterScript("alert('中转地不能为空,请选择至少一个城市作为出发地!');"); return(false); } if (bargainInfo.BasicInfo.Arrival.Trim() == "") { RegisterScript("alert('到达地不能为空,请选择至少一个城市作为出发地!');"); return(false); } PolicyManageService.ReleaseBargainPolicies(bargainInfo, this.CurrentUser.UserName); } if (Request.QueryString["Check"] == "view") { RegisterScript( type == "Update" ? "alert('修改成功');window.location.href='./low_price_policy_view.aspx'" : "alert('复制成功');window.location.href='./low_price_policy_view.aspx'", true); } else { RegisterScript( type == "Update" ? "alert('修改成功');window.location.href='./low_price_policy_manage.aspx'" : "alert('复制成功');window.location.href='./low_price_policy_manage.aspx'", true); } } catch (Exception ex) { ShowExceptionMessage(ex, type == "Update" ? "修改特价政策" : "复制特价政策"); } return(true); }
private bool GetTeamValue(string type) { VoyageType voyage = VoyageType.OneWay; if (titlePolicy.InnerText == "单程") { voyage = VoyageType.OneWay; } else if (titlePolicy.InnerText == "往返") { voyage = VoyageType.RoundTrip; } else if (titlePolicy.InnerText == "单程·往返") { voyage = VoyageType.OneWayOrRound; } else if (titlePolicy.InnerText == "中转联程") { voyage = VoyageType.TransitWay; } 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); } var teams = PolicyManageService.GetTeamPolicy(Guid.Parse(Request.QueryString["Id"])); try { if (type == "Update") { var team = new TeamPolicy { Airline = lblAirline.Text, Arrival = txtArrivalAirports.AirportsCode.ToList().Join("/"), OfficeCode = hidOfficeNo.Value, AutoAudit = chkAuto.Checked, ChangePNR = chkChangePNR.Checked, IsInternal = neibuTh.Visible, IsPeer = tonghang.Visible, CustomCode = ddlCustomCode.Visible ? ddlCustomCode.SelectedValue.Trim() : lblCustomerCode.Text, Departure = txtDepartureAirports.AirportsCode.ToList().Join("/"), Transit = "", DepartureDateEnd = DateTime.Parse(txtDepartrueEnd.Text), DepartureDateStart = DateTime.Parse(txtDepartrueStart.Text), DepartureFlightsFilter = derpartrueFilghtType == LimitType.None ? "" : txtDepartrueFilght.Text, DepartureFlightsFilterType = derpartrueFilghtType, Remark = txtRemark.Text.Replace("\r", "").Replace("\n", ""), DrawerCondition = txtDrawerCondition.Text.Replace("\r", "").Replace("\n", ""), ReturnFlightsFilter = returnFilghtType == LimitType.None ? "" : txtReturnFilght.Text, ReturnFlightsFilterType = returnFilghtType, SuitReduce = chkRound.Checked, MultiSuitReduce = chkddlc.Checked, StartPrintDate = DateTime.Parse(txtProvideDate.Text), DepartureDateFilter = txtPaiChu.Text, DepartureWeekFilter = weekStr, SubordinateCommission = decimal.Parse(txtSubordinateCommission.Text) / 100, ProfessionCommission = tonghang.Visible ? decimal.Parse(txtProfessionCommission.Text) / 100 : -1M, InternalCommission = neibuTh.Visible ? decimal.Parse(txtInternalCommission.Text) / 100 : -1M, ExceptAirways = txtExceptAirways.Text, TicketType = chkTicket.Text == "B2B" ? TicketType.B2B : TicketType.BSP, Berths = hidBunks.Value, VoyageType = voyage, ImpowerOffice = Convert.ToBoolean(dropOffice.SelectedValue), Audited = teams.Audited, AuditTime = teams.AuditTime, AutoPrint = teams.AutoPrint, CreateTime = teams.CreateTime, Creator = teams.Creator, Freezed = teams.Freezed, Owner = teams.Owner, Suspended = teams.Suspended, Id = Guid.Parse(Request.QueryString["Id"]), AppointBerths = zhiding.Checked, PrintBeforeTwoHours = chkPrintBeforeTwoHours.Checked }; if (zhongzhuanTh.Visible) { team.Arrival = txtZhongzhuanAirports.AirportsCode.Join("/"); team.Transit = txtArrivalAirports.AirportsCode.Join("/"); } if (team.Departure.Trim() == "") { RegisterScript("alert('出发地不能为空,请选择至少一个城市作为出发地!');"); return(false); } if (team.VoyageType == VoyageType.TransitWay && team.Transit.Trim() == "") { RegisterScript("alert('中转地不能为空,请选择至少一个城市作为出发地!');"); return(false); } if (team.Arrival.Trim() == "") { RegisterScript("alert('到达地不能为空,请选择至少一个城市作为出发地!');"); return(false); } PolicyManageService.UpdateTeamPolicy(team, this.CurrentUser.UserName); } if (type == "Copy") { var teamInfo = new TeamPolicyReleaseInfo { BasicInfo = new TeamPolicyBasicInfo { CustomCode = ddlCustomCode.Visible ? ddlCustomCode.SelectedValue.Trim() : lblCustomerCode.Text, IsInternal = neibuTh.Visible, IsPeer = tonghang.Visible, Airline = ddlAirline.SelectedValue, Arrival = txtArrivalAirports.AirportsCode.ToList().Join("/"), Transit = "", Departure = txtDepartureAirports.AirportsCode.ToList().Join("/"), DepartureFlightsFilter = derpartrueFilghtType == LimitType.None ? "" : txtDepartrueFilght.Text, DepartureFlightsFilterType = derpartrueFilghtType, Remark = txtRemark.Text.Replace("\r", "").Replace("\n", ""), DrawerCondition = txtDrawerCondition.Text.Replace("\r", "").Replace("\n", ""), ReturnFlightsFilter = returnFilghtType == LimitType.None ? "" : txtReturnFilght.Text, ReturnFlightsFilterType = returnFilghtType, ExceptAirways = txtExceptAirways.Text, VoyageType = voyage, OfficeCode = hidOfficeNo.Value, ImpowerOffice = Convert.ToBoolean(dropOffice.SelectedValue), Owner = this.CurrentUser.Owner } }; if (zhongzhuanTh.Visible) { teamInfo.BasicInfo.Arrival = txtZhongzhuanAirports.AirportsCode.Join("/"); teamInfo.BasicInfo.Transit = txtArrivalAirports.AirportsCode.Join("/"); } var list = new List <TeamPolicyRebateInfo> { new TeamPolicyRebateInfo { DepartureDateFilter = txtPaiChu.Text, DepartureWeekFilter = weekStr, AutoAudit = chkAuto.Checked, ChangePNR = chkChangePNR.Checked, DepartureDateEnd = DateTime.Parse(txtDepartrueEnd.Text), DepartureDateStart = DateTime.Parse(txtDepartrueStart.Text), SuitReduce = chkRound.Checked, StartPrintDate = DateTime.Parse(txtProvideDate.Text), SubordinateCommission = decimal.Parse(txtSubordinateCommission.Text), ProfessionCommission = tonghang.Visible ? decimal.Parse(txtProfessionCommission.Text): -1M, InternalCommission = neibuTh.Visible ? decimal.Parse(txtInternalCommission.Text): -1M, TicketType = chkTicket.Text == "B2B" ? TicketType.B2B : TicketType.BSP, Berths = hidBunks.Value, MultiSuitReduce = chkddlc.Checked, AppointBerths = zhiding.Checked, PrintBeforeTwoHours = chkPrintBeforeTwoHours.Checked } }; teamInfo.Rebates = list; if (teamInfo.BasicInfo.Departure.Trim() == "") { RegisterScript("alert('出发地不能为空,请选择至少一个城市作为出发地!');"); return(false); } if (teamInfo.BasicInfo.VoyageType == VoyageType.TransitWay && teamInfo.BasicInfo.Transit.Trim() == "") { RegisterScript("alert('中转地不能为空,请选择至少一个城市作为出发地!');"); return(false); } if (teamInfo.BasicInfo.Arrival.Trim() == "") { RegisterScript("alert('到达地不能为空,请选择至少一个城市作为出发地!');"); return(false); } PolicyManageService.ReleaseTeamPolicies(teamInfo, this.CurrentUser.UserName); } if (Request.QueryString["Check"] == "view") { RegisterScript( type == "Update" ? "alert('修改成功');window.location.href='./team_policy_view.aspx'" : "alert('复制成功');window.location.href='./team_policy_view.aspx'", true); } else { RegisterScript( type == "Update" ? "alert('修改成功');window.location.href='./team_policy_manage.aspx'" : "alert('复制成功');window.location.href='./team_policy_manage.aspx'", true); } } catch (Exception ex) { ShowExceptionMessage(ex, type == "Update" ? "修改团队政策" : "复制团队政策"); } return(true); }
public IEnumerable <PolicyInfoBase> QueryPolicies(string departure, DateTime flightStartDate, DateTime flightEndDate, VoyageType voyageType, PolicyType policyType) { return(PolicyManageService.QueryPolicies(departure, flightStartDate, flightEndDate, voyageType, policyType, null)); }
/// <summary> /// 根据行程条件、行程类型及政策类型,获取相应的政策; /// </summary> /// <param name="airline">航空公司</param> /// <param name="voyages">行程条件</param> /// <param name="voyageType">行程类型</param> /// <param name="policyType">政策类型</param> /// <returns></returns> public IEnumerable <PolicyInfoBase> QueryPolicies(string airline, DataTable voyages, VoyageType voyageType, PolicyType policyType) { if (airline == null) { throw new ArgumentNullException("airline"); } if (voyages == null || voyages.Columns.Count == 0) { throw new ArgumentNullException("voyages"); } return(PolicyManageService.QueryPolicies(airline, voyages, voyageType, policyType)); }
private bool GetNormalValue(string type) { VoyageType voyage = VoyageType.Notch; LimitType derpartrueFilghtType = LimitType.None; if (radYiXia.Checked) { derpartrueFilghtType = LimitType.Include; } if (radBuXian.Checked) { derpartrueFilghtType = LimitType.None; } if (radBuYiXia.Checked) { derpartrueFilghtType = 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); } var notchs = PolicyManageService.GetNotchPolicy(Guid.Parse(Request.QueryString["Id"])); try { if (type == "Update") { var notch = new NotchPolicy { CustomCode = ddlCustomCode.Visible ? ddlCustomCode.SelectedValue.Trim() : lblCustomerCode.Text, Airline = lblAirline.Text, OfficeCode = hidOfficeNo.Value, //Arrival = txtArrivalAirports.AirportsCode.ToList().Join("/"), AutoAudit = chkAuto.Checked, ChangePNR = chkChangePNR.Checked, IsInternal = neibuTh.Visible, IsPeer = tonghang.Visible, //Departure = txtDepartureAirports.AirportsCode.ToList().Join("/"), //Transit = "", DepartureDateEnd = DateTime.Parse(txtDepartrueEnd.Text), //DepartureDatesFilter = "", DepartureDateStart = DateTime.Parse(txtDepartrueStart.Text), //DepartureDatesFilterType = DateMode.Date, DepartureFlightsFilter = derpartrueFilghtType == LimitType.None ? "" : txtDepartrueFilght.Text, DepartureFlightsFilterType = derpartrueFilghtType, //ReturnDateStart = normals.ReturnDateStart, //ReturnDateEnd = normals.ReturnDateEnd, Remark = txtRemark.Text.Replace("\r", "").Replace("\n", ""), DrawerCondition = txtDrawerCondition.Text.Replace("\r", "").Replace("\n", ""), //ReturnDatesFilter = "", //ReturnFlightsFilter = returnFilghtType == LimitType.None ? "" : txtReturnFilght.Text, //ReturnFlightsFilterType = returnFilghtType, //SuitReduce = chkRound.Checked, StartPrintDate = DateTime.Parse(txtProvideDate.Text), DepartureDateFilter = txtPaiChu.Text, DepartureWeekFilter = weekStr, SubordinateCommission = decimal.Parse(txtSubordinateCommission.Text) / 100, ProfessionCommission = decimal.Parse(txtProfessionCommission.Text) / 100, InternalCommission = decimal.Parse(txtInternalCommission.Text) / 100, //MultiSuitReduce = chkddlc.Checked, ////Vip = 0, //ExceptAirways = txtExceptAirways.Text, //TravelDays = 0, TicketType = chkTicket.Text == "B2B" ? TicketType.B2B : TicketType.BSP, Berths = hidBunks.Value, VoyageType = voyage, //ReturnDatesFilterType = DateMode.Date, ImpowerOffice = Convert.ToBoolean(dropOffice.SelectedValue), Audited = notchs.Audited, AuditTime = notchs.AuditTime, //AutoPrint = normals.AutoPrint, CreateTime = notchs.CreateTime, Creator = notchs.Creator, Freezed = notchs.Freezed, Owner = notchs.Owner, Suspended = notchs.Suspended, PrintBeforeTwoHours = chkPrintBeforeTwoHours.Checked, Id = Guid.Parse(Request.QueryString["Id"]), AbbreviateName = CurrentCompany.AbbreviateName }; //if (zhongzhuanTh.Visible) //{ // normal.Transit = txtArrivalAirports.AirportsCode.Join("/"); // normal.Arrival = txtZhongzhuanAirports.AirportsCode.Join("/"); //} //if (normal.Departure.Trim() == "") //{ // RegisterScript("alert('出发地不能为空,请选择至少一个城市作为出发地!');"); // return false; //} //if (normal.VoyageType == VoyageType.TransitWay && normal.Transit.Trim() == "") //{ // RegisterScript("alert('中转地不能为空,请选择至少一个城市作为出发地!');"); // return false; //} //if (normal.Arrival.Trim() == "") //{ // RegisterScript("alert('到达地不能为空,请选择至少一个城市作为出发地!');"); // return false; //} SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); var val = inputTxtvalue.Value; notch.DepartureArrival = new List <Data.DataMapping.NotchPolicyDepartureArrival>(); if (val.Trim() != "") { var values = val.Split(','); for (var i = 0; i < values.Count(); i++) { var ite = values[i].Split('|'); notch.DepartureArrival.Add(new Data.DataMapping.NotchPolicyDepartureArrival { IsAllowable = ite[0] == "1", Departure = ite[1], Arrival = ite[2] }); } } if (!notch.DepartureArrival.Any()) { notch.DepartureArrival.Add(new Data.DataMapping.NotchPolicyDepartureArrival { IsAllowable = true, Departure = setting.Departure, Arrival = setting.Departure }); } PolicyManageService.UpdateNotchPolicy(notch, this.CurrentUser.UserName); } if (type == "Copy") { var notchInfo = new NotchPolicyReleaseInfo { CustomCode = ddlCustomCode.Visible ? ddlCustomCode.SelectedValue.Trim() : lblCustomerCode.Text, //IsInternal = neibuTh.Visible, //IsPeer = tonghang.Visible, Airline = ddlAirline.SelectedValue, //Arrival = txtArrivalAirports.AirportsCode.ToList().Join("/"), //Transit = "", //Departure = txtDepartureAirports.AirportsCode.ToList().Join("/"), //DepartureDatesFilter = "", //DepartureDatesFilterType = DateMode.Date, DepartureFlightsFilter = derpartrueFilghtType == LimitType.None ? "" : txtDepartrueFilght.Text, DepartureFlightsFilterType = derpartrueFilghtType, Remark = txtRemark.Text.Replace("\r", "").Replace("\n", ""), DrawerCondition = txtDrawerCondition.Text.Replace("\r", "").Replace("\n", ""), //ReturnDatesFilter = "", //ReturnFlightsFilter = returnFilghtType == LimitType.None ? "" : txtReturnFilght.Text, //ReturnFlightsFilterType = returnFilghtType, //ExceptAirways = txtExceptAirways.Text, //TravelDays = 0, VoyageType = voyage, //ReturnDatesFilterType = DateMode.Date, OfficeCode = hidOfficeNo.Value, ImpowerOffice = Convert.ToBoolean(dropOffice.SelectedValue), Owner = this.CurrentUser.Owner }; //if (zhongzhuanTh.Visible) //{ // normalInfo.BasicInfo.Transit = txtArrivalAirports.AirportsCode.Join("/"); // normalInfo.BasicInfo.Arrival = txtZhongzhuanAirports.AirportsCode.Join("/"); //} var list = new List <NotchPolicyRebateInfo> { new NotchPolicyRebateInfo { DepartureDateFilter = txtPaiChu.Text, DepartureWeekFilter = weekStr, AutoAudit = chkAuto.Checked, ChangePNR = chkChangePNR.Checked, DepartureDateEnd = DateTime.Parse(txtDepartrueEnd.Text), DepartureDateStart = DateTime.Parse(txtDepartrueStart.Text), //ReturnDateStart = normals.ReturnDateStart, //ReturnDateEnd = normals.ReturnDateEnd, //SuitReduce = chkRound.Checked, StartPrintDate = DateTime.Parse(txtProvideDate.Text), SubordinateCommission = decimal.Parse(txtSubordinateCommission.Text), ProfessionCommission = decimal.Parse(txtProfessionCommission.Text), InternalCommission = decimal.Parse(txtInternalCommission.Text), //MultiSuitReduce = chkddlc.Checked, //Vip = 0, TicketType = chkTicket.Text == "B2B" ? TicketType.B2B : TicketType.BSP, Berths = hidBunks.Value, PrintBeforeTwoHours = chkPrintBeforeTwoHours.Checked } }; notchInfo.RebateInfo = list; //if (normalInfo.BasicInfo.Departure.Trim() == "") //{ // RegisterScript("alert('出发地不能为空,请选择至少一个城市作为出发地!');"); // return false; //} //if (normalInfo.BasicInfo.VoyageType == VoyageType.TransitWay && normalInfo.BasicInfo.Transit.Trim() == "") //{ // RegisterScript("alert('中转地不能为空,请选择至少一个城市作为出发地!');"); // return false; //} //if (normalInfo.BasicInfo.Arrival.Trim() == "") //{ // RegisterScript("alert('到达地不能为空,请选择至少一个城市作为出发地!');"); // return false; //} var val = inputTxtvalue.Value; notchInfo.DepartureArrival = new List <DataTransferObject.Policy.NotchPolicyDepartureArrival>(); if (val.Trim() != "") { var values = val.Split(','); for (var i = 0; i < values.Count(); i++) { var ite = values[i].Split('|'); notchInfo.DepartureArrival.Add(new DataTransferObject.Policy.NotchPolicyDepartureArrival { IsAllowable = ite[0] == "1", Departure = ite[1], Arrival = ite[2] }); } } PolicyManageService.ReleaseNotchPolicies(notchInfo, this.CurrentUser.UserName); } if (Request.QueryString["Check"] == "view") { RegisterScript( type == "Update" ? "alert('修改成功');window.location.href='./notch_policy_view.aspx'" : "alert('复制成功');window.location.href='./notch_policy_view.aspx'", true); } else { RegisterScript( type == "Update" ? "alert('修改成功');window.location.href='./notch_policy_manage.aspx'" : "alert('复制成功');window.location.href='./notch_policy_manage.aspx'", true); } } catch (Exception ex) { ShowExceptionMessage(ex, type == "Update" ? "修改缺口政策" : "复制缺口政策"); } return(true); }
/// <summary> /// 根据行程,过滤政策,取得的是政策列表中与行程相符的政策; /// </summary> /// <param name="policies">政策列表</param> /// <param name="voyageType">行程类型</param> /// <returns>过滤后的政策列表</returns> internal static IEnumerable <PolicyInfoBase> FilterByVoyageType(this IEnumerable <PolicyInfoBase> policies, VoyageType voyageType) { switch (voyageType) { case VoyageType.OneWay: case VoyageType.RoundTrip: return(policies.Where(p => p.VoyageType == voyageType || p.VoyageType == VoyageType.OneWayOrRound)); case VoyageType.OneWayOrRound: case VoyageType.TransitWay: case VoyageType.Notch: return(policies.Where(p => p.VoyageType == voyageType)); default: return(empty); } }