private void InsertSettingPolicy(SettingPolicy setPolicy) //TODO: Если вызов контролируется и реализация не изменится, то можно убрать подключение и оставить только запрос { try { var query = $@"INSERT INTO [dbo].[setting_policy] ([policy_id] ,[type_control] ,[create] ,[edit] ,[delete] ,[send] ,[view] ,[stop]) VALUES({setPolicy.Policy_id}, {setPolicy.Type_control} , {(setPolicy.Create ? 1 : 0)}, {(setPolicy.Edit ? 1 : 0)}, {(setPolicy.Delete ? 1 : 0)} , {(setPolicy.Send ? 1 : 0)}, {(setPolicy.View ? 1 : 0)}, {(setPolicy.Stop ? 1 : 0)})"; Connection.Open(); Connection.Query(query); Connection.Close(); Console.WriteLine($" Succsesful PolicyRepository::InsertSettingPolicy::Query: {query}"); //log } catch (Exception ex) { Connection.Close(); Console.WriteLine($" Invalide PolicyRepository::InsertSettingPolicy::Query:"); //log Console.WriteLine(ex.Message); } }
void initData() { //var employees = EmployeeService.QueryEmployees(CurrentCompany.CompanyId); //this.ddlOperator.DataTextField = "UserName"; //this.ddlOperator.DataValueField = "UserName"; //this.ddlOperator.DataSource = employees; //this.ddlOperator.DataBind(); //this.ddlOperator.Items.Insert(0, new ListItem { Value = "", Text = "-请选择-" }); SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!请联系平台。');window.location.href='/TicketDefault.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!请联系平台。');window.location.href='/TicketDefault.aspx';", true); return; } //航空公司 BindAriline(setting); //出发地/到达地 BindCity(setting); this.ddlOffice.DataSource = CompanyService.QueryOfficeNumbers(this.CurrentCompany.CompanyId).Select(o => o.Number); this.ddlOffice.DataBind(); this.ddlOffice.Items.Insert(0, new ListItem { Value = "", Text = "-请选择-" }); }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); if (!IsPostBack) { this.txtStartTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); //this.txtEndTime.Text = DateTime.Today.AddDays(7).ToString("yyyy-MM-dd"); SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); if (setting == null) { ClientScript.RegisterClientScriptBlock(typeof(Page), "", "alert('还未有任何政策设置信息,不能访问本页面!请联系平台。');window.location.href='/Index.aspx';", true); return; } if (setting.Airlines == "") { ClientScript.RegisterClientScriptBlock(typeof(Page), "", "alert('还没有设置航空公司,请先设置航空公司!请联系平台。');window.location.href='/Index.aspx';", true); return; } //航空公司 BindAriline(setting); //出发地/到达地 BindCity(setting); bool vis = CompanyService.GetCompanyParameter(this.CurrentCompany.CompanyId).CanReleaseVip; } this.pager.CurrentPageChanged += new UserControl.CurrentPageChangedEventHandler(pager_CurrentPageChanged); }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); if (!IsPostBack) { this.txtStartTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); //this.txtEndTime.Text = DateTime.Today.AddDays(7).ToString("yyyy-MM-dd"); SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!请联系平台。');window.location.href='/Index.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!请联系平台。');window.location.href='/Index.aspx';", true); return; } BindAriline(setting); BindCity(setting); } this.pager.CurrentPageChanged += pager_CurrentPageChanged; }
void initData() { //var employees = EmployeeService.QueryEmployees(CurrentCompany.CompanyId); //this.ddlOperator.DataTextField = "UserName"; //this.ddlOperator.DataValueField = "UserName"; //this.ddlOperator.DataSource = employees; //this.ddlOperator.DataBind(); //this.ddlOperator.Items.Insert(0, new ListItem { Value = "", Text = "-请选择-" }); SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!请联系平台。');window.location.href='/Index.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!请联系平台。');window.location.href='/Index.aspx';", true); return; } //特殊票类型 var companyParameter = CompanyService.GetCompanyParameter(this.CurrentCompany.CompanyId); if (companyParameter.Singleness) { this.ddlSpecialType.Items.Add(new ListItem("单程控位产品", ((int)SpecialProductType.Singleness).ToString())); } if (companyParameter.Disperse) { this.ddlSpecialType.Items.Add(new ListItem("散冲团产品", ((int)SpecialProductType.Disperse).ToString())); } if (companyParameter.CostFree) { this.ddlSpecialType.Items.Add(new ListItem("免票产品", ((int)SpecialProductType.CostFree).ToString())); } if (companyParameter.Bloc) { this.ddlSpecialType.Items.Add(new ListItem("集团票产品", ((int)SpecialProductType.Bloc).ToString())); } if (companyParameter.Business) { this.ddlSpecialType.Items.Add(new ListItem("商旅卡产品", ((int)SpecialProductType.Business).ToString())); } if (companyParameter.OtherSpecial) { this.ddlSpecialType.Items.Add(new ListItem("其他特殊产品", ((int)SpecialProductType.OtherSpecial).ToString())); } if (companyParameter.LowToHigh) { this.ddlSpecialType.Items.Add(new ListItem("低打高返特殊产品", ((int)SpecialProductType.LowToHigh).ToString())); } this.ddlSpecialType.Items.Insert(0, new ListItem("-请选择-", "")); BindAriline(setting); BindCity(setting); }
private List <string> GetAirport(SettingPolicy settingPolicy) { List <string> list = new List <string>(); if (settingPolicy != null) { string[] airports = settingPolicy.Departure.Split('/'); for (int i = 0; i < airports.Length; i++) { list.Add(airports[i]); } } return(list); }
private void BindAriline(SettingPolicy settingPolicy) { IEnumerable <string> airlines = settingPolicy.Airlines.Split('/'); var allAirlines = FoundationService.Airlines; foreach (Airline item in allAirlines) { if (item.Valid && airlines.Contains(item.Code.Value)) { ListItem listItem = new ListItem(item.Code.Value + "-" + item.ShortName, item.Code.Value); this.ddlAirline.Items.Add(listItem); } } }
private void BindCity(SettingPolicy settingPolicy) { var result = new List <Airport>(); var airports = GetAirport(settingPolicy); var allAirports = FoundationService.Airports; foreach (Airport item in allAirports) { if (item.Valid && airports.Contains(item.Code.Value)) { result.Add(item); } } this.txtDeparture.InitData(result); }
/// <summary> /// 得到所有的航空公司 /// </summary> /// <returns></returns> public object QueryAirlines() { SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); if (setting.Airlines == "") { throw new Exception("还没有设置航空公司,请先设置航空公司!"); } string[] str_ids = setting.Airlines.Split('/'); return(from item in ChinaPay.B3B.Service.FoundationService.Airlines where item.Valid && str_ids.Contains(item.Code.Value) select new { Code = item.Code, Name = item.Code + "-" + item.ShortName }); }
void initData() { var employees = Service.Organization.CompanyService.GetEmployees(CurrentCompany.CompanyId); this.ddlOperator.DataTextField = "UserName"; this.ddlOperator.DataValueField = "UserName"; this.ddlOperator.DataSource = employees; this.ddlOperator.DataBind(); this.ddlOperator.Items.Insert(0, new ListItem { Value = "", Text = "-请选择-" }); SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!请联系平台。');window.location.href='/Default.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!请联系平台。');window.location.href='/Default.aspx';", true); return; } string[] str_ids = setting.Airlines.Split('/'); var airline = from item in ChinaPay.B3B.Service.FoundationService.Airlines where item.Valid && str_ids.Contains(item.Code.Value) select new { Code = item.Code, Name = item.Code + "-" + item.ShortName }; this.ddlAirline.DataSource = airline; this.ddlAirline.DataTextField = "Name"; this.ddlAirline.DataValueField = "Code"; this.ddlAirline.DataBind(); this.ddlAirline.Items.Insert(0, new ListItem { Value = "", Text = "-请选择-" }); this.txtDeparture.InitData(ChinaPay.B3B.Service.FoundationService.Airports.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); //this.txtArrival.InitData(ChinaPay.B3B.Service.FoundationService.Airports.Where(item => setting.Airlines.Split('/').Contains(item.Code.Value))); }
private void UpdateSettingPolicy(SettingPolicy setPolicy) //TODO: Если вызов контролируется и реализация не изменится, то можно убрать подключение и оставить только запрос { try { var query = $@"UPDATE [dbo].[setting_policy] SET [create] = {(setPolicy.Create ? 1 : 0)}, [edit] = {(setPolicy.Edit ? 1 : 0)}, [delete] = {(setPolicy.Delete ? 1 : 0)}, [send] = {(setPolicy.Send ? 1 : 0)}, [view] = {(setPolicy.View ? 1 : 0)}, [stop] = {(setPolicy.Stop ? 1 : 0)} WHERE [policy_id] = {setPolicy.Policy_id} AND [type_control] = {setPolicy.Type_control}"; Connection.Open(); Connection.Query(query); Connection.Close(); Console.WriteLine($" Succsesful PolicyRepository::UpdateSettingPolicy::Query: {query}"); //log } catch (Exception ex) { Connection.Close(); Console.WriteLine($" Invalide PolicyRepository::UpdateSettingPolicy::Query:"); //log Console.WriteLine(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.txtStartTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); this.txtEndTime.Text = DateTime.Today.AddDays(7).ToString("yyyy-MM-dd"); SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!请联系平台。');window.location.href='/Index.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!请联系平台。');window.location.href='/Index.aspx';", true); return; } string[] str_ids = setting.Airlines.Split('/'); var airline = from item in ChinaPay.B3B.Service.FoundationService.Airlines where item.Valid && str_ids.Contains(item.Code.Value) select new { Code = item.Code, Name = item.Code + "-" + item.ShortName }; this.ddlAirline.DataSource = airline; this.ddlAirline.DataTextField = "Name"; this.ddlAirline.DataValueField = "Code"; this.ddlAirline.DataBind(); this.txtDeparture.InitData(ChinaPay.B3B.Service.FoundationService.Airports.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); } this.pager.PageSize = grv_back.PageSize; this.pager.CurrentPageChanged += new UserControl.CurrentPageChangedEventHandler(pager_CurrentPageChanged); }
public void SetSettingPolicy(SettingPolicy setPolicy) { try { var query = $@"Select COUNT(*) from [dbo].[setting_policy] where [policy_id] = {setPolicy.Policy_id} AND [type_control] = {setPolicy.Type_control}"; Connection.Open(); var exist = Connection.ExecuteScalar <int>(query) != 0; Connection.Close(); //TODO: Если вызываемые методы будут использоваться только тут, то можно закрыть подключение после их выполнения, если убрать его там Console.WriteLine($" Succsesful PolicyRepository::SetSettingPolicy::Query: {query}"); //log if (exist) { UpdateSettingPolicy(setPolicy); } else { InsertSettingPolicy(setPolicy); } } catch (Exception ex) { Connection.Close(); Console.WriteLine($" Invalide PolicyRepository::SetSettingPolicy::Query:"); //log Console.WriteLine(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); if (!IsPostBack) { SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); var company = CompanyService.GetCompanySettingsInfo(CurrentCompany.CompanyId); if (company != null && company.Parameter.CanHaveSubordinate) { neibuTh.Visible = true; neibufanyong.Visible = true; } else { neibuTh.Visible = false; neibufanyong.Visible = false; } cutomeTh.Visible = company != null && company.WorkingSetting != null && company.WorkingSetting.IsImpower; ddlCustomCode.Visible = company != null && company.WorkingSetting != null && company.WorkingSetting.IsImpower; if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!');window.location.href='/Index.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!');window.location.href='/Index.aspx';", true); return; } bool allowBrotherPurchases = false; if (company != null) { allowBrotherPurchases = company.Parameter.AllowBrotherPurchase; } dropOffice.DataSource = CompanyService.QueryOfficeNumbers(this.CurrentCompany.CompanyId); dropOffice.DataTextField = "Number"; dropOffice.DataValueField = "Impower"; dropOffice.DataBind(); ddlCustomCode.DataSource = CompanyService.GetCustomNumberByEmployee(CurrentUser.Id); ddlCustomCode.DataTextField = "Number"; ddlCustomCode.DataValueField = "Number"; ddlCustomCode.DataBind(); tongTh.Visible = allowBrotherPurchases; tong.Visible = allowBrotherPurchases; var queryList = FoundationService.Airports; this.txtDepartureAirports.InitData(true, queryList.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); //this.txtArrivalAirports.InitData(true, queryList.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); //this.txtZhongzhuanAirports.InitData(true, queryList.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); this.txtShifaAirports.InitData(queryList.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); if (Request.QueryString["Id"] != null && Request.QueryString["Type"] != null) { BargainPolicy bargain = PolicyManageService.GetBargainPolicy(Guid.Parse(Request.QueryString["Id"])); if (bargain.VoyageType == VoyageType.OneWay) { selEndorseRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainOneWayEndorseRegulation); selEndorseRegulation.DataTextField = "Name"; selEndorseRegulation.DataValueField = "Name"; selEndorseRegulation.DataBind(); selInvalidRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainOneWayInvalidRegulation); selInvalidRegulation.DataTextField = "Name"; selInvalidRegulation.DataValueField = "Name"; selInvalidRegulation.DataBind(); selRefundRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainOneWayRefundRegulation); selRefundRegulation.DataTextField = "Name"; selRefundRegulation.DataValueField = "Name"; selRefundRegulation.DataBind(); selChangeRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainOneWayChangeRegulation); selChangeRegulation.DataTextField = "Name"; selChangeRegulation.DataValueField = "Name"; selChangeRegulation.DataBind(); } else if (bargain.VoyageType == VoyageType.RoundTrip) { selEndorseRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainRoundTripEndorseRegulation); selEndorseRegulation.DataTextField = "Name"; selEndorseRegulation.DataValueField = "Name"; selEndorseRegulation.DataBind(); selInvalidRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainRoundTripInvalidRegulation); selInvalidRegulation.DataTextField = "Name"; selInvalidRegulation.DataValueField = "Name"; selInvalidRegulation.DataBind(); selRefundRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainRoundTripRefundRegulation); selRefundRegulation.DataTextField = "Name"; selRefundRegulation.DataValueField = "Name"; selRefundRegulation.DataBind(); selChangeRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainRoundTripChangeRegulation); selChangeRegulation.DataTextField = "Name"; selChangeRegulation.DataValueField = "Name"; selChangeRegulation.DataBind(); } else if (bargain.VoyageType == VoyageType.TransitWay) { selEndorseRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainTransitWayEndorseRegulation); selEndorseRegulation.DataTextField = "Name"; selEndorseRegulation.DataValueField = "Name"; selEndorseRegulation.DataBind(); selInvalidRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainTransitWayInvalidRegulation); selInvalidRegulation.DataTextField = "Name"; selInvalidRegulation.DataValueField = "Name"; selInvalidRegulation.DataBind(); selRefundRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainTransitWayRefundRegulation); selRefundRegulation.DataTextField = "Name"; selRefundRegulation.DataValueField = "Name"; selRefundRegulation.DataBind(); selChangeRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainTransitWayChangeRegulation); selChangeRegulation.DataTextField = "Name"; selChangeRegulation.DataValueField = "Name"; selChangeRegulation.DataBind(); } if (Request.QueryString["Type"].Trim() == "Update") { tip.InnerText = "修改特价政策"; chkAuto.Visible = false; btnCopy.Visible = false; btnModify.Visible = true; lblAirline.Visible = true; ddlAirline.Visible = false; } if (Request.QueryString["Type"].Trim() == "Copy") { tip.InnerText = "复制特价政策"; lblAirline.Visible = false; ddlAirline.Visible = true; chkAuto.Visible = true; btnCopy.Visible = true; btnModify.Visible = false; string[] strIds = setting.Airlines.Split('/'); ddlAirline.DataSource = from item in FoundationService.Airlines where item.Valid && strIds.Contains(item.Code.Value) select new { Code = item.Code, Name = item.Code + "-" + item.ShortName }; ddlAirline.DataTextField = "Name"; ddlAirline.DataValueField = "Code"; ddlAirline.DataBind(); } //ddlBunks.DataSource = QueryBunks(Bargain.Airline, Bargain.DepartureDateStart, Bargain.DepartureDateEnd); //ddlBunks.DataBind(); InitDataValue(bargain); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var company = CompanyService.GetCompanySettingsInfo(CurrentCompany.CompanyId); if (company != null && company.Parameter.CanHaveSubordinate) { neibuTh.Visible = true; neibufanyong.Visible = true; } else { neibuTh.Visible = false; neibufanyong.Visible = false; } SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!');window.location.href='/Index.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!');window.location.href='/Index.aspx';", true); return; } this.txtDepartureAirports.InitData(true, ChinaPay.B3B.Service.FoundationService.Airports.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); this.txtArrivalAirports.InitData(true, ChinaPay.B3B.Service.FoundationService.Airports.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); IEnumerable <OfficeNumber> list = null; var empowermentOffice = CompanyService.GetWorkingSetting(this.CurrentCompany.CompanyId) != null && CompanyService.GetWorkingSetting(this.CurrentCompany.CompanyId).IsImpower; if (empowermentOffice) { list = AccountCombineService.GetOfficeNoByEmployee(this.CurrentUser.Id); } else { list = from item in AccountCombineService.GetOfficeNumbers(this.CurrentCompany.CompanyId) select new OfficeNumber { Impower = false, Company = item.Company, Number = item.Number, Enabled = item.Enabled, Id = item.Id }; } if (list != null) { dropOffice.DataSource = list; dropOffice.DataTextField = "Number"; dropOffice.DataValueField = "Impower"; dropOffice.DataBind(); } //selEndorseRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.EndorseRegulation); //selEndorseRegulation.DataTextField = "Name"; //selEndorseRegulation.DataValueField = "Name"; //selEndorseRegulation.DataBind(); //selInvalidRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.InvalidRegulation); //selInvalidRegulation.DataTextField = "Name"; //selInvalidRegulation.DataValueField = "Name"; //selInvalidRegulation.DataBind(); //selRefundRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.RefundRegulation); //selRefundRegulation.DataTextField = "Name"; //selRefundRegulation.DataValueField = "Name"; //selRefundRegulation.DataBind(); //selChangeRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.ChangeRegulation); //selChangeRegulation.DataTextField = "Name"; //selChangeRegulation.DataValueField = "Name"; //selChangeRegulation.DataBind(); if (Request.QueryString["Id"] != null && Request.QueryString["Type"] != null) { RoundTripPolicy roundTrip = PolicyManageService.GetRoundTripPolicy(Guid.Parse(Request.QueryString["Id"])); if (Request.QueryString["Type"].Trim() == "Update") { tip.InnerText = "修改往返政策"; lblAirline.Visible = true; ddlAirline.Visible = false; chkAuto.Visible = false; btnCopy.Visible = false; btnModify.Visible = true; } if (Request.QueryString["Type"].Trim() == "Copy") { tip.InnerText = "复制往返政策"; lblAirline.Visible = false; ddlAirline.Visible = true; chkAuto.Visible = true; btnCopy.Visible = true; btnModify.Visible = false; string[] strIds = setting.Airlines.Split('/'); ddlAirline.DataSource = from item in ChinaPay.B3B.Service.FoundationService.Airlines where item.Valid && strIds.Contains(item.Code.Value) select new { item.Code, Name = item.Code + "-" + item.ShortName }; ddlAirline.DataTextField = "Name"; ddlAirline.DataValueField = "Code"; ddlAirline.DataBind(); } InitDataValue(roundTrip); } } }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); if (!IsPostBack) { SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); var company = CompanyService.GetCompanySettingsInfo(CurrentCompany.CompanyId); if (company != null && company.Parameter.CanHaveSubordinate) { neibuTh.Visible = true; neibufanyong.Visible = true; } else { neibuTh.Visible = false; neibufanyong.Visible = false; } cutomeTh.Visible = company != null && company.WorkingSetting != null && company.WorkingSetting.IsImpower; ddlCustomCode.Visible = company != null && company.WorkingSetting != null && company.WorkingSetting.IsImpower; if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!');window.location.href='/Index.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!');window.location.href='/Index.aspx';", true); return; } this.txtDepartureAirports.InitData(true, ChinaPay.B3B.Service.FoundationService.Airports.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); //this.txtArrivalAirports.InitData(true, FoundationService.Airports.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); bool allowBrotherPurchases = false; if (company != null) { allowBrotherPurchases = company.Parameter.AllowBrotherPurchase; } tonghangTh.Visible = allowBrotherPurchases; tonghang.Visible = allowBrotherPurchases; dropOffice.DataSource = CompanyService.QueryOfficeNumbers(this.CurrentCompany.CompanyId); dropOffice.DataTextField = "Number"; dropOffice.DataValueField = "Impower"; dropOffice.DataBind(); ddlCustomCode.DataSource = CompanyService.GetCustomNumberByEmployee(CurrentUser.Id); ddlCustomCode.DataTextField = "Number"; ddlCustomCode.DataValueField = "Number"; ddlCustomCode.DataBind(); if (Request.QueryString["Id"] != null && Request.QueryString["Type"] != null) { if (Request.QueryString["Type"].Trim() == "Update") { tip.InnerText = "修改团队政策"; chkAuto.Visible = false; btnCopy.Visible = false; btnModify.Visible = true; lblAirline.Visible = true; ddlAirline.Visible = false; } if (Request.QueryString["Type"].Trim() == "Copy") { tip.InnerText = "复制团队政策"; chkAuto.Visible = true; btnCopy.Visible = true; btnModify.Visible = false; lblAirline.Visible = false; ddlAirline.Visible = true; string[] strIds = setting.Airlines.Split('/'); ddlAirline.DataSource = from item in ChinaPay.B3B.Service.FoundationService.Airlines where item.Valid && strIds.Contains(item.Code.Value) select new { Code = item.Code, Name = item.Code + "-" + item.ShortName }; ddlAirline.DataTextField = "Name"; ddlAirline.DataValueField = "Code"; ddlAirline.DataBind(); } TeamPolicy team = PolicyManageService.GetTeamPolicy(Guid.Parse(Request.QueryString["Id"])); InitDataValues(team); } } }
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); }