protected void ButtonSubmit_Click(object sender, EventArgs e) { ERP.BLL.Warehouses bll = new ERP.BLL.Warehouses(); ERP.Model.Warehouses model = new ERP.Model.Warehouses(); model.WName = TextBoxWName.Text.ToString(); model.WArea = Convert.ToInt32(TextBoxWArea.Text); model.WAddress = TextBoxWAddress.Text.ToString(); model.WDescribe = TextBoxWDescribe.Text.ToString(); try { bll.Add(model); Response.Write("<script>alert('添加新仓库成功');history.back()</script>"); TextBoxWName.Text = ""; TextBoxWArea.Text = ""; TextBoxWAddress.Text = ""; TextBoxWDescribe.Text = ""; } catch (Exception) { Response.Write("<script>alert('未知错误,添加新仓库失败!');history.back()</script>"); TextBoxWName.Text = ""; TextBoxWArea.Text = ""; TextBoxWAddress.Text = ""; TextBoxWDescribe.Text = ""; } }
private void ShowInfo(int WID) { ERP.BLL.Warehouses bll = new ERP.BLL.Warehouses(); ERP.Model.Warehouses model = bll.GetModel(WID); this.lblWID.Text = model.WID.ToString(); this.lblWName.Text = model.WName; this.txtWArea.Text = model.WArea.ToString(); this.txtWAddress.Text = model.WAddress; this.txtWDescribe.Text = model.WDescribe; }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtWName.Text.Trim().Length == 0) { strErr += "WName不能为空!\\n"; } if (!PageValidate.IsDecimal(txtWArea.Text)) { strErr += "WArea格式错误!\\n"; } if (this.txtWAddress.Text.Trim().Length == 0) { strErr += "WAddress不能为空!\\n"; } if (this.txtWDescribe.Text.Trim().Length == 0) { strErr += "WDescribe不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string WName = this.txtWName.Text; decimal WArea = decimal.Parse(this.txtWArea.Text); string WAddress = this.txtWAddress.Text; string WDescribe = this.txtWDescribe.Text; ERP.Model.Warehouses model = new ERP.Model.Warehouses(); model.WName = WName; model.WArea = WArea; model.WAddress = WAddress; model.WDescribe = WDescribe; ERP.BLL.Warehouses bll = new ERP.BLL.Warehouses(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }