예제 #1
0
 protected void btnok_Click(object sender, EventArgs e)
 {
     Maticsoft.BLL.ZiXunInfo   zixunbll   = new Maticsoft.BLL.ZiXunInfo();
     Maticsoft.Model.ZiXunInfo zixunmodel = new Maticsoft.Model.ZiXunInfo();
     zixunmodel.zixuncontent = txtcontent.Text.Trim();
     if (txtusename.Text.Trim() == "")
     {
         lblusename.Text = "请填写用户名称..";
         return;
     }
     zixunmodel.zixunUserName = txtusename.Text.Trim();
     lblusename.Text          = "";
     if (txttitle.Text.Trim() == "")
     {
         lnltitle.Text = "请填写提问标题..";
         return;
     }
     zixunmodel.zixunTitle = txttitle.Text.Trim();
     lnltitle.Text         = "";
     if (txtlinphoto.Text.Trim() == "")
     {
         lbllinkphoto.Text = "请填写您的联系方式..";
     }
     lbllinkphoto.Text         = "";
     zixunmodel.zixunuserPhoto = txtlinphoto.Text.Trim();
     zixunmodel.zixuntime      = Convert.ToDateTime(DateTime.Now.ToString());
     zixunbll.Add(zixunmodel);
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('提交信息成功!!')</script>");
     bind();
     txtcontent.Text  = string.Empty;
     txtlinphoto.Text = string.Empty;
     txttitle.Text    = string.Empty;
     txtusename.Text  = string.Empty;
 }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtzixunTitle.Text.Trim().Length == 0)
            {
                strErr += "zixunTitle不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtzixuntime.Text))
            {
                strErr += "zixuntime格式错误!\\n";
            }
            if (this.txtzixuncontent.Text.Trim().Length == 0)
            {
                strErr += "zixuncontent不能为空!\\n";
            }
            if (this.txtzixunUserName.Text.Trim().Length == 0)
            {
                strErr += "zixunUserName不能为空!\\n";
            }
            if (this.txtzixunuserPhoto.Text.Trim().Length == 0)
            {
                strErr += "zixunuserPhoto不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   zixunTitle     = this.txtzixunTitle.Text;
            DateTime zixuntime      = DateTime.Parse(this.txtzixuntime.Text);
            string   zixuncontent   = this.txtzixuncontent.Text;
            string   zixunUserName  = this.txtzixunUserName.Text;
            string   zixunuserPhoto = this.txtzixunuserPhoto.Text;

            Maticsoft.Model.ZiXunInfo model = new Maticsoft.Model.ZiXunInfo();
            model.zixunTitle     = zixunTitle;
            model.zixuntime      = zixuntime;
            model.zixuncontent   = zixuncontent;
            model.zixunUserName  = zixunUserName;
            model.zixunuserPhoto = zixunuserPhoto;

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