protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtcpbianh.Text)) { strErr += "cpbianh格式错误!\\n"; } if (this.txtcgmc.Text.Trim().Length == 0) { strErr += "cgmc不能为空!\\n"; } if (this.txtxsmc.Text.Trim().Length == 0) { strErr += "xsmc不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int cpbianh = int.Parse(this.txtcpbianh.Text); string cgmc = this.txtcgmc.Text; string xsmc = this.txtxsmc.Text; Maticsoft.Model.cccc.cpinxinxi model = new Maticsoft.Model.cccc.cpinxinxi(); model.cpbianh = cpbianh; model.cgmc = cgmc; model.xsmc = xsmc; Maticsoft.BLL.cccc.cpinxinxi bll = new Maticsoft.BLL.cccc.cpinxinxi(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void ShowInfo(int id) { Maticsoft.BLL.cccc.cpinxinxi bll = new Maticsoft.BLL.cccc.cpinxinxi(); Maticsoft.Model.cccc.cpinxinxi model = bll.GetModel(id); this.lblid.Text = model.id.ToString(); this.lblcpbianh.Text = model.cpbianh.ToString(); this.lblcgmc.Text = model.cgmc; this.lblxsmc.Text = model.xsmc; }