protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtsname.Text.Trim().Length == 0) { strErr += "sname不能为空!\\n"; } if (this.txtsdescription.Text.Trim().Length == 0) { strErr += "sdescription不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string sname = this.txtsname.Text; string sdescription = this.txtsdescription.Text; myhouse.Model.Section model = new myhouse.Model.Section(); model.sname = sname; model.sdescription = sdescription; myhouse.BLL.SectionService bll = new myhouse.BLL.SectionService(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void ShowInfo(int sid) { myhouse.BLL.SectionService bll = new myhouse.BLL.SectionService(); myhouse.Model.Section model = bll.GetModel(sid); this.lblsid.Text = model.sid.ToString(); this.lblsname.Text = model.sname; this.lblsdescription.Text = model.sdescription; }