protected void btnSave_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.txtDicName.Text.Trim())) { int DicCateID = DataConverter.CLng(this.HdnDicID.Value); if (DicCateID > 0) { M_Dictionary info = B_DataDictionary.GetModel(DicCateID); info.DicName = this.txtDicName.Text.Trim(); B_DataDictionary.Update(info); } else { M_Dictionary info = new M_Dictionary(); info.DicID = 0; info.DicCate = DataConverter.CLng(this.HdnDicCateID.Value); info.DicName = this.txtDicName.Text.Trim(); info.IsUsed = true; B_DataDictionary.AddDic(info); } this.txtDicName.Text = ""; this.HdnDicID.Value = "0"; this.btnSave.Text = "添加"; DataBind(); } }
public ContentResult DicItem_API() { string action = GetParam("action"); string ids = GetParam("ids"); switch (action) { case "del": dItemBll.DelByIds(ids); break; case "save": { string name = GetParam("name"); if (string.IsNullOrEmpty(name)) { return(Content(Failed.ToString())); } M_Dictionary info = new M_Dictionary(); if (Mid > 0) { info = B_DataDictionary.GetModel(Mid); } info.DicName = name; if (info.DicID < 1) { info.DicCate = CateID; info.IsUsed = true; B_DataDictionary.AddDic(info); } else { B_DataDictionary.Update(info); } } break; } return(Content(Success.ToString())); }