Пример #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtId.Text))
            {
                strErr += "Id格式错误!\\n";
            }
            if (this.txtName.Text.Trim().Length == 0)
            {
                strErr += "Name不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int    Id   = int.Parse(this.txtId.Text);
            string Name = this.txtName.Text;

            BookShop.Model.Categories model = new BookShop.Model.Categories();
            model.Id   = Id;
            model.Name = Name;

            BookShop.BLL.Categories bll = new BookShop.BLL.Categories();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BookShop.Model.Categories model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(BookShop.Model.Categories model)
 {
     return(dal.Add(model));
 }