protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsDateTime(txtComeDate.Text)) { strErr += "ComeDate格式错误!\\n"; } if (!PageValidate.IsNumber(txtDept_ID.Text)) { strErr += "Dept_ID格式错误!\\n"; } if (!PageValidate.IsNumber(txtEmployee_ID.Text)) { strErr += "Employee_ID格式错误!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } DateTime ComeDate = DateTime.Parse(this.txtComeDate.Text); int Dept_ID = int.Parse(this.txtDept_ID.Text); int Employee_ID = int.Parse(this.txtEmployee_ID.Text); ZhangWei.Model.Buy model = new ZhangWei.Model.Buy(); model.ComeDate = ComeDate; model.Dept_ID = Dept_ID; model.Employee_ID = Employee_ID; ZhangWei.BLL.Buy bll = new ZhangWei.BLL.Buy(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
private void ShowInfo(int Buy_ID) { ZhangWei.BLL.Buy bll = new ZhangWei.BLL.Buy(); ZhangWei.Model.Buy model = bll.GetModel(Buy_ID); this.lblBuy_ID.Text = model.Buy_ID.ToString(); this.txtComeDate.Text = model.ComeDate.ToString(); this.txtDept_ID.Text = model.Dept_ID.ToString(); this.txtEmployee_ID.Text = model.Employee_ID.ToString(); }