Exemplo n.º 1
0
        public WebLinkSetDrop(IPortalLiquidContext portalLiquidContext, IWebLinkSet webLinkSet) : base(portalLiquidContext, webLinkSet)
        {
            if (webLinkSet == null)
            {
                throw new ArgumentNullException("webLinkSet");
            }

            WebLinkSet = webLinkSet;

            _webLinks = new Lazy <WebLinkDrop[]>(() => webLinkSet.WebLinks.Select(e => new WebLinkDrop(this, e)).ToArray(), LazyThreadSafetyMode.None);
        }
Exemplo n.º 2
0
        public static IEnumerable <SiteMapNode> CurrentWebLinkChildNodes(this HtmlHelper html, IWebLinkSet webLinkSet, IEnumerable <string> entityLogicalNamesToExclude = null)
        {
            if (webLinkSet == null)
            {
                throw new ArgumentNullException("webLinkSet");
            }

            var currentWebLink = webLinkSet.WebLinks.FirstOrDefault(e =>
                                                                    e.Url != null &&
                                                                    !html.IsRootSiteMapNode(e.Url) &&
                                                                    ((html.IsCurrentSiteMapNode(e.Url) && html.IsFirstGenerationParentSiteMapNode(e.Url)) ||
                                                                     html.IsAncestorSiteMapNode(e.Url, true)));

            return(currentWebLink == null
                                ? Enumerable.Empty <SiteMapNode>()
                                : entityLogicalNamesToExclude == null
                                        ? html.SiteMapChildNodes(currentWebLink.Url)
                                        : html.SiteMapChildNodes(currentWebLink.Url).Where(e =>
            {
                var entityNode = e as CrmSiteMapNode;

                if (entityNode == null)
                {
                    return true;
                }

                return !entityLogicalNamesToExclude.Any(entityNode.HasCrmEntityName);
            }));
        }