Example #1
0
        public static string BuildContentListItem(List <NewsInfo> oList)
        {
            var oData = CacheController.GetListNews(oList[0].fk_CategoryId);

            if (oData != null)
            {
                return(oData.ToString());
            }

            var sb = new StringBuilder();

            foreach (NewsInfo o in oList)
            {
                sb.AppendFormat("<div class=\"top_content clearfix\">");
                sb.AppendFormat("<div class=\"thumbnail floatLeft\">");
                //sb.AppendFormat("<a href=\"/News.aspx?ID={0}\"><img width=\"105\" alt=\"\" src=\"{1}\"></a>", o.pk_Id, UntilityFunction.GetPathImgThumb(o.s_Image));
                sb.AppendFormat("<a href=\"/News/{0}/{1}.html\"><img width=\"105\" alt=\"{3}\" src=\"{2}\"></a>", o.pk_Id, UnicodeUtility.UrlRewriting(o.s_Title), UntilityFunction.GetPathImgThumb(o.s_Image), o.s_Title);
                sb.AppendFormat("</div>");
                sb.AppendFormat("<div class=\"title floatLeft\" style=\"margin-top: 5px;\">");
                //sb.AppendFormat("<a href=\"/News.aspx?ID={0}\"><h4>{1}</h4></a>", o.pk_Id, o.s_Title);
                sb.AppendFormat("<a href=\"/News/{0}/{1}.html\"><h4>{2}</h4></a>", o.pk_Id, UnicodeUtility.UrlRewriting(o.s_Title), o.s_Title);

                sb.AppendFormat("</div>");
                sb.AppendFormat("<div class=\"introtext floatLeft\">");
                sb.AppendFormat("<p>{0}</p>", o.s_Description);
                sb.AppendFormat("</div>");
                sb.AppendFormat("<div style=\"float:right\"><a class=\"readmore clearfix floatRight\" style=\"padding-right:10px\" href=\"/News/{0}/{1}.html\">Chi tiết &gt;&gt;</a></div>", o.pk_Id, UnicodeUtility.UrlRewriting(o.s_Title));
                sb.AppendFormat("</div>");
            }
            string s = sb.ToString();

            CacheController.GetListNews(oList[0].fk_CategoryId, s);
            return(s);
        }
Example #2
0
        public static string BuildNewTop(List <NewsInfo> list)
        {
            #if !DEBUG
            var oData = CacheController.GetListNews(list[0].pk_Id);
            if (oData != null)
            {
                return(oData.ToString());
            }
            #endif
            var oData = CacheController.GetListNews(list[0].pk_Id);
            if (oData != null)
            {
                return(oData.ToString());
            }

            var sb = new StringBuilder();
            sb.AppendFormat("<img class=\"anhnoibat\" src=\"{0}\" width=\"95\" alt=\"{1}\" title=\"\"/>", UntilityFunction.GetPathImgThumb(list[0].s_Image), list[0].s_Title);
            sb.AppendFormat("<a class=\"tieude\" href=\"/Tin-Tuc/{0}/{1}.html\">{2}</a>", list[0].pk_Id, UnicodeUtility.UrlRewriting(list[0].s_Title), list[0].s_Title);
            sb.AppendFormat("<p>{0}</p>", list[0].s_Description);

            sb.Append("<div class=\"clear\"></div><ul>");
            for (int i = 1; i < list.Count; i++)
            {
                NewsInfo entity = list[i];
                sb.AppendFormat("<li><a href=\"/Tin-Tuc/{0}/{1}.html\">{2}</a></li>", entity.pk_Id, UnicodeUtility.UrlRewriting(entity.s_Title), entity.s_Title);
            }
            sb.Append("</ul>");
            //sb.AppendFormat("<td><a href=\"{0}\"><img border=\"0\" src=\"{1}\"></a></td>", o.s_Homepage, o.s_Logo);
            string s = sb.ToString();
            #if !DEBUG
            CacheController.GetListNews(list[0].pk_Id, s);
            #endif
            return(s);
        }
Example #3
0
 public static string BuildNewCuHon(List <NewsInfo> list)
 {
     #if !DEBUG
     var oData = CacheController.GetListNews(list[0].pk_Id);
     if (oData != null)
     {
         return(oData.ToString());
     }
     #endif
     var sb = new StringBuilder();
     for (int i = 0; i < list.Count; i++)
     {
         NewsInfo entity = list[i];
         sb.Append("<div class=\"box_tincuhon\">");
         sb.AppendFormat("<img src=\"{0}\" width=\"120\" alt=\"{1}\" title=\"\"/>", UntilityFunction.GetPathImgThumb(entity.s_Image), entity.s_Title);
         sb.AppendFormat("<a href=\"/Tin-Tuc/{0}/{1}.html\">{2}</a>", entity.pk_Id, UnicodeUtility.UrlRewriting(entity.s_Title), entity.s_Title);
         sb.AppendFormat("<span>{0} | {1}</span>", entity.d_DateCreated.ToString("hh:mm"), entity.d_DateCreated.ToString("dd/MM/yyyy"));
         sb.AppendFormat("<div style=\"text-align:justify\">{0}</div>", entity.s_Description);
         sb.Append("</div>");
         sb.Append("<div class=\"clear\"></div>");
     }
     string s = sb.ToString();
     #if !DEBUG
     CacheController.GetListNews(list[0].pk_Id, s);
     #endif
     return(s);
 }
