Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtCommoditySonID.Text.Trim().Length == 0)
            {
                strErr += "CommoditySonID不能为空!\\n";
            }
            if (this.txtCommodityFatherID.Text.Trim().Length == 0)
            {
                strErr += "CommodityFatherID不能为空!\\n";
            }
            if (this.txtCommoditySonName.Text.Trim().Length == 0)
            {
                strErr += "CommoditySonName不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string CommoditySonID    = this.txtCommoditySonID.Text;
            string CommodityFatherID = this.txtCommodityFatherID.Text;
            string CommoditySonName  = this.txtCommoditySonName.Text;

            Maticsoft.Model.CommoditySon model = new Maticsoft.Model.CommoditySon();
            model.CommoditySonID    = CommoditySonID;
            model.CommodityFatherID = CommodityFatherID;
            model.CommoditySonName  = CommoditySonName;

            Maticsoft.BLL.CommoditySon bll = new Maticsoft.BLL.CommoditySon();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Ejemplo n.º 2
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if ((CommoditySon_Bll.GetList("CommoditySonName ='" + RadTextBox1.Text + "'").Tables[0].Rows.Count) > 0)
     {
         RadAjaxManager1.Alert("请输入不同名称!");
     }
     else
     {
         CommoditySon_Model.CommoditySonName  = RadTextBox1.Text;
         CommoditySon_Model.CommodityFatherID = Session["FaID"].ToString();
         CommoditySon_Model.CommoditySonID    = DateTime.Now.ToString("yyyyMMddhhmmss");
         CommoditySon_Bll.Add(CommoditySon_Model);
         ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>CloseAndRebind();</script>");
     }
 }