protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (!PageValidate.IsNumber(txtProTypeID.Text)) { strErr += "ProTypeID格式错误!\\n"; } if (this.txtProXingTitle.Text.Trim().Length == 0) { strErr += "ProXingTitle不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } int ProTypeID = int.Parse(this.txtProTypeID.Text); string ProXingTitle = this.txtProXingTitle.Text; Maticsoft.Model.ProductXing model = new Maticsoft.Model.ProductXing(); model.ProTypeID = ProTypeID; model.ProXingTitle = ProXingTitle; Maticsoft.BLL.ProductXing bll = new Maticsoft.BLL.ProductXing(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
protected void btnxing_Click(object sender, EventArgs e) { Maticsoft.BLL.ProductXing xingbll = new Maticsoft.BLL.ProductXing(); Maticsoft.Model.ProductXing xingmodel = new Maticsoft.Model.ProductXing(); xingmodel.ProTypeID = int.Parse(drpaddtypehao.SelectedValue.ToString()); if (txtaddxinghao.Text.Trim() == "") { lblxinghao.Text = "请填写产品型号"; return; } xingmodel.ProXingTitle = txtaddxinghao.Text.Trim(); lblxinghao.Text = ""; xingbll.Add(xingmodel); txtaddxinghao.Text = string.Empty; lblxinghao.Text = "产品型号提交成功"; }