Exemplo n.º 1
0
        public static void BuildParentTrail(ref List <CategorySnapshot> allCats, string currentId, ref List <CategorySnapshot> trail)
        {
            if (currentId == "0" || currentId == string.Empty)
            {
                return;
            }

            Catalog.CategorySnapshot current = FindInList(allCats, currentId);

            if (current != null)
            {
                trail.Add(current);
                if (current.ParentId == "0")
                {
                    return;
                }

                if (current.ParentId != null)
                {
                    if (current.ParentId != string.Empty)
                    {
                        BuildParentTrail(ref allCats, current.ParentId, ref trail);
                    }
                }
            }
        }
Exemplo n.º 2
0
        //public void Init(System.Web.HttpApplication context)
        //{
        //    context.BeginRequest += app_BeginRequest;
        //}

        //private void app_BeginRequest(object sender, System.EventArgs e)
        //{
        //    System.Web.HttpApplication app = (System.Web.HttpApplication)sender;
        //    RewritePath(ref app, app.Request.Url);
        //}

        public static string BuildUrlForCategory(Catalog.CategorySnapshot c, System.Web.Routing.RequestContext routingContext)
        {
            if (c.SourceType == Catalog.CategorySourceType.CustomLink)
            {
                if (c.CustomPageUrl != string.Empty)
                {
                    return(c.CustomPageUrl);
                }
            }
            if (c.RewriteUrl == string.Empty)
            {
                return(string.Empty);
            }
            RouteCollection r = System.Web.Routing.RouteTable.Routes;

            return(r.GetVirtualPath(routingContext, "bvroute", new RouteValueDictionary(new { slug = c.RewriteUrl })).VirtualPath.ToString());
        }
Exemplo n.º 3
0
        private static string BuildLink(Catalog.CategorySnapshot c, System.Web.Routing.RequestContext routingContext, ref int tempTabIndex)
        {
            bool   displayActiveTab = true;
            string result           = string.Empty;

            StringBuilder sbLink = new StringBuilder();

            sbLink.Append("<li");

            if ((c.Bvin == SessionManager.CategoryLastId) && displayActiveTab)
            {
                sbLink.Append(" class=\"activemainmenuitem\" >");
            }
            else
            {
                sbLink.Append(">");
            }

            sbLink.Append("<a href=\"");
            sbLink.Append(Utilities.UrlRewriter.BuildUrlForCategory(c, routingContext));

            if (c.CustomPageOpenInNewWindow)
            {
                sbLink.Append("\" target=\"_blank\"");
            }
            else
            {
                sbLink.Append("\"");
            }

            if (tempTabIndex != -1)
            {
                sbLink.Append(" TabIndex=\"" + tempTabIndex.ToString() + "\" ");
                tempTabIndex += 1;
            }

            sbLink.Append(" class=\"actuator\" title=\"" + c.MetaTitle + "\">");
            sbLink.Append("<span>" + c.Name + "</span>");
            sbLink.Append("</a></li>");

            result = sbLink.ToString();
            return(result);
        }
Exemplo n.º 4
0
        public static string BuildUrlForCategory(Catalog.CategorySnapshot c, System.Web.Routing.RequestContext routingContext, string pageNumber, string filternode)
        {
            if (c.SourceType == Catalog.CategorySourceType.CustomLink)
            {
                if (c.CustomPageUrl != string.Empty)
                {
                    return(c.CustomPageUrl);
                }
            }
            if (c.RewriteUrl == string.Empty)
            {
                return(string.Empty);
            }
            RouteCollection r      = System.Web.Routing.RouteTable.Routes;
            string          result = r.GetVirtualPath(routingContext, "bvroute", new RouteValueDictionary(new { slug = c.RewriteUrl })).VirtualPath.ToString();

            result += "?node=" + filternode;
            if (pageNumber != "1")
            {
                result += "&page=" + pageNumber;
            }
            return(result);
        }