当前位置: 首页>>代码示例>>C#>>正文


C# DataLayer.GetStickyTopics方法代码示例

本文整理汇总了C#中DataLayer.GetStickyTopics方法的典型用法代码示例。如果您正苦于以下问题:C# DataLayer.GetStickyTopics方法的具体用法?C# DataLayer.GetStickyTopics怎么用?C# DataLayer.GetStickyTopics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DataLayer的用法示例。


在下文中一共展示了DataLayer.GetStickyTopics方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["board"] != null)
        {
            int iBoardID = Convert.ToInt32(Request.QueryString["board"]);
            int iPageNumber = 0;
            if (Request.QueryString["p"] != null)
            {
                iPageNumber = Convert.ToInt32(Request.QueryString["p"]);
            }
            if (!User.Identity.IsAuthenticated)
            {
                Session["resultColor"] = "#ff0000";
                Session["resultTitle"] = "Members Only";
                Session["resultMessage"] = "This is a members only area.<br />You must log in first.";
                Session["resultReturnURL"] = "Topics.aspx?board=" + iBoardID.ToString();
                Response.Redirect("Result.aspx", true);
            }

            hlAddTopic.NavigateUrl = "AddEditTopic.aspx?board=" + iBoardID.ToString();
            hlAddTopic2.NavigateUrl = "AddEditTopic.aspx?board=" + iBoardID.ToString();
            DataLayer dl = new DataLayer();
            int iMaxPages = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(dl.GetTopicCountBy_BoardID(iBoardID)) / 15m));
            pageNav1.NumPages = iMaxPages;
            pageNav2.NumPages = iMaxPages;
            DataTable dtBoard = dl.GetForumBoardBy_BoardID(iBoardID);
            boardtitle.InnerText = dtBoard.Rows[0].ItemArray[1].ToString();
            this.Title = dtBoard.Rows[0].ItemArray[1].ToString();
            if (Convert.ToBoolean(dtBoard.Rows[0].ItemArray[3]))
            {
                hlAddTopic.Visible = false;
                hlAddTopic2.Visible = false;
            }
            DataTable dtTopics = dl.GetFifteenTopicsBy_Page(iPageNumber, iBoardID);
            DataTable dtStickyTopics = dl.GetStickyTopics(iBoardID);

            if (dtStickyTopics.Rows.Count > 0)
            {
                stickypanel.Visible = true;
            }
            else
            {
                stickypanel.Visible = false;
            }

            bool bColored = true;
            foreach (DataRow dr in dtStickyTopics.Rows)
            {
                stickytopics.Controls.Add(new LiteralControl("<div style=\"background-color:"));
                if (bColored)
                {
                    stickytopics.Controls.Add(new LiteralControl("#CCDDCC"));
                    bColored = false;
                }
                else
                {
                    stickytopics.Controls.Add(new LiteralControl("#ffffff"));
                    bColored = true;
                }
                int iNumReplies = dl.GetReplyCountBy_TopicID(Convert.ToInt32(dr.ItemArray[0]));
                stickytopics.Controls.Add(new LiteralControl(";padding:10px;\"><a style=\"font-size:20px;\" href=\"Topic.aspx?topic=" + dr.ItemArray[0].ToString() + "\">" + dr.ItemArray[4].ToString() + "</a><b>&nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;" + iNumReplies.ToString() + " replies</b><br /><div style=\"font-size:13px;\">Posted by <a href=\"Profile.aspx?member=" + dr.ItemArray[2].ToString() + "\">" + dl.GetFullMemberNameBy_Email(dr.ItemArray[2].ToString()) + "</a> on " + dr.ItemArray[3].ToString()));
                if (iNumReplies > 0)
                {
                    DataTable dtLastReply = dl.GetLastTopicReplyBy_TopicID(Convert.ToInt32(dr.ItemArray[0]));
                    stickytopics.Controls.Add(new LiteralControl("&nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;last reply by <a href=\"Profile.aspx?member=" + dtLastReply.Rows[0].ItemArray[0].ToString() + "\">" + dl.GetFullMemberNameBy_Email(dtLastReply.Rows[0].ItemArray[0].ToString()) + "</a> on " + dtLastReply.Rows[0].ItemArray[1].ToString()));
                }
                stickytopics.Controls.Add(new LiteralControl("</div></div>"));
            }

            if (dtTopics.Rows.Count == 0)
            {
                if (Convert.ToBoolean(dtBoard.Rows[0].ItemArray[3]))
                {
                    topics.Controls.Add(new LiteralControl("<div style=\"padding:10px;background-color:#CCDDCC;font-size:20px;\">No Topics.</div>"));
                }
                else
                {
                    topics.Controls.Add(new LiteralControl("<div style=\"padding:10px;background-color:#CCDDCC;font-size:20px;\">No Topics. <a href=\"AddEditTopic.aspx?board=" + iBoardID.ToString() + "\">Click here</a> to create a topic of your own.</div>"));
                }
            }

            bColored = true;
            foreach (DataRow dr in dtTopics.Rows)
            {
                topics.Controls.Add(new LiteralControl("<div style=\"background-color:"));
                if (bColored)
                {
                    topics.Controls.Add(new LiteralControl("#CCDDCC"));
                    bColored = false;
                }
                else
                {
                    topics.Controls.Add(new LiteralControl("#ffffff"));
                    bColored = true;
                }
                int iNumReplies = dl.GetReplyCountBy_TopicID(Convert.ToInt32(dr.ItemArray[0]));
                topics.Controls.Add(new LiteralControl(";padding:10px;\"><a style=\"font-size:20px;\" href=\"Topic.aspx?topic=" + dr.ItemArray[0].ToString() + "\">" + dr.ItemArray[4].ToString() + "</a><b>&nbsp;&nbsp;&nbsp;<b>|</b>&nbsp;&nbsp;&nbsp;" + iNumReplies.ToString() + " replies</b><br /><div style=\"font-size:13px;\">Posted by <a href=\"Profile.aspx?member=" + dr.ItemArray[2].ToString() + "\">" + dl.GetFullMemberNameBy_Email(dr.ItemArray[2].ToString()) + "</a> on " + dr.ItemArray[3].ToString()));
                if (iNumReplies > 0)
                {
                    DataTable dtLastReply = dl.GetLastTopicReplyBy_TopicID(Convert.ToInt32(dr.ItemArray[0]));
//.........这里部分代码省略.........
开发者ID:chevex-archived,项目名称:ReferralNetworX,代码行数:101,代码来源:Topics.aspx.cs


注:本文中的DataLayer.GetStickyTopics方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。