Ejemplo n.º 1
0
        private string GetRecommend()
        {
            string    sDiv        = string.Empty;
            int       iDescLength = 108;
            DataTable dt          = new DAL.CategoryDAL().GetRecommendZT(sCategoryPath, iYIndex + 1);

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataTable dtArticle = new DAL.Article().GetArticleList(dt.Rows[i]["CategoryGUID"].ToString(), false, 4);
                string    sTitle    = dt.Rows[i]["CategoryName"].ToString();
                string    sContent  = new DAL.CategoryDAL().GetZTSummaryFromTitle(sZTSummaryAlias, sTitle);


                sContent = DAL.Article.RemoveHtml(sContent);
                string sDesc = sContent;
                if (sContent.Length > iDescLength)
                {
                    sContent = sContent.Substring(0, iDescLength);
                    sDesc    = sDesc.Remove(0, iDescLength);
                    if (sDesc.StartsWith(">"))
                    {
                        sDesc.Remove(0, 1);
                    }
                }
                else
                {
                    sDesc = string.Empty;
                }

                sDiv += "<div class=\"SpecialAttentionLeftCommendItem\">";
                sDiv += "<div class=\"SpecialAttentionNewLeft\">";
                sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" title=\"{2}\" target=\"_blank\">", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle);
                sDiv += "<img width=\"158\" height=\"118\" src=\"ShowZTImage.aspx?Title=" + HttpUtility.UrlEncode(sTitle) + "\" alt=\"\" border=\"0\" /></a>";
                sDiv += "</div>";
                sDiv += "<div class=\"SpecialAttentionNewRightL\">";
                sDiv += "<div class=\"SpecialAttentionNewTitleL\">";
                sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" target=\"_blank\">{2}</a></div>", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle);
                sDiv += string.Format("<div class=\"ZTSummary\" data-tooltip=\"{0}\" data-placement=\"bottom\">", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc));
                sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" target=\"_blank\">", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle)) + sContent + "</a>";
                sDiv += "</div><table class=\"SpecialAttentionNewTableL\" style=\"table-layout:fixed;\"  width=\"465\">";
                if (dtArticle.Rows.Count > 0)
                {
                    for (int j = 0; j < dtArticle.Rows.Count; j++)
                    {
                        if (j % 2 == 0)
                        {
                            sDiv += "<tr>";
                        }
                        sDiv += "<td class=\"SpecialAttentionNewTableTitleL\" style=\"overflow:hidden;text-overflow:ellipsis;white-space:nowrap;\"  width=\"48%\">";
                        sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{1}</a></td>", dtArticle.Rows[j]["ArticleGUID"].ToString(), dtArticle.Rows[j]["Title"].ToString());
                        if (j % 2 == 1)
                        {
                            sDiv += "</tr>";
                        }
                    }
                }
                sDiv += "</table></div></div>";
            }
            return(sDiv);
        }
