Пример #1
0
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            ArticleInfo article = new ArticleInfo();

            article.ID       = RequestHelper.GetQueryString <int>("ID");
            article.Title    = this.Title.Text;
            article.ClassID  = ArticleClassBLL.ReadArticleClassFullFatherID(Convert.ToInt32(this.ClassID.Text));
            article.IsTop    = Convert.ToInt32(this.IsTop.Text);
            article.Author   = this.Author.Text;
            article.Resource = this.Resource.Text;
            article.Keywords = this.Keywords.Text;
            article.Url      = this.Url.Text;
            article.Photo    = this.Photo.Text;
            article.Summary  = this.Summary.Text;
            article.Content  = this.Content.Value;
            article.Date     = RequestHelper.DateNow;
            string alertMessage = ShopLanguage.ReadLanguage("AddOK");

            if (article.ID == -2147483648)
            {
                base.CheckAdminPower("AddArticle", PowerCheckType.Single);
                int id = ArticleBLL.AddArticle(article);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Article"), id);
            }
            else
            {
                base.CheckAdminPower("UpdateArticle", PowerCheckType.Single);
                ArticleBLL.UpdateArticle(article);
                AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Article"), article.ID);
                alertMessage = ShopLanguage.ReadLanguage("UpdateOK");
            }
            AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl);
        }
Пример #2
0
 protected void btSubmit_ServerClick(object sender, EventArgs e)
 {
     if (Request["op"] == "edit")
     {
         InfoItem article = new InfoItem();
         article.Infoid     = Convert.ToInt32(curArtId.Value);
         article.Infoclass  = Convert.ToInt32(curClsSn.Value);
         article.Infogroup  = Convert.ToInt32(curGrpSn.Value);
         article.Title      = Request[tbTitle.UniqueID];
         article.Summary    = Request[tbSummary.UniqueID];
         article.Content    = Request[hfEditor.UniqueID];
         article.Infostatus = Convert.ToInt32(Request[rblPublish.UniqueID]);
         article.Author     = Request[tbAuthor.UniqueID];
         if (!string.IsNullOrEmpty(ipNewsDate.Value))
         {
             article.Happendate = articleConverter.DateStringToValueConverter(ipNewsDate.Value);
         }
         article.Credate = Convert.ToInt64(Request[tbCreDate.UniqueID]);
         if (ibll.UpdateArticle(article))
         {
             MessageBox("修改成功!", "提示", MSGBOX.SUCCESS);
             //Util.MessageBox.Show(this, "修改成功!");
         }
         else
         {
             MessageBox("修改失败!", "提示", MSGBOX.ERROR);
             //Util.MessageBox.Show(this, "修改失败!");
         }
     }
     else if (Request["op"] == "new")
     {
         InfoItem a       = new InfoItem();
         int      classsn = cls.Sn;
         int      groupsn = cls.Group;
         a.Infoclass = classsn;
         a.Infogroup = groupsn;
         a.Title     = tbTitle.Text;
         a.Summary   = tbSummary.Text;
         a.Content   = hfEditor.Value;
         a.Credate   = DateTime.Now.ToFileTime();
         if (!string.IsNullOrEmpty(ipNewsDate.Value))
         {
             a.Happendate = articleConverter.DateStringToValueConverter(ipNewsDate.Value);
         }
         a.Infostatus = Convert.ToInt32(rblPublish.SelectedValue);
         a.Author     = tbAuthor.Text;
         if (ibll.AddArticle(a) > 0)
         {
             MessageBox("添加成功!", "提示", MSGBOX.SUCCESS);
             //Util.MessageBox.Show(this, "添加成功!");
         }
         else
         {
             MessageBox("添加失败!", "提示", MSGBOX.ERROR);
             //Util.MessageBox.Show(this, "添加失败!");
         }
     }
 }