Exemple #1
0
        /// <summary>
        /// Gets a browsing URL for the given node
        /// </summary>
        /// <param name="categoryId">The category to which the node belongs</param>
        /// <param name="nodeId">The Id of the node for which to get the browse URL</param>
        /// <param name="nodeType">The type of node</param>
        /// <param name="name">The name to use in the link</param>
        /// <returns>A browsing URL for the given node</returns>
        public string GetBrowseUrl(int categoryId, int nodeId, CatalogNodeType nodeType, string name)
        {
            switch (nodeType)
            {
            case CatalogNodeType.Category:
                return(string.Format("~/{1}-C{0}.aspx", nodeId, SanitizeName(name)));

            case CatalogNodeType.Product:
                return(string.Format("~/{1}-P{0}C{2}.aspx", nodeId, SanitizeName(name), categoryId));

            case CatalogNodeType.Webpage:
                return(string.Format("~/{1}-W{0}C{2}.aspx", nodeId, SanitizeName(name), categoryId));

            case CatalogNodeType.Link:
                Link link = LinkDataSource.Load(nodeId);
                if (link.DisplayPage.Length == 0)
                {
                    return(link.TargetUrl);
                }
                return(string.Format("~/{1}-L{0}C{2}.aspx", nodeId, SanitizeName(name), categoryId));
            }
            return(String.Empty);
        }
 public static Link Load(Int32 linkId)
 {
     return(LinkDataSource.Load(linkId, true));
 }