protected void btnSave_Click(object sender, EventArgs e) { string strErr = ""; if (this.txtCommodityFatherID.Text.Trim().Length == 0) { strErr += "CommodityFatherID不能为空!\\n"; } if (this.txtCommodityFatherName.Text.Trim().Length == 0) { strErr += "CommodityFatherName不能为空!\\n"; } if (strErr != "") { MessageBox.Show(this, strErr); return; } string CommodityFatherID = this.txtCommodityFatherID.Text; string CommodityFatherName = this.txtCommodityFatherName.Text; Maticsoft.Model.CommodityFather model = new Maticsoft.Model.CommodityFather(); model.CommodityFatherID = CommodityFatherID; model.CommodityFatherName = CommodityFatherName; Maticsoft.BLL.CommodityFather bll = new Maticsoft.BLL.CommodityFather(); bll.Add(model); Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx"); }
protected void Button1_Click(object sender, EventArgs e) { if ((CommodityFather_BLL.GetList("CommodityFatherName ='" + RadTextBox1.Text + "'").Tables[0].Rows.Count) > 0) { RadAjaxManager1.Alert("请输入不同名称!"); } else { CommodityFather_Model.CommodityFatherName = RadTextBox1.Text; CommodityFather_Model.CommodityFatherID = DateTime.Now.ToString("yyyyMMddhhmmss"); CommodityFather_BLL.Add(CommodityFather_Model); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>"); } }