/// <summary> /// 绑定资源操作 /// </summary> private void BindResourceOperate() { IList<Owen.Model.Model_Operate> list = new Owen.BLL.BLL_Operate().GetEntities(string.Format(" ")); cblOperate.DataTextField = "OperateName"; cblOperate.DataValueField = "OperateID"; cblOperate.DataSource = list; cblOperate.DataBind(); }
/// <summary> /// 初始加载 /// </summary> private void OnStart() { Owen.Model.Model_Operate model = new Owen.BLL.BLL_Operate().GetEntity(string.Format(" OperateID = {0}", operateId)); if (model == null) return; txtOperateName.Text = model.OperateName; txtOperateNum.Text = model.OperateNum; txtRemark.Text = model.Remark; }
protected void btnSave_Click(object sender, EventArgs e) { Owen.Model.Model_Operate modelOperate = new Owen.BLL.BLL_Operate(). GetEntity(string.Format(" OperateID = {0}", operateId)); if (modelOperate == null) modelOperate = new Owen.Model.Model_Operate(); if (String.IsNullOrEmpty(txtOperateName.Text)) { JSHelper.Alert(this, "请输入资源操作名称!"); return; } if ((action.Equals("add")) && new Owen.BLL.BLL_Operate().ExistsName(txtOperateName.Text)) { JSHelper.Alert(this, "资源操作名已存在!"); return; } if ((action.Equals("edit")) && new Owen.BLL.BLL_Operate().ExistsName(txtOperateName.Text, operateId)) { JSHelper.Alert(this, "资源操作名已存在!"); return; } if ((action.Equals("add")) && new Owen.BLL.BLL_Operate().ExistsNum(txtOperateNum.Text)) { JSHelper.Alert(this, "资源操作编码已存在!"); return; } if ((action.Equals("edit")) && new Owen.BLL.BLL_Operate().ExistsNum(txtOperateNum.Text, operateId)) { JSHelper.Alert(this, "资源操作编码已存在!"); return; } modelOperate.OperateName = txtOperateName.Text; modelOperate.OperateNum = txtOperateNum.Text; modelOperate.Remark = txtRemark.Text; switch (action) { case "add": new Owen.BLL.BLL_Operate().AddEntity(modelOperate); JSHelper.Alert(this, "保存成功!", "OperateList.aspx"); break; case "edit": new Owen.BLL.BLL_Operate().UpdateEntity(modelOperate); JSHelper.Alert(this, "保存成功!", "OperateList.aspx"); break; } }