protected void Button1_Click(object sender, EventArgs e) { //把界面修改过的内容放置到实体对象 mdltype.typeId = int.Parse(Request.QueryString["typeId"]); mdltype.typeName = TBtype.Text; //把新信息传给业务逻辑更新到数据库 blltype.Update(mdltype); Response.Redirect("typeQuery.aspx?ts=upsucess"); }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txttypeName.Text.Trim().Length == 0) { strErr += "typeName不能为空!\\n"; } if (this.txtext1.Text.Trim().Length == 0) { strErr += "ext1不能为空!\\n"; } if (this.txtext2.Text.Trim().Length == 0) { strErr += "ext2不能为空!\\n"; } if (this.txtext3.Text.Trim().Length == 0) { strErr += "ext3不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int typeId = int.Parse(this.lbltypeId.Text); string typeName = this.txttypeName.Text; string ext1 = this.txtext1.Text; string ext2 = this.txtext2.Text; string ext3 = this.txtext3.Text; rr2.Model.typeInfo model = new rr2.Model.typeInfo(); model.typeId = typeId; model.typeName = typeName; model.ext1 = ext1; model.ext2 = ext2; model.ext3 = ext3; rr2.BLL.typeInfo bll = new rr2.BLL.typeInfo(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }