public void Update(M_LbCategory model) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.NVarChar), new SqlParameter("@ParentID", SqlDbType.Int), new SqlParameter("@Desc", SqlDbType.NVarChar), new SqlParameter("@LbCategoryID", SqlDbType.Int) }; commandParameters[0].Value = model.Name; commandParameters[1].Value = model.ParentID; commandParameters[2].Value = model.Desc; commandParameters[3].Value = model.LbCategoryID; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_LbCategory_Update", commandParameters); }
public int Add(M_LbCategory model) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("Name", SqlDbType.NVarChar), new SqlParameter("ParentID", SqlDbType.Int), new SqlParameter("Desc", SqlDbType.NVarChar), new SqlParameter("@LbCategoryID", SqlDbType.Int, 4) }; commandParameters[0].Value = model.Name; commandParameters[1].Value = model.ParentID; commandParameters[2].Value = model.Desc; commandParameters[3].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_LbCategory_ADD", commandParameters); return (int) commandParameters[3].Value; }
public M_LbCategory GetLabeCategoryIdData(int lbCategoryId) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@LbCategoryID", SqlDbType.Int) }; commandParameters[0].Value = lbCategoryId; DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_LbCategory_GetIdData", commandParameters); if (table.Rows.Count > 0) { M_LbCategory category = new M_LbCategory(); category.Name = table.Rows[0]["Name"].ToString(); category.Desc = table.Rows[0]["Desc"].ToString(); return category; } return null; }
protected void btnSave_Click(object sender, EventArgs e) { try { M_LbCategory m_LbCategory = new M_LbCategory(); m_LbCategory.Name = txtLabelTypeName.Text.Trim(); m_LbCategory.ParentID = int.Parse(dropLabelType.SelectedValue.ToString()); m_LbCategory.Desc = txtExplain.Text.Trim(); B_LbCategory b_Lbcategory = new B_LbCategory(); B_KyCommon bllCom = new B_KyCommon(); bool flag = false; flag = bllCom.CheckHas(m_LbCategory.Name, "Name", "KyLbCategory"); if (btnSave.Text == "修改类别") { m_LbCategory.LbCategoryID=int.Parse(Request.QueryString["lbCategoryId"].ToString()); B_LbCategory bll = new B_LbCategory(); bll.Update(m_LbCategory); Response.Redirect(SkipPageUrl); } else { if (!flag) { b_Lbcategory.Add(m_LbCategory); Response.Redirect(SkipPageUrl); } else Response.Write("<script>alert('己存在此标签名称')</script>"); } } catch { Response.Write("<script>alert('操作有误')</script>"); } }
public void Update(M_LbCategory model) { this.ilbcategory.Update(model); }
public int Add(M_LbCategory model) { return this.ilbcategory.Add(model); }