private void ShowInfo(int ProductSpec_ID) { ZhangWei.BLL.ProductSpec bll = new ZhangWei.BLL.ProductSpec(); ZhangWei.Model.ProductSpec model = bll.GetModel(ProductSpec_ID); this.lblProductSpec_ID.Text = model.ProductSpec_ID.ToString(); this.txtName.Text = model.Name; this.txtEmployee_ID.Text = model.Employee_ID.ToString(); this.txtCreateDate.Text = model.CreateDate.ToString(); this.txtRemark.Text = model.Remark; }
protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtName.Text.Trim().Length == 0) { strErr += "Name不能为空!\\n"; } //if(!PageValidate.IsNumber(txtEmployee_ID.Text)) //{ // strErr+="Employee_ID格式错误!\\n"; //} //if(!PageValidate.IsDateTime(txtCreateDate.Text)) //{ // strErr+="CreateDate格式错误!\\n"; //} //if(this.txtRemark.Text.Trim().Length==0) //{ // strErr+="Remark不能为空!\\n"; //} if (strErr != "") { MessageBox.Show(this, strErr); return; } string Name = this.txtName.Text; int Employee_ID = UserModel.Employee_ID; DateTime CreateDate = DateTime.Now; //string Remark=this.txtRemark.Text; ZhangWei.Model.ProductSpec model = new ZhangWei.Model.ProductSpec(); model.Name = Name; model.Employee_ID = Employee_ID; model.CreateDate = CreateDate; //model.Remark=Remark; if (new BLL.ProductSpec().GetList("Name = '" + Name + "'").Tables[0].Rows.Count > 0) { Maticsoft.Common.MessageBox.Show(this, "该规格已经存在,不用重复添加,以免造成货品资料混乱。"); } else { ZhangWei.BLL.ProductSpec bll = new ZhangWei.BLL.ProductSpec(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); } }
public void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtName.Text.Trim().Length == 0) { strErr += "Name不能为空!\\n"; } if (!PageValidate.IsNumber(txtEmployee_ID.Text)) { strErr += "Employee_ID格式错误!\\n"; } if (!PageValidate.IsDateTime(txtCreateDate.Text)) { strErr += "CreateDate格式错误!\\n"; } if (this.txtRemark.Text.Trim().Length == 0) { strErr += "Remark不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int ProductSpec_ID = int.Parse(this.lblProductSpec_ID.Text); string Name = this.txtName.Text; int Employee_ID = int.Parse(this.txtEmployee_ID.Text); DateTime CreateDate = DateTime.Parse(this.txtCreateDate.Text); string Remark = this.txtRemark.Text; ZhangWei.Model.ProductSpec model = new ZhangWei.Model.ProductSpec(); model.ProductSpec_ID = ProductSpec_ID; model.Name = Name; model.Employee_ID = Employee_ID; model.CreateDate = CreateDate; model.Remark = Remark; ZhangWei.BLL.ProductSpec bll = new ZhangWei.BLL.ProductSpec(); bll.Update(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx"); }