private void ShowInfo(int CategoryID) { Maticsoft.BLL.Category bll = new Maticsoft.BLL.Category(); Maticsoft.Model.Category model = bll.GetModel(CategoryID); this.lblCategoryID.Text = model.CategoryID.ToString(); this.lblCategorytype.Text = model.Categorytype; }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtCategoryID.Text)) { strErr += "CategoryID格式错误!\\n"; } if (this.txtCategorytype.Text.Trim().Length == 0) { strErr += "Categorytype不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int CategoryID = int.Parse(this.txtCategoryID.Text); string Categorytype = this.txtCategorytype.Text; Maticsoft.Model.Category model = new Maticsoft.Model.Category(); model.CategoryID = CategoryID; model.Categorytype = Categorytype; Maticsoft.BLL.Category bll = new Maticsoft.BLL.Category(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtCategorytype.Text.Trim().Length == 0) { strErr += "Categorytype不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int CategoryID = int.Parse(this.lblCategoryID.Text); string Categorytype = this.txtCategorytype.Text; Maticsoft.Model.Category model = new Maticsoft.Model.Category(); model.CategoryID = CategoryID; model.Categorytype = Categorytype; Maticsoft.BLL.Category bll = new Maticsoft.BLL.Category(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }