コード例 #1
0
ファイル: passage.aspx.cs プロジェクト: Liby99/FORMS_WEB
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["a"] != null)
        {
            Article article = new Article(Request["a"]);
            if (article.Exists)
            {
                this.article = article;
                this.OtherArticle = generateOtherArticle();
                this.CommentAmount = Int32.Parse(SqlHelper.GetDataSet("SELECT COUNT([ID]) AS [amount] FROM [comment] WHERE [AUID] = '" + article.AUID + "' AND [status] = 1").Tables[0].Rows[0]["amount"].ToString());
                this.Comments = generateComment();

                if (CommentAmount == 0)
                {
                    MoreComment = "<div class=\"no-comment\">当前没有评论</div>";
                }
                else if (HasCommentAmount < CommentAmount)
                {
                    MoreComment = "<div class=\"more-comment\" onclick=\"loadMoreComments()\"><i class=\"fa fa-repeat\"></i>加载更多评论</div>";
                }
                else
                {
                    MoreComment = "";
                }

                if (Context.Session["UUID"] != null)
                {
                    WriteComment = "<div class=\"button\" id=\"submit\" onclick=\"submitComment()\">提交</div>";
                }
                else
                {
                    WriteComment = "<div class=\"button\" onclick=\"toggleLoginPanel()\">请先登录</div>";
                }

                article.AddRead();
            }
            else
            {
                Context.Response.Redirect("article.aspx");
            }
        }
        else
        {
            Context.Response.Redirect("article.aspx");
        }
    }