コード例 #1
0
        //上一篇、下一篇
        private void BindPrevAndNextNews()
        {
            StringBuilder sb = new StringBuilder();

            DataTable tbPrev = newsBll.GetPrevData(newsID);
            DataTable tbNext = newsBll.GetNextData(newsID);

            if (tbPrev.Rows.Count == 0)
            {
                sb.Append("<div class='prevLink'>上一篇:<a>没有上一篇</a></div>");
            }
            else
            {
                int tmpNewsClassId = Int32.Parse(tbPrev.Rows[0]["newsClassId"].ToString());

                sb.AppendFormat("<div class='prevLink'>上一篇:<a href='{5}/{0}/{1}.html' title='{2}'>{3}</a><span>({4})</span></div>",
                                Enum.GetName(typeof(SysConfig.NewsClassPY), tmpNewsClassId),
                                tbPrev.Rows[0]["ID"].ToString(),
                                tbPrev.Rows[0]["Title"].ToString(),
                                Function.Clip(tbPrev.Rows[0]["Title"].ToString(), 20, true),
                                Function.ToSortTime(Convert.ToDateTime(tbPrev.Rows[0]["CreatedTime"])),
                                SysConfig.webSite);
            }

            if (tbNext.Rows.Count == 0)
            {
                sb.Append("<div class='nextLink'>下一篇:<a>没有下一篇</a></div>");
            }
            else
            {
                int tmpNewsClassId = Int32.Parse(tbNext.Rows[0]["newsClassId"].ToString());

                sb.AppendFormat("<div class='nextLink'>下一篇:<a href='{5}/{4}/{0}.html' title='{3}'>{1}</a><span>({2})</span></div>",
                                tbNext.Rows[0]["ID"].ToString(),
                                Function.Clip(tbNext.Rows[0]["Title"].ToString(), 20, true),
                                Function.ToSortTime(Convert.ToDateTime(tbNext.Rows[0]["CreatedTime"])),
                                tbNext.Rows[0]["Title"].ToString(),
                                Enum.GetName(typeof(SysConfig.NewsClassPY), tmpNewsClassId),
                                SysConfig.webSite);
            }
            prevAndNexLink = sb.ToString();
        }
コード例 #2
0
        //上一篇、下一篇
        private void BindPrevAndNextNews()
        {
            StringBuilder sb = new StringBuilder();

            DataTable tbPrev = newsBll.GetPrevData(newsID);
            DataTable tbNext = newsBll.GetNextData(newsID);

            if (tbPrev.Rows.Count == 0)
            {
                sb.Append("<div>上一篇:<a href='#' target='_blank'>没有上一篇</a></div>");
            }
            else
            {
                int tmpNewsClassId = Int32.Parse(tbPrev.Rows[0]["newsClassId"].ToString());

                sb.AppendFormat("<div>上一篇:<a href='{4}/mip/{0}/{1}.html' title='{2}' target='_blank'>{3}</a></div>",
                                Enum.GetName(typeof(SysConfig.NewsClassPY), tmpNewsClassId),
                                tbPrev.Rows[0]["ID"].ToString(),
                                tbPrev.Rows[0]["Title"].ToString(),
                                Function.Clip(tbPrev.Rows[0]["Title"].ToString(), 20, true),
                                SysConfig.webSiteApp);
            }

            if (tbNext.Rows.Count == 0)
            {
                sb.Append("<div>下一篇:<a href='#' target='_blank'>没有下一篇</a></div>");
            }
            else
            {
                int tmpNewsClassId = Int32.Parse(tbNext.Rows[0]["newsClassId"].ToString());

                sb.AppendFormat("<div>下一篇:<a href='{4}/mip/{3}/{0}.html' title='{2}' target='_blank'>{1}</a></div>",
                                tbNext.Rows[0]["ID"].ToString(),
                                Function.Clip(tbNext.Rows[0]["Title"].ToString(), 20, true),
                                tbNext.Rows[0]["Title"].ToString(),
                                Enum.GetName(typeof(SysConfig.NewsClassPY), tmpNewsClassId),
                                SysConfig.webSiteApp);
            }
            prevAndNexLink = sb.ToString();
        }