Ejemplo n.º 2
0
        private string GetLevel2Top()
        {
            //专题标题
            string sTitle = Request.Form["Title"];
            //专题简介
            int    iDescLength = 144;
            string sContent    = new DAL.CategoryDAL().GetZTSummaryFromTitle(sZTSummaryAlias, sTitle);

            sContent = DAL.Article.RemoveHtml(sContent);
            string sDesc = sContent;

            if (sContent.Length > iDescLength)
            {
                sContent = sContent.Substring(0, iDescLength);
                sDesc    = sDesc.Remove(0, iDescLength);
                if (sDesc.StartsWith(">"))
                {
                    sDesc = sDesc.Remove(0, 1);
                }
            }
            //核心观点
            DataTable dt1 = new DAL.CategoryDAL().GetArticleIndexList(sCategoryPath, "核心观点", 2, false);
            //最新动态
            DataTable dt2 = new DAL.CategoryDAL().GetArticleIndexList(sCategoryPath, "最新动态", 2, false);

            string sDiv = "";

            sDiv += string.Format("<div class=\"ZTLevel2ContentRightCenterTitle\">{0}</div>", sTitle);
            sDiv += string.Format("<div class=\"ZTSummary\"  data-tooltip=\"{0}\" data-placement=\"bottom\">{1}</div>", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc), sContent);
            sDiv += "    <table class=\"SpecialAttentionNewTableXL\">";
            sDiv += "      <tr><td class=\"SpecialAttentionNewTableLineTitle\">核心观点</td>";
            sDiv += "          <td class=\"ZTNewTableTitleXL\">";
            if (dt1.Rows.Count > 0)
            {
                sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a>", dt1.Rows[0]["ArticleGUID"].ToString(), dt1.Rows[0]["Title"].ToString(), DataProcessing.SubstringText(dt1.Rows[0]["Title"].ToString(), 35));
            }
            sDiv += "</td>";
            sDiv += "</tr><tr><td></td><td class=\"ZTNewTableTitleXL\">";
            if (dt1.Rows.Count > 1)
            {
                sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a>", dt1.Rows[1]["ArticleGUID"].ToString(), dt1.Rows[1]["Title"].ToString(), DataProcessing.SubstringText(dt1.Rows[1]["Title"].ToString(), 35));
            }
            sDiv += "</td>";
            sDiv += "</tr><tr><td class=\"SpecialAttentionNewTableXLSpace\"></td></tr><tr><td class=\"SpecialAttentionNewTableLineTitle\">最新动态</td>";
            sDiv += "          <td class=\"ZTNewTableTitleXL\">";
            if (dt2.Rows.Count > 0)
            {
                sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a>", dt2.Rows[0]["ArticleGUID"].ToString(), dt2.Rows[0]["Title"].ToString(), DataProcessing.SubstringText(dt2.Rows[0]["Title"].ToString(), 35));
            }
            sDiv += "</td>";
            sDiv += "</tr><tr><td></td><td class=\"ZTNewTableTitleXL\">";
            if (dt2.Rows.Count > 1)
            {
                sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a>", dt2.Rows[1]["ArticleGUID"].ToString(), dt2.Rows[1]["Title"].ToString(), DataProcessing.SubstringText(dt2.Rows[1]["Title"].ToString(), 35));
            }
            sDiv += "</td></tr></table>";
            return(sDiv);
        }
Ejemplo n.º 3
0
        private string GetLastNew()
        {
            int       iDescLength = 110;
            DataTable dt          = new DAL.CategoryDAL().GetLastNewZT(sCategoryPath, iYIndex + 1);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(string.Empty);
            }
            DataTable dtArticle = new DAL.Article().GetArticleList(dt.Rows[0]["CategoryGUID"].ToString(), false, 3);
            string    sTitle    = dt.Rows[0]["CategoryName"].ToString();
            string    sContent  = new DAL.CategoryDAL().GetZTSummaryFromTitle(sZTSummaryAlias, sTitle);


            sContent = DAL.Article.RemoveHtml(sContent);
            string sDesc = sContent;

            if (sContent.Length > iDescLength)
            {
                sContent = sContent.Replace(" ", "");//*CC*
                sContent = sContent.Substring(0, iDescLength);
                sDesc    = sDesc.Remove(0, iDescLength);
                if (sDesc.StartsWith(">"))
                {
                    sDesc.Remove(0, 1);
                }
            }

            string sDiv = "<div class=\"SpecialAttentionNewLeft\">";

            sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" title=\"{2}\" target=\"_blank\">", dt.Rows[0]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle);
            sDiv += "<img width=\"276\" height=\"195\" src=\"ShowZTImage.aspx?Title=" + HttpUtility.UrlEncode(sTitle) + "\" alt=\"\" border=\"0\" /></a>";
            sDiv += "</div><div class=\"SpecialAttentionNewRight\"><div class=\"SpecialAttentionNewTitle\">";
            sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" target=\"_blank\">{2}</a>", dt.Rows[0]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), DataProcessing.SubstringText(sTitle, 19)); //*CC*
            sDiv += "</div>";
            sDiv += string.Format("<div class=\"ZTSummary\" data-tooltip=\"{0}\" data-placement=\"bottom\">", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc));
            sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" target=\"_blank\">", dt.Rows[0]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle)) + sContent + "</a>";
            sDiv += "</div><table class=\"SpecialAttentionNewTable\" style=\"table-layout:fixed;\" width=\"355\">";
            if (dtArticle.Rows.Count > 0)
            {
                for (int i = 0; i < dtArticle.Rows.Count; i++)
                {
                    sDiv += "<tr><td class=\"SpecialAttentionNewTableTitle SpecialAttentionNewTableTitleZTTop\" style=\"overflow:hidden;text-overflow:ellipsis;white-space:nowrap;\">";
                    sDiv += string.Format("<a href=\"ShowVideo.aspx?ID={0}\" title=\"{1}\" target=\"_blank\">{2}</a></td>", dtArticle.Rows[i]["ArticleGUID"].ToString(), dtArticle.Rows[i]["Title"].ToString(), DataProcessing.SubstringText(dtArticle.Rows[i]["Title"].ToString(), 18));//*CC*
                    sDiv += "<td align=\"right\">" + DateTime.Parse(dtArticle.Rows[i]["CreateTime"].ToString()).ToString("yyyy-MM-dd") + "</td></tr>";
                }
            }
            sDiv += "</table></div>";
            return(sDiv);
        }
