protected void btnSave_Click(object sender, EventArgs e) { //try //{ M_StyleCategory model = new M_StyleCategory(); model.Name = txtStyleTypeName.Text.Trim(); model.ParentID = int.Parse(dropType.SelectedValue.ToString()); model.Desc = txtExplain.Text.Trim(); B_StyleCategory b_styleCategory = new B_StyleCategory(); B_KyCommon bllCom = new B_KyCommon(); bool flag = false; flag = bllCom.CheckHas(model.Name, "Name", "KyStyleCategory"); if (btnSave.Text == "修改样式") { model.StyleCategoryID = int.Parse(Request.QueryString["styleCategoryId"].ToString()); b_styleCategory.Update(model); Response.Redirect(SkipPageUrl); } else { if (!flag) { b_styleCategory.Add(model); Response.Redirect(SkipPageUrl); } else Response.Write("<script>alert('此样式名称已存在')</script>"); } //} //catch //{ // Response.Write("文件出错!!!"); //} }
public void Add(M_StyleCategory model) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Name", SqlDbType.NVarChar), new SqlParameter("ParentID", SqlDbType.Int), new SqlParameter("Desc", SqlDbType.NVarChar) }; commandParameters[0].Value = model.Name; commandParameters[1].Value = model.ParentID; commandParameters[2].Value = model.Desc; SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_StyleCategory_ADD", commandParameters); }
public M_StyleCategory GetUpdateData(int styleCategoryId) { SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@StyleCategoryID", SqlDbType.Int) }; commandParameters[0].Value = styleCategoryId; DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_StyleCategory_GetIdData", commandParameters); if (table.Rows.Count > 0) { DataRow row = table.Rows[0]; M_StyleCategory category = new M_StyleCategory(); category.ParentID = int.Parse(row["ParentID"].ToString()); category.Name = row["Name"].ToString(); category.Desc = row["Desc"].ToString(); return category; } return null; }
public void Update(M_StyleCategory model) { this.istylecategory.Update(model); }
public void Add(M_StyleCategory model) { this.istylecategory.Add(model); }