예제 #1
0
        protected override void Page_Show()
        {
            pagetitle = "投递文章";
            UserInfo userinfo = GetUserInfo();

            if (userinfo == null)
            {
                ShowError("投递文章", "请登录后再投递文章,谢谢~", "", "login.aspx");
            }
            columnlist = Columns.GetColumnCollection();
            if (YRequest.IsPost())
            {
                int    columnid = YRequest.GetInt("columnid", 0);
                string title    = Utils.RemoveHtml(YRequest.GetString("title"));
                string summary  = Utils.RemoveHtml(YRequest.GetString("summary"));
                string content  = Utils.RemoveUnsafeHtml(YRequest.GetString("content"));

                ArticleInfo articleinfo = new ArticleInfo();
                articleinfo.Columnid = columnid;
                articleinfo.Title    = title;
                //articleinfo.Highlight = ddlHightlight.SelectedValue;
                articleinfo.Summary  = summary.Length > 160 ? summary.Substring(0, 159) : summary;
                articleinfo.Content  = content;
                articleinfo.Postdate = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                articleinfo.Uid      = userinfo.Uid;
                articleinfo.Username = userinfo.Username;
                Articles.CreateArticle(articleinfo);
                Articles.RemoveArtilceCache();
                ShowMsg("投递文章", "发布成功,跳转到栏目列表.", "", string.Format("showcolumn-{0}-1.aspx", articleinfo.Columnid));
            }
        }
예제 #2
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ArticleInfo articleinfo = new ArticleInfo();

            articleinfo.Columnid  = Convert.ToInt32(ddlColumns.SelectedValue);
            articleinfo.Title     = tbxTitle.Text.Trim();
            articleinfo.Highlight = ddlHightlight.SelectedValue;
            articleinfo.Summary   = tbxSummary.Text.TrimEnd();
            articleinfo.Content   = tbxContent.Text.TrimEnd();
            articleinfo.Postdate  = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            articleinfo.Recommend = Convert.ToInt32(ckbxRecommand.Checked);
            articleinfo.Uid       = userinfo.Uid;
            articleinfo.Username  = userinfo.Username;
            if (articleid > 0)
            {
                articleinfo.Articleid = articleid;
                Articles.EditArticle(articleinfo);
            }
            else
            {
                Articles.CreateArticle(articleinfo);
            }
            Articles.RemoveArtilceCache();

            ShowMsg("文章管理", "文章提交成功.", "", "articlelist.aspx?cid=" + articleinfo.Columnid, true);
            //Response.Redirect("articlelist.aspx?cid=" + articleinfo.Columnid);
        }
예제 #3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ArticleInfo articleinfo = new ArticleInfo();

            articleinfo.Columnid  = Convert.ToInt32(ddlColumns.SelectedValue);
            articleinfo.Title     = tbxTitle.Text.Trim();
            articleinfo.Highlight = ddlHightlight.SelectedValue;
            articleinfo.Content   = tbxContent.Text.TrimEnd();
            articleinfo.Postdate  = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            articleinfo.Uid       = 1;
            articleinfo.Username  = "******";
            if (articleid > 0)
            {
                articleinfo.Articleid = articleid;
                Articles.EditArticle(articleinfo);
            }
            else
            {
                Articles.CreateArticle(articleinfo);
            }
            Response.Redirect("articlelist.aspx?cid=" + articleinfo.Columnid);
        }