Esempio n. 1
0
        protected void btnok_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.NicheInfo   nichebll   = new Maticsoft.BLL.NicheInfo();
            Maticsoft.Model.NicheInfo nichemodel = nichebll.GetModel(1);
            if (txtNichetitle.Text.Trim() == "")
            {
                lblNicheTitle.Text = "请填写行业标题";
                return;
            }
            nichemodel.NicheTitle = txtNichetitle.Text.Trim();
            lblNicheTitle.Text    = "";
            if (txtKeyword.Text.Trim() == "")
            {
                lblKeyword.Text = "请填写关键词";
                return;
            }
            nichemodel.NicheKey = txtKeyword.Text.Trim();
            lblKeyword.Text     = "";
            try
            {
                nichemodel.NicheTypeID = int.Parse(drpNicheType.SelectedValue);
            }
            catch (Exception e1)
            { }
            if (txtwrote.Text.Trim() == "")
            {
                lblNichewrite.Text = "请填写发布人";
                return;
            }
            nichemodel.Write   = txtwrote.Text.Trim();
            lblNichewrite.Text = "";
            if (txtfatime.Text.Trim() == "")
            {
                lblfatime.Text = "请填写发布时间";
            }
            nichemodel.Fatime   = Convert.ToDateTime(txtfatime.Text.Trim());
            lblfatime.Text      = "";
            nichemodel.ImageURL = Image1.ImageUrl;

            nichemodel.NicheContent = txtNichecontent.Text.Trim();
            nichebll.Update(nichemodel);
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('信息添加成功!')</script>");
            bind();
        }
Esempio n. 2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtNicheTitle.Text.Trim().Length == 0)
            {
                strErr += "NicheTitle不能为空!\\n";
            }
            if (this.txtNicheKey.Text.Trim().Length == 0)
            {
                strErr += "NicheKey不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtFatime.Text))
            {
                strErr += "Fatime格式错误!\\n";
            }
            if (this.txtWrite.Text.Trim().Length == 0)
            {
                strErr += "Write不能为空!\\n";
            }
            if (this.txtImageURL.Text.Trim().Length == 0)
            {
                strErr += "ImageURL不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtNicheTypeID.Text))
            {
                strErr += "NicheTypeID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtHitNum.Text))
            {
                strErr += "HitNum格式错误!\\n";
            }
            if (this.txtNicheContent.Text.Trim().Length == 0)
            {
                strErr += "NicheContent不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      NicheID      = int.Parse(this.lblNicheID.Text);
            string   NicheTitle   = this.txtNicheTitle.Text;
            string   NicheKey     = this.txtNicheKey.Text;
            DateTime Fatime       = DateTime.Parse(this.txtFatime.Text);
            string   Write        = this.txtWrite.Text;
            string   ImageURL     = this.txtImageURL.Text;
            int      NicheTypeID  = int.Parse(this.txtNicheTypeID.Text);
            int      HitNum       = int.Parse(this.txtHitNum.Text);
            string   NicheContent = this.txtNicheContent.Text;


            Maticsoft.Model.NicheInfo model = new Maticsoft.Model.NicheInfo();
            model.NicheID      = NicheID;
            model.NicheTitle   = NicheTitle;
            model.NicheKey     = NicheKey;
            model.Fatime       = Fatime;
            model.Write        = Write;
            model.ImageURL     = ImageURL;
            model.NicheTypeID  = NicheTypeID;
            model.HitNum       = HitNum;
            model.NicheContent = NicheContent;

            Maticsoft.BLL.NicheInfo bll = new Maticsoft.BLL.NicheInfo();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }