public int Delete(int id) { M_Dictionary model = new M_Dictionary(); model.Id = id; model.DicName = ""; return this.Set(3, model); }
public M_Dictionary GetModel(int id) { DataTable table = this.Get(1, -1, -1, "", id).Tables[0]; M_Dictionary dictionary = new M_Dictionary(); if (table.Rows.Count > 0) { dictionary.Id = id; dictionary.ParentId = Convert.ToInt32(table.Rows[0]["ParentId"]); dictionary.Sort = Convert.ToInt32(table.Rows[0]["Sort"]); dictionary.DicName = table.Rows[0]["DicName"].ToString(); return dictionary; } return null; }
private int Set(int type, M_Dictionary model) { int num = 0; SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Type", SqlDbType.Int, 4), new SqlParameter("@Id", SqlDbType.Int, 4), new SqlParameter("@ParentId", SqlDbType.Int, 4), new SqlParameter("@DicName", SqlDbType.NVarChar), new SqlParameter("@Sort", SqlDbType.Int, 4), new SqlParameter("@Identity", SqlDbType.Int, 4) }; commandParameters[0].Value = type; commandParameters[1].Value = model.Id; commandParameters[2].Value = model.ParentId; commandParameters[3].Value = model.DicName; commandParameters[4].Value = model.Sort; commandParameters[5].Value = 0; commandParameters[5].Direction = ParameterDirection.Output; num = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Dictionary_Set", commandParameters); if (type == 1) { num = Convert.ToInt32(commandParameters[5].Value); } return num; }
protected void rptDictionary_ItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.CommandName == "Select") { if (TypeId == 1) { StringBuilder sb = new StringBuilder(); DataTable dt = DicBll.GetDictionary(Convert.ToInt32(e.CommandArgument)); for (int i = 0; i < dt.Rows.Count; i++) { if (i == dt.Rows.Count - 1) { sb.Append(dt.Rows[i]["DicName"].ToString()); } else { sb.Append(dt.Rows[i]["DicName"].ToString() + "\\r\\n"); } } Response.Write("<script>window.dialogArguments.$('" + ControlId + "').value='" + sb.ToString() + "';window.close();</script>"); Response.End(); } else { if (TypeId == 2) { M_Dictionary model = new M_Dictionary(); model = DicBll.GetModel(Convert.ToInt32(e.CommandArgument)); Response.Write("<script>window.dialogArguments.$('" + ControlId + "_Show').value='" + model.DicName + "';window.dialogArguments.$('" + ControlId + "').value='" + Convert.ToInt32(e.CommandArgument) + "';window.close();</script>"); Response.End(); } } } }
/// <summary> /// 新增字典 /// </summary> protected void btnAdd_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtNewName.Text)) { Function.ShowSysMsg(0, "<li>请输入字典名称</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } if (string.IsNullOrEmpty(txtNewSort.Text)) { Function.ShowSysMsg(0, "<li>请输入排序值</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } if (!Function.CheckNumber(txtNewSort.Text)) { Function.ShowSysMsg(0, "<li>您输入的排序值不正确,请重新输入</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>"); } M_Dictionary model = new M_Dictionary(); model.DicName = txtNewName.Text; model.ParentId = int.Parse(ddlDictionary.SelectedValue); model.Sort = int.Parse(txtNewSort.Text); DicBll.Add(model); Id = int.Parse(ddlDictionary.SelectedValue); BindData(); ddlBind(); txtNewName.Text = txtNewSort.Text = ""; }
private void GetShow() { MUserGroupModelField = BUserGroupModelField.GetModel(FieldId); Name.Text = MUserGroupModelField.Name; Alias.Text = MUserGroupModelField.Alias; Description.Text = MUserGroupModelField.Description; IsNotNull.SelectedValue = MUserGroupModelField.IsNotNull.ToString(); IsList.SelectedValue = MUserGroupModelField.IsList.ToString(); IsUserInsert.SelectedValue = MUserGroupModelField.IsUserInsert.ToString(); IsSearchForm.SelectedValue = MUserGroupModelField.IsSearchForm.ToString(); string MyType = MUserGroupModelField.Type; string MyContent = MUserGroupModelField.Content; Type.SelectedValue = MyType; if (MyType == "TextType") { TitleSize.Text = BModelField.GetFieldContent(MyContent, 0, 1); IsPassword.SelectedValue = BModelField.GetFieldContent(MyContent, 1, 1); TextType_DefaultValue.Text = BModelField.GetFieldContent(MyContent, 2, 1); } if (MyType == "MultipleTextType") { MultipleTextType_Width.Text = BModelField.GetFieldContent(MyContent, 0, 1); MultipleTextType_Height.Text = BModelField.GetFieldContent(MyContent, 1, 1); } if (MyType == "MultipleHtmlType") { MultipleHtmlType_Width.Text = BModelField.GetFieldContent(MyContent, 0, 1); MultipleHtmlType_Height.Text = BModelField.GetFieldContent(MyContent, 1, 1); IsEditor.SelectedValue = BModelField.GetFieldContent(MyContent, 2, 1); } if (MyType == "RadioType") { RadioType_Content.Text = Function.Decode(BModelField.GetFieldContent(MyContent, 0, 1).Replace("|", "<br>")); RadioType_Type.SelectedValue = BModelField.GetFieldContent(MyContent, 0, 0); RadioType_Property.SelectedValue = BModelField.GetFieldContent(MyContent, 1, 1).ToString(); RadioType_Default.Text = BModelField.GetFieldContent(MyContent, 2, 1).ToString(); } if (MyType == "ListBoxType") { ListBoxType_Content.Text = Function.Decode(BModelField.GetFieldContent(MyContent, 0, 1).Replace("|", "<br>")); ListBoxType_Type.SelectedValue = BModelField.GetFieldContent(MyContent, 0, 0); } if (MyType == "NumberType") { NumberType_TitleSize.Text = BModelField.GetFieldContent(MyContent, 0, 1); NumberType_DefaultValue.Text = BModelField.GetFieldContent(MyContent, 1, 1); } if (MyType == "ErLinkageType") { ErLinkage_Value.Text = BModelField.GetFieldContent(MyContent, 0, 1); MDictionary = BDictionary.GetModel(int.Parse(BModelField.GetFieldContent(MyContent, 0, 1))); ErLinkage_Value_Show.Text = MDictionary.DicName; ErLinkage_Er_Alias.Text = BModelField.GetFieldContent(MyContent, 1, 1); ErLinkage_Er_Name.Text = BModelField.GetFieldContent(MyContent, 2, 1); } }
public int Update(M_Dictionary model) { return this.Set(2, model); }
public int Add(M_Dictionary model) { return this.Set(1, model); }
public int Update(M_Dictionary model) { return this.dal.Update(model); }
public int Add(M_Dictionary model) { return this.dal.Add(model); }