Esempio n. 1
0
 protected void btnok_Click(object sender, EventArgs e)
 {
     Maticsoft.BLL.JiShuInfo   jishubll   = new Maticsoft.BLL.JiShuInfo();
     Maticsoft.Model.JiShuInfo jishumodel = new Maticsoft.Model.JiShuInfo();
     if (txtJishuTitle.Text.Trim() == null)
     {
         lbltitle.Text = "请填写文件名称";
         return;
     }
     jishumodel.JishuTitle = txtJishuTitle.Text.Trim();
     lbltitle.Text         = "";
     jishumodel.JishuPath  = lblinfo1.Text;
     if (txttime.Text.Trim() == null)
     {
         lbltime.Text = "请填写发布时间";
         return;
     }
     lbltime.Text      = "";
     jishumodel.Fatime = Convert.ToDateTime(txttime.Text.Trim());
     if (txtleib.Text.Trim() == null)
     {
         lbltype.Text = "请填写文件类别";
         return;
     }
     lbltype.Text            = "";
     jishumodel.jishuType    = txtleib.Text.Trim();
     jishumodel.ImageURL     = Image1.ImageUrl;
     jishumodel.Jishucontent = txtcontent.Text.Trim();
     jishubll.Add(jishumodel);
     Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息提交成功')</script>");
     txtcontent.Text    = string.Empty;
     txtJishuTitle.Text = string.Empty;
     txtleib.Text       = string.Empty;
     txttime.Text       = string.Empty;
 }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtJishuTitle.Text.Trim().Length == 0)
            {
                strErr += "JishuTitle不能为空!\\n";
            }
            if (this.txtJishuNum.Text.Trim().Length == 0)
            {
                strErr += "JishuNum不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtFatime.Text))
            {
                strErr += "Fatime格式错误!\\n";
            }
            if (this.txtjishuType.Text.Trim().Length == 0)
            {
                strErr += "jishuType不能为空!\\n";
            }
            if (this.txtImageURL.Text.Trim().Length == 0)
            {
                strErr += "ImageURL不能为空!\\n";
            }
            if (this.txtJishuPath.Text.Trim().Length == 0)
            {
                strErr += "JishuPath不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   JishuTitle = this.txtJishuTitle.Text;
            string   JishuNum   = this.txtJishuNum.Text;
            DateTime Fatime     = DateTime.Parse(this.txtFatime.Text);
            string   jishuType  = this.txtjishuType.Text;
            string   ImageURL   = this.txtImageURL.Text;
            string   JishuPath  = this.txtJishuPath.Text;

            Maticsoft.Model.JiShuInfo model = new Maticsoft.Model.JiShuInfo();
            model.JishuTitle = JishuTitle;
            model.JishuNum   = JishuNum;
            model.Fatime     = Fatime;
            model.jishuType  = jishuType;
            model.ImageURL   = ImageURL;
            model.JishuPath  = JishuPath;

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