using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.BLL; using CY.Model; using CY.Infrastructure.Query; using CY.Infrastructure.Common; namespace CY.WebForm.Pages.sysglobal { //吴辉 //添加修改授信等级规则 public partial class AddCreditLineLevelRule : BasePage { Pay_CreditLineLevelRuleBLL bll_Pay_CreditLineLevelRuleBLL = null; //初始化 public AddCreditLineLevelRule() { bll_Pay_CreditLineLevelRuleBLL = new Pay_CreditLineLevelRuleBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //绑定下级授信等级 List modellist = bll_Pay_CreditLineLevelRuleBLL.GetModelList().ToList(); this.ddlNextLevelRule.DataSource = modellist; this.ddlNextLevelRule.DataValueField = "Keyid"; this.ddlNextLevelRule.DataTextField = "LevelName"; this.ddlNextLevelRule.DataBind(); this.ddlNextLevelRule.Items.Insert(0, new ListItem("请选择", "-1")); this.LevelIconImg.Visible = false; if (Request["Keyid"].ToInt32() > 0) { Pay_CreditLineLevelRule model = bll_Pay_CreditLineLevelRuleBLL.GetModel(Request["keyid"].ToInt32()); this.LevelName.Value = model.LevelName.ToString2(); this.MaxScore.Value = model.MaxScore.ToString2(); if (string.IsNullOrEmpty(model.LevelIcon.ToString2())) { this.LevelIconImg.Visible = false; } else { this.LevelIconImg.Visible = true; this.LevelIconImg.Src = model.LevelIcon.ToString2(); } this.Credit.Value = model.Credit.ToString2(); this.RebateProportion.Value = model.RebateProportion.ToString2(); this.Remark.Value = model.Remark.ToString2(); this.ddlNextLevelRule.SelectedValue = model.NextLevelRule.ToString2(); } } } //提交表单 protected void btn_Submit_Config(object sender, EventArgs e) { Pay_CreditLineLevelRule model = new Pay_CreditLineLevelRule(); if (Request["Keyid"].ToInt32() > 0) { model = bll_Pay_CreditLineLevelRuleBLL.GetModel(Request["keyid"].ToInt32()); } else {model = new Pay_CreditLineLevelRule();} //上传等级图标 CY.WebForm.cs.UploadCS.UpFileResult _UpFileResult1 = CY.WebForm.cs.UploadCS.Upload("LevelIcon", model.LevelIcon); if (_UpFileResult1.returnerror.Count == 0) { if (_UpFileResult1.returnfilename.Count > 0) { model.LevelIcon = _UpFileResult1.returnfilename[0].ToString2(); } else { model.LevelIcon = model.LevelIcon ?? ""; } } else { model.LevelIcon = model.LevelIcon ?? ""; JavaScript.MessageBox(string.Join("
", (string[])_UpFileResult1.returnerror.ToArray(typeof(string))), this); return; } model.LevelName = this.LevelName.Value.ToString2(); model.MaxScore = this.MaxScore.Value.ToInt32(); model.NextLevelRule = this.ddlNextLevelRule.SelectedValue.ToInt32(); model.Credit = this.Credit.Value.ToDecimal2(); model.RebateProportion = this.RebateProportion.Value.ToDecimal2(); model.Remark = this.Remark.Value.ToString2(); model.Operator = CurrentUser.ShortName.ToString2(); model.LastUpdateTime = DateTime.Now; if (Request["Keyid"].ToInt32() > 0) { bll_Pay_CreditLineLevelRuleBLL.UpdateModel(model);//更新信息 } else { bll_Pay_CreditLineLevelRuleBLL.InsertModel(model);//添加信息 } JavaScript.RefreshDIVOpener(this); } } }