public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtleibie.Text.Trim().Length == 0) { strErr += "leibie不能为空!\\n"; } if (this.txttext.Text.Trim().Length == 0) { strErr += "text不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int id = int.Parse(this.lblid.Text); string leibie = this.txtleibie.Text; string text = this.txttext.Text; Maticsoft.Model.dafenbiao model = new Maticsoft.Model.dafenbiao(); model.id = id; model.leibie = leibie; model.text = text; Maticsoft.BLL.dafenbiao bll = new Maticsoft.BLL.dafenbiao(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtleibie.Text.Trim().Length == 0) { strErr += "leibie不能为空!\\n"; } if (this.txttext.Text.Trim().Length == 0) { strErr += "text不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string leibie = this.txtleibie.Text; string text = this.txttext.Text; Maticsoft.Model.dafenbiao model = new Maticsoft.Model.dafenbiao(); model.leibie = leibie; model.text = text; Maticsoft.BLL.dafenbiao bll = new Maticsoft.BLL.dafenbiao(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void ShowInfo(int id) { Maticsoft.BLL.dafenbiao bll = new Maticsoft.BLL.dafenbiao(); Maticsoft.Model.dafenbiao model = bll.GetModel(id); this.lblid.Text = model.id.ToString(); this.txtleibie.Text = model.leibie; this.txttext.Text = model.text; }