Пример #1
0
        string RenderHTML()
        {
            if (_Cache.ContainsKey(_IndustryID))
            {
                return(_Cache[_IndustryID]);
            }
            List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0);
            StringBuilder          sb   = new StringBuilder();

            if (_IndustryID == 0)
            {
                return("<div class=\"" + _CssClass + "\"><span>暂无相关行业信息!</span></div>");
            }
            else
            {
                ProductIndustry pi = ProductIndustries.GetProductIndustry(_IndustryID);
                if (pi.ParentID == 0)
                {
                    return("<div class=\"" + _CssClass + "\"><span>此行业为顶级行业分类!</span></div>");
                }
                List <ProductIndustry> pis = ProductIndustries.GetChildIndustries(pi.ParentID);

                if (pis == null || pis.Count == 0 || (pis.Count == 1 && pis[0].IndustryID == _IndustryID))
                {
                    return("<div class=\"" + _CssClass + "\"><span>暂无相关行业信息!</span></div>");
                }
                sb.Append("<div class=\"" + _CssClass + "\">");
                ProductQuery            query;
                int                     count = 0;
                PagingDataSet <Product> __ps  = null;
                foreach (ProductIndustry p in pis)
                {
                    if (p.IndustryID != _IndustryID)
                    {
                        count            = 0;
                        query            = new ProductQuery();
                        query.IndustryID = p.IndustryID;
                        __ps             = Products.GetProducts(query);
                        if (__ps != null && __ps.Records != null)
                        {
                            count = Products.GetProducts(query).Records.Count;
                        }
                        sb.AppendFormat(_href, GlobalSettings.Encrypt(p.IndustryID.ToString()), p.IndustryName + "(" + count + ")");
                    }
                }
                sb.Append("</div>");
                if (!_Cache.ContainsKey(_IndustryID))
                {
                    lock (_lock)
                        if (!_Cache.ContainsKey(_IndustryID))
                        {
                            _Cache.Add(_IndustryID, sb.ToString());
                        }
                }
                return(sb.ToString());
            }
        }
Пример #2
0
        string RenderHTML()
        {
            List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0);
            string nav = GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry";

            if (inds == null || inds.Count == 0)
            {
                return("<div><span>没有显示的行业信息!</span></div>");
            }

            List <ProductIndustry> pis = null;
            ProductIndustry        pi  = null;
            StringBuilder          sb  = new StringBuilder();
            string indId    = null;
            int    curCount = inds.Count;

            inds = inds.GetRange(0, Math.Min(_Max, curCount));
            sb.AppendLine("<table cellpadding=\"0\" cellspacing=\"0\" class=\"" + _CssClass + "\">");
            for (int i = 0; i < inds.Count; i++)
            {
                pi    = inds[i];
                indId = GlobalSettings.Encrypt(pi.IndustryID.ToString());
                if (i % _Columns == 0)
                {
                    sb.AppendLine("<tr>");
                }

                sb.AppendLine("<td>");
                sb.AppendLine("<div><div><a href=\"" + nav + "&ID=" + indId + "\" target=\"_blank\">" + pi.IndustryName + "</a></div></div>");
                pis = ProductIndustries.GetChildIndustries(pi.IndustryID);
                for (int j = 0; j < pis.Count; j++)
                {
                    pi    = pis[j];
                    indId = GlobalSettings.Encrypt(pi.IndustryID.ToString());
                    sb.AppendLine("<a href=\"" + nav + "&ID=" + indId + "\" target=\"_blank\">" + pi.IndustryName + "</a>");
                    if (j != pis.Count - 1)
                    {
                        sb.Append("&nbsp;|&nbsp;");
                    }
                }
                sb.AppendLine("</td>");

                if (i % _Columns == _Columns - 1)
                {
                    sb.AppendLine("</tr>");
                }
            }
            sb.AppendLine("</table>");
            if (curCount > _Max)
            {
                sb.Append("<div class=\"list-more\"><a href=\"" + GlobalSettings.RelativeWebRoot + "pages/view.aspx?product-industry\" title=\"查看全部。。。\"></a></div>");
            }
            return(sb.ToString());
        }
Пример #3
0
        string RenderHTML()
        {
            if (_Cache.ContainsKey(_IndustryID))
            {
                return(_Cache[_IndustryID]);
            }
            List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0);

            StringBuilder sb = new StringBuilder();

            if (_IndustryID == 0)
            {
                return("<div class=\"" + _CssClass + "\"><span>暂无子行业信息!</span></div>");
            }
            else
            {
                string                 _indId = string.Empty;
                ProductIndustry        pi     = null;
                List <ProductIndustry> pis    = ProductIndustries.GetChildIndustries(_IndustryID);
                if (pis == null || pis.Count == 0)
                {
                    return("<div class=\"" + _CssClass + "\"><span>暂无子行业信息!</span></div>");
                }
                sb.Append("<div class=\"" + _CssClass + "\">");
                ProductQuery            query;
                int                     count = 0;
                PagingDataSet <Product> __ps  = null;
                for (int i = 0; i < pis.Count; i++)
                {
                    pi               = pis[i];
                    count            = 0;
                    query            = new ProductQuery();
                    query.IndustryID = pi.IndustryID;
                    __ps             = Products.GetProducts(query);
                    if (__ps != null && __ps.Records != null)
                    {
                        count = Products.GetProducts(query).Records.Count;
                    }
                    sb.AppendFormat(_href, GlobalSettings.Encrypt(pi.IndustryID.ToString()), pi.IndustryName + "(" + count + ")");
                }
                sb.Append("</div>");
                if (!_Cache.ContainsKey(_IndustryID))
                {
                    lock (_lock)
                        if (!_Cache.ContainsKey(_IndustryID))
                        {
                            _Cache.Add(_IndustryID, sb.ToString());
                        }
                }
            }
            return(sb.ToString());
        }
        string RenderHTML()
        {
            if (_Cache.ContainsKey(_IndustryID))
            {
                return(_Cache[_IndustryID]);
            }
            List <ProductIndustry> inds = ProductIndustries.GetChildIndustries(0);
            StringBuilder          sb   = new StringBuilder();

            if (_IndustryID == 0)
            {
                sb.Append("您的位置:<b>所有行业</b>");
            }
            else
            {
                ProductIndustry pi = ProductIndustries.GetProductIndustry(_IndustryID);
                sb.Append("<b>" + pi.IndustryName + "</b>");
                int parId = pi.ParentID;
                while (parId != 0)
                {
                    pi = ProductIndustries.GetProductIndustry(parId);
                    if (pi == null)
                    {
                        break;
                    }
                    sb.Insert(0, string.Format(_href, "&ID=" + GlobalSettings.Encrypt(pi.IndustryID.ToString()), pi.IndustryName) + ">>");
                    parId = pi.ParentID;
                }
                sb.Insert(0, "您的位置:" + string.Format(_href, "", "所有行业") + ">>");
                if (!_Cache.ContainsKey(_IndustryID))
                {
                    lock (_lock)
                        if (!_Cache.ContainsKey(_IndustryID))
                        {
                            _Cache.Add(_IndustryID, sb.ToString());
                        }
                }
            }
            return(sb.ToString());
        }