protected void btn_Update_Click(object sender, EventArgs e) { string strErr = ""; if (this.CateName.Text.Trim().Length == 0) { strErr += "类别名不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string CateName = this.CateName.Text; Change.Model.CategoryModel model = new Change.Model.CategoryModel(); model.CateId = Convert.ToInt32(Session["CateId"]); model.CateName = CateName; model.ParentId = Convert.ToInt32(this.ParentId.SelectedValue); Change.BLL.CategoryBll bll = new Change.BLL.CategoryBll(); if (bll.Update(model)) { MessageBox.Show(this, "修改成功!"); Response.Redirect(ViewState["BackUrl"].ToString()); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Change.Model.CategoryModel model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Change.Model.CategoryModel model) { return(dal.Add(model)); }