Esempio n. 1
0
 protected void btnadd_Click(object sender, EventArgs e)
 {
     Maticsoft.BLL.ComPany   companybll = new Maticsoft.BLL.ComPany();
     Maticsoft.Model.ComPany commodel   = new Maticsoft.Model.ComPany();
     if (txtcompanyname.Text.Trim() == "")
     {
         lblconname.Text = "请填写公司名称";
         return;
     }
     lblconname.Text       = "";
     commodel.CompanyNames = txtcompanyname.Text.Trim();
     if (txtcompanytype.Text.Trim() == "")
     {
         lbltype.Text = "请填写公司类型";
         return;
     }
     lbltype.Text         = "";
     commodel.CompanyType = txtcompanytype.Text.Trim();
     if (txtcomaddress.Text.Trim() == "")
     {
         lbladdress.Text = "请填写公司地址";
         return;
     }
     lbladdress.Text     = "";
     commodel.ComAddress = txtcomaddress.Text.Trim();
     if (txtcomfax.Text.Trim() == "")
     {
         lblfax.Text = "请填写公司传真";
         return;
     }
     lblfax.Text     = "";
     commodel.ComFax = txtcomfax.Text.Trim();
     if (txtcomfaren.Text.Trim() == "")
     {
         lblfanren.Text = "请填写公司法人代表";
         return;
     }
     lblfanren.Text  = "";
     commodel.Fanren = txtcomfaren.Text.Trim();
     if (txtcomphoto.Text.Trim() == "")
     {
         lblphoto.Text = "请填写公司电话";
         return;
     }
     lblphoto.Text     = "";
     commodel.ComPhoto = txtcomphoto.Text.Trim();
     if (txtEmail.Text.Trim() == "")
     {
         lblemail.Text = "请填写公司邮箱";
         return;
     }
     lblemail.Text     = "";
     commodel.ComEmail = txtEmail.Text.Trim();
     if (txtqq.Text.Trim() == "")
     {
         lblqq.Text = "请填写公司qq或MSN";
         return;
     }
     lblqq.Text  = "";
     commodel.QQ = txtqq.Text.Trim();
     if (txtcomwangzhi.Text.Trim() == "")
     {
         lblwangzhi.Text = "请填写公司网址";
         return;
     }
     lblwangzhi.Text     = "";
     commodel.Comwangzhi = txtcomwangzhi.Text.Trim();
     if (txtcontent.Text.Trim() == "")
     {
         lblcomcontent.Text = "请填写公司简介";
     }
     lblcomcontent.Text = "";
     commodel.comconten = txtcontent.Text.Trim();
     companybll.Add(commodel);
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功....')</script>");
     txtcomaddress.Text  = string.Empty;
     txtcomfaren.Text    = string.Empty;
     txtcomfax.Text      = string.Empty;
     txtcompanyname.Text = string.Empty;
     txtcompanytype.Text = string.Empty;
     txtcomphoto.Text    = string.Empty;
     txtcomwangzhi.Text  = string.Empty;
     txtcontent.Text     = string.Empty;
     txtEmail.Text       = string.Empty;
     txtqq.Text          = string.Empty;
 }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtCompanyNames.Text.Trim().Length == 0)
            {
                strErr += "CompanyNames不能为空!\\n";
            }
            if (this.txtCompanyType.Text.Trim().Length == 0)
            {
                strErr += "CompanyType不能为空!\\n";
            }
            if (this.txtComAddress.Text.Trim().Length == 0)
            {
                strErr += "ComAddress不能为空!\\n";
            }
            if (this.txtComFax.Text.Trim().Length == 0)
            {
                strErr += "ComFax不能为空!\\n";
            }
            if (this.txtComPhoto.Text.Trim().Length == 0)
            {
                strErr += "ComPhoto不能为空!\\n";
            }
            if (this.txtComEmail.Text.Trim().Length == 0)
            {
                strErr += "ComEmail不能为空!\\n";
            }
            if (this.txtQQ.Text.Trim().Length == 0)
            {
                strErr += "QQ不能为空!\\n";
            }
            if (this.txtComwangzhi.Text.Trim().Length == 0)
            {
                strErr += "Comwangzhi不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string CompanyNames = this.txtCompanyNames.Text;
            string CompanyType  = this.txtCompanyType.Text;
            string ComAddress   = this.txtComAddress.Text;
            string ComFax       = this.txtComFax.Text;
            string ComPhoto     = this.txtComPhoto.Text;
            string ComEmail     = this.txtComEmail.Text;
            string QQ           = this.txtQQ.Text;
            string Comwangzhi   = this.txtComwangzhi.Text;

            Maticsoft.Model.ComPany model = new Maticsoft.Model.ComPany();
            model.CompanyNames = CompanyNames;
            model.CompanyType  = CompanyType;
            model.ComAddress   = ComAddress;
            model.ComFax       = ComFax;
            model.ComPhoto     = ComPhoto;
            model.ComEmail     = ComEmail;
            model.QQ           = QQ;
            model.Comwangzhi   = Comwangzhi;

            Maticsoft.BLL.ComPany bll = new Maticsoft.BLL.ComPany();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }