protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtinvoiceNo.Text.Trim().Length == 0) { strErr += "invoiceNo不能为空!\\n"; } if (this.txtinvoiceUnit.Text.Trim().Length == 0) { strErr += "invoiceUnit不能为空!\\n"; } if (!PageValidate.IsDecimal(txtinvoiceSum.Text)) { strErr += "invoiceSum格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string invoiceNo = this.txtinvoiceNo.Text; string invoiceUnit = this.txtinvoiceUnit.Text; decimal invoiceSum = decimal.Parse(this.txtinvoiceSum.Text); BookShop.Model.Invoice model = new BookShop.Model.Invoice(); model.invoiceNo = invoiceNo; model.invoiceUnit = invoiceUnit; model.invoiceSum = invoiceSum; BookShop.BLL.Invoice bll = new BookShop.BLL.Invoice(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void ShowInfo(string invoiceNo) { BookShop.BLL.Invoice bll = new BookShop.BLL.Invoice(); BookShop.Model.Invoice model = bll.GetModel(invoiceNo); this.lblinvoiceNo.Text = model.invoiceNo; this.lblinvoiceUnit.Text = model.invoiceUnit; this.lblinvoiceSum.Text = model.invoiceSum.ToString(); }