/// <summary> /// 新增一条数据字典记录 /// </summary> /// <param name="dictronary">System.String[]<param> /// <returns>返回数据字典受影响的行数</returns> public virtual int Add(Dictronary dictronary) { return db.ExecuteNoQuery("INSERT INTO T_BASE_DICTRONARY (DICT_TYPE, DICT_CODE, DICT_NAME, DICT_VALUE, DICT_DESC) VALUES (@DICT_TYPE, @DICT_CODE, @DICT_NAME, @DICT_VALUE, @DICT_DESC)", db.GetDataParameter("@DICT_TYPE", dictronary.DictType), db.GetDataParameter("@DICT_CODE", dictronary.DictCode), db.GetDataParameter("@DICT_NAME", dictronary.DictName), db.GetDataParameter("@DICT_VALUE", dictronary.DictValue), db.GetDataParameter("@DICT_DESC", dictronary.DictDesc)); }
/// <summary> /// 根据 DictCode 更新数据字典表记录 /// </summary> /// <returns>返回数据字典受影响的行数</returns> public virtual int Update(Dictronary dictronary,string oldCode) { return db.ExecuteNoQuery("UPDATE T_BASE_DICTRONARY SET DICT_CODE = @DICT_CODE, DICT_NAME = @DICT_NAME, DICT_VALUE = @DICT_VALUE, DICT_DESC = @DICT_DESC WHERE DICT_CODE = @oldCode", //db.GetDataParameter("@DICT_CODE", oldCode), db.GetDataParameter("@DICT_CODE", dictronary.DictCode), db.GetDataParameter("@DICT_NAME", dictronary.DictName), db.GetDataParameter("@DICT_VALUE", dictronary.DictValue), db.GetDataParameter("@DICT_DESC", dictronary.DictDesc), db.GetDataParameter("@oldCode", oldCode) ); }
protected void btnAddSub_Click(object sender, EventArgs e) { Dictronary subupdating = new Dictronary(); subupdating.DictCode = txtDictCode.Text; subupdating.DictType = Request.QueryString["val"]; subupdating.DictName = txtDictName.Text; subupdating.DictDesc = txtDictDesc.Text; ObservableCollection<Dictronary> List = new DictronaryDAL().QueryByType(Request["val"]); foreach (Dictronary obj in List) { if (obj.DictCode == subupdating.DictCode) { Alert("您已提交过该编号了!"); return; } } new DictronaryDAL().Add(subupdating); txtDictCode.Text = ""; txtDictName.Text = ""; txtDictDesc.Text = ""; InitPage(); }
protected void gridSubName_RowUpdating(object sender, GridViewUpdateEventArgs e) { string strCode=((TextBox)gridSubName.Rows[e.RowIndex].FindControl("txtDictCode")).Text.Trim(); if (strCode.Length > 0) { try { if (!CheckString(strCode)) { Alert("请勿输入特殊字符!"); return; } string oldSub = ((TextBox)gridSubName.Rows[e.RowIndex].FindControl("txtOldSubName")).Text; if (Request["val"].ToString() != "") { ObservableCollection<Dictronary> List = new DictronaryDAL().SelectSubWithoutSelf(Request["val"], oldSub); foreach (Dictronary obj in List) { if (obj.DictCode == strCode) { Alert("您已提交过该名称了!"); return; } } } Dictronary subupdating = new Dictronary(); subupdating.DictCode = strCode; subupdating.DictType = Request.QueryString["val"]; subupdating.DictName = ((TextBox)gridSubName.Rows[e.RowIndex].FindControl("txtDictName")).Text; subupdating.DictDesc = ((TextBox)gridSubName.Rows[e.RowIndex].FindControl("txtDictDesc")).Text; new DictronaryDAL().Update(subupdating,oldSub); gridSubName.EditIndex = -1; InitPage(); } catch (Exception ex) { Alert(ex); } } else { Alert("子类名称不能为空!"); return; } }