Ejemplo n.º 4
0
        private string GetHot()
        {
            string sDiv = string.Empty;

            try
            {
                int       iDescLength = 66;
                DataTable dt          = new DAL.CategoryDAL().GetHotZT();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    string sTitle       = dt.Rows[i]["CategoryName"].ToString();
                    string sFixLenTitle = sTitle;
                    if (sFixLenTitle.Length > 17)
                    {
                        sFixLenTitle = sFixLenTitle.Substring(0, 16) + "...";
                    }
                    string sContent = new DAL.CategoryDAL().GetZTSummaryFromTitle(sZTSummaryAlias, sTitle);


                    sContent = DAL.Article.RemoveHtml(sContent);
                    string sDesc = sContent;
                    if (sContent.Length > iDescLength)
                    {
                        sContent = sContent.Substring(0, iDescLength);
                        sDesc    = sDesc.Remove(0, iDescLength);
                        if (sDesc.StartsWith(">"))
                        {
                            sDesc.Remove(0, 1);
                        }
                    }
                    sDiv += "<div class=\"SpecialAttentionRightHotItem\">";
                    sDiv += "<div class=\"SpecialAttentionRightHotItemTitle\">";
                    sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" title=\"{2}\" target=\"_blank\">{3}</a>", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle, sFixLenTitle);
                    sDiv += "</div>";
                    sDiv += "<div class=\"SpecialAttentionRightHotItemLeft\">";
                    sDiv += string.Format("<a href=\"SpecialAttentionLite.aspx?ID={0}&Title={1}\" title=\"{2}\" target=\"_blank\">", dt.Rows[i]["CategoryGUID"].ToString(), HttpUtility.UrlEncode(sTitle), sTitle);
                    sDiv += "<img width=\"118\" height=\"95\" src=\"ShowZTImage.aspx?Title=" + HttpUtility.UrlEncode(sTitle) + "\" alt=\"\" border=\"0\" /></a>";
                    sDiv += "</div>";
                    sDiv += string.Format("<div class=\"ZTSummary\" style=\"width:168px;margin:0 auto;\" data-tooltip=\"{0}\" data-placement=\"bottom\">", string.IsNullOrEmpty(sDesc) ? string.Empty : string.Format("<div class='divTooltip'>{0}</div>", sDesc));
                    sDiv += "<a href=\"ShowSummary.aspx?Title=" + HttpUtility.UrlEncode(sTitle) + "\" target=\"_blank\">" + sContent + "</a>";
                    sDiv += "</div></div>";
                }
            }
            catch { return(string.Empty); }
            return(sDiv);
        }