Exemplo n.º 1
0
        public static string BuildContentOtherItem(List <NewsInfo> oList, int numColum, int iCurent)
        {
            //var oData = CacheController.GetListNewsOtherColumn(oList[0].fk_CategoryId, numColum, iCurent);
            #if !DEBUG
            var oData = CacheController.GetListNewsOtherColumn(oList[0].fk_CategoryId, iCurent);
            if (oData != null)
            {
                return(oData.ToString());
            }
            #endif
            StringBuilder[] sb = new StringBuilder[numColum];
            int             i  = 0;
            for (i = 0; i < sb.Length; i++)
            {
                sb[i] = new StringBuilder();
            }

            foreach (NewsInfo o in oList)
            {
                if (o.pk_Id != iCurent)
                {
                    sb[i % numColum].AppendFormat("<li><a href=\"/Tin-Tuc/{0}/{1}.html\">{2}</a></li>", o.pk_Id, UnicodeUtility.UrlRewriting(o.s_Title), o.s_Title);
                    i++;
                }
            }

            string s = "";
            for (i = 0; i < numColum; i++)
            {
                if (i == numColum - 1)
                {
                    s += "<ul class=\"tinkhac_phai\">" + sb[i].ToString() + "</ul>";
                }
                else
                {
                    s += "<ul class=\"tinkhac_trai\">" + sb[i].ToString() + "</ul>";
                }
            }
            s = "<h2>Các bản tin khác:</h2>" + s;
            //CacheController.GetListNewsOtherColumn(oList[0].fk_CategoryId, numColum, iCurent, s);
            #if !DEBUG
            CacheController.GetListNewsOtherColumn(oList[0].fk_CategoryId, iCurent, s);
            #endif
            return(s);
        }