Example #4
0
        public static string BuildContentListItem(List <NewsInfo> oList)
        {
            var oData = CacheController.GetListNews(oList[0].fk_CategoryId);

            if (oData != null)
            {
                return(oData.ToString());
            }

            var sb = new StringBuilder();

            foreach (NewsInfo o in oList)
            {
                sb.AppendFormat("<li><a href=\"/News/{0}/{1}.html\">{2}</a></li>", o.pk_Id, UnicodeUtility.UrlRewriting(o.s_Title), o.s_Title);
            }
            string s = sb.ToString();

            CacheController.GetListNews(oList[0].fk_CategoryId, s);
            return(s);
        }
Example #5
0
 public static string BuildNewQuangCao(List <NewsInfo> list)
 {
     #if !DEBUG
     var oData = CacheController.GetListNews(list[0].pk_Id);
     if (oData != null)
     {
         return(oData.ToString());
     }
     #endif
     var sb = new StringBuilder();
     for (int i = 0; i < list.Count; i++)
     {
         NewsInfo entity = list[i];
         sb.Append("<div class=\"box_tingannhat\">");
         sb.AppendFormat("<img src=\"{0}\" width=\"68\" alt=\"{1}\" title=\"\"/>", UntilityFunction.GetPathImgThumb(entity.s_Image), entity.s_Title);
         sb.AppendFormat("<a href=\"/Tin-Tuc/{0}/{1}.html\">{2}</a>", entity.pk_Id, UnicodeUtility.UrlRewriting(entity.s_Title), entity.s_Title);
         sb.Append("</div>");
     }
     string s = sb.ToString();
     #if !DEBUG
     CacheController.GetListNews(list[0].pk_Id, s);
     #endif
     return(s);
 }
Example #6
0
 public static string BuildNewCuHonPhai(List <NewsInfo> list)
 {
     #if !DEBUG
     var oData = CacheController.GetListNews(list[0].pk_Id);
     if (oData != null)
     {
         return(oData.ToString());
     }
     #endif
     var sb = new StringBuilder();
     for (int i = 0; i < list.Count; i++)
     {
         NewsInfo entity = list[i];
         if (i % 2 != 0)
         {
             sb.AppendFormat("<li><a href=\"/Tin-Tuc/{0}/{1}.html\">{2}</a></li>", entity.pk_Id, UnicodeUtility.UrlRewriting(entity.s_Title), entity.s_Title);
         }
     }
     string s = sb.ToString();
     #if !DEBUG
     CacheController.GetListNews(list[0].pk_Id, s);
     #endif
     return(s);
 }
Example #7
0
        public static string BuildContentListItem(List <NewsInfo> oList, int index)
        {
            var oData = CacheController.GetListNews(oList[0].fk_CategoryId, index);

            if (oData == null)
            {
                string[] aA = new string[2];
                int      n  = oList.Count;
                int      i;
                int      iCurent = oList[0].pk_Id;
                for (i = 1; i < n; i++)
                {
                    if (oList[i].pk_Id == index)
                    {
                        iCurent = oList[i].pk_Id;
                    }
                }
                StringBuilder   sb  = new StringBuilder();
                StringBuilder[] osb = new StringBuilder[n - 1];

                if (n <= 1)
                {
                    osb[0] = new StringBuilder();
                }
                else
                {
                    for (i = 0; i < n - 1; i++)
                    {
                        osb[i] = new StringBuilder();
                    }
                }

                i = 0;
                foreach (NewsInfo o in oList)
                {
                    if (o.pk_Id == iCurent)
                    {
                        sb.AppendFormat("<div><h2>{0}</h2>", o.s_Title);
                        sb.AppendFormat("<p style=\"padding-left: 10px;text-align:justify\">{0}</p>", o.s_Description);
                        sb.AppendFormat("<img style=\"padding-top: 5px; padding-bottom: 5px;\" alt=\"\" src=\"/images/line1dau.jpg\"></div>");
                        sb.AppendFormat("<div><div style=\"padding: 0px\"><div style=\"margin:0px 10px 10px 0px; float: left\">");
                        //sb.AppendFormat("<script>DrawImgSize('{0}')</script></div>",
                        sb.AppendFormat("<img alt=\"ảnh bài viết\" class=\"block\" style=\"width:180px; display:block; margin:5px auto;\" src=\"{0}\" /></div>", UntilityFunction.GetPathImg(o.s_Image));
                        sb.AppendFormat("<p style=\"text-align:justify\">{0}</p></div>", o.s_Content);
                        sb.Append("<div style=\"clear:both\"></div></div>");
                    }
                    else
                    {
                        osb[i].AppendFormat("<div id=\"sumenh{0}\">", i + 1);
                        osb[i].AppendFormat("<a href=\"/Gioi-Thieu/{0}/{1}.html\" class=\"tieudesumenh\">{2}</a>",
                                            o.pk_Id, UnicodeUtility.UrlRewriting(o.s_Title), o.s_Title);
                        osb[i].AppendFormat("<p style=\"padding-top: 0px;text-align:justify\">{0}</p>", o.s_Description);
                        osb[i].AppendFormat(
                            "<a class=\"chitiet\" href=\"/Gioi-Thieu/{0}/{1}.html\"><span class=\"chitietsm{2}\"></span><em>chi tiết</em><span class=\"chitietsm{2}\"></span></a>",
                            o.pk_Id, UnicodeUtility.UrlRewriting(o.s_Title), i + 1);
                        osb[i].AppendFormat("</div>");
                        i++;
                    }
                }
                string s = sb.ToString() + "<div id=\"gioithieu3\" class=\"block\">";
                foreach (var oS in osb)
                {
                    s += oS.ToString();
                }
                s += "<div style=\"clear:both\"></div></div>";
                CacheController.GetListNews(oList[0].fk_CategoryId, index, s);
                return(s);
            }
            else
            {
                string s = oData.ToString();
                return(s);
            }
        }