private List <ContentReference> GetCommerceNodeIdList(ShoppingCategoryPage pageData)
        {
            List <ContentReference> idList = new List <ContentReference>();

            if (pageData.CatalogNodes != null)
            {
                foreach (LinkItem catalogNodeLinkItem in pageData.CatalogNodes)
                {
                    string linkUrl;
                    if (!EPiServer.Web.PermanentLinkMapStore.TryToMapped(catalogNodeLinkItem.Href, out linkUrl))
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(linkUrl))
                    {
                        continue;
                    }

                    ContentReference contentReference = PageReference.ParseUrl(linkUrl);
                    if (ContentReference.IsNullOrEmpty(contentReference) == false)
                    {
                        idList.Add(contentReference);
                    }
                }
            }
            return(idList);
        }
        public static List <PageData> ToPages(this EPiServer.SpecializedProperties.LinkItemCollection linkItemCollection)
        {
            List <PageData> pages         = new List <PageData>();
            var             contentLoader = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance <EPiServer.IContentLoader>();

            foreach (EPiServer.SpecializedProperties.LinkItem linkItem in linkItemCollection)
            {
                string linkUrl;
                if (!EPiServer.Web.PermanentLinkMapStore.TryToMapped(linkItem.Href, out linkUrl))
                {
                    continue;
                }

                if (string.IsNullOrEmpty(linkUrl))
                {
                    continue;
                }

                PageReference pageReference = PageReference.ParseUrl(linkUrl);

                if (PageReference.IsNullOrEmpty(pageReference))
                {
                    continue;
                }

                pages.Add(contentLoader.Get <PageData>(pageReference));
            }

            return(pages);
        }
        private string GetCommerceNodeIds(ShoppingCategoryPage pageData)
        {
            if (pageData.CatalogNodes != null)
            {
                string commerceCategories = string.Empty;
                foreach (LinkItem catalogNodeLinkItem in pageData.CatalogNodes)
                {
                    string linkUrl;
                    if (!EPiServer.Web.PermanentLinkMapStore.TryToMapped(catalogNodeLinkItem.Href, out linkUrl))
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(linkUrl))
                    {
                        continue;
                    }

                    PageReference pageReference = PageReference.ParseUrl(linkUrl);

                    string id = pageReference.ID.ToString();

                    if (string.IsNullOrEmpty(commerceCategories))
                    {
                        commerceCategories = id;
                    }
                    else
                    {
                        commerceCategories += "," + id;
                    }
                }
                return(commerceCategories);
            }
            return(string.Empty);
        }
Пример #4
0
        public string ResolveUrl(Url url)
        {
            if (url == null)
            {
                return(string.Empty);
            }

            var parsedUrl = ResolveUrl(PageReference.ParseUrl(url.OriginalString));

            return(string.IsNullOrWhiteSpace(parsedUrl) ? url.OriginalString : parsedUrl);
        }
Пример #5
0
        public static PageData GetPageData(string url)
        {
            PageReference currentPageRef = PageReference.ParseUrl(url);

            return(new PageData(currentPageRef));
        }
Пример #6
0
 public static PageReference GetPageReference(string url)
 {
     return(PageReference.ParseUrl(url));
 }