當前位置: 首頁>>代碼示例>>C#>>正文


C# MacroEngines.DynamicNode類代碼示例

本文整理匯總了C#中umbraco.MacroEngines.DynamicNode的典型用法代碼示例。如果您正苦於以下問題:C# DynamicNode類的具體用法?C# DynamicNode怎麽用?C# DynamicNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DynamicNode類屬於umbraco.MacroEngines命名空間,在下文中一共展示了DynamicNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetPropertyValueInternal

        protected virtual string GetPropertyValueInternal( DynamicNode model, string propertyAlias, bool recursive )
        {
            string strValue = "";

              if ( model != null && !string.IsNullOrEmpty( propertyAlias ) ) {
            IProperty property = null;

            if ( !recursive ) {
              property = model.GetProperty( propertyAlias );
            } else {
              DynamicNode tempModel = model;
              IProperty tempProperty = tempModel.GetProperty( propertyAlias );
              if ( tempProperty != null && !string.IsNullOrEmpty( tempProperty.Value ) ) {
            property = tempProperty;
              }

              while ( property == null && tempModel != null && tempModel.Id > 0 ) {
            tempModel = tempModel.Parent;
            if ( tempModel != null ) {
              tempProperty = tempModel.GetProperty( propertyAlias );
              if ( tempProperty != null && !string.IsNullOrEmpty( tempProperty.Value ) ) {
                property = tempProperty;
              }
            }
              }
            }

            if ( property != null ) {
              strValue = property.Value;
            }
              }

              return strValue;
        }
開發者ID:uniquelau,項目名稱:Tea-Commerce-for-Umbraco,代碼行數:34,代碼來源:DynamicNodeProductInformationExtractor.cs

示例2: GetPropertyValue

        public virtual string GetPropertyValue( DynamicNode model, string propertyAlias, Func<DynamicNode, bool> func = null )
        {
            string rtnValue = "";

              if ( model != null && !string.IsNullOrEmpty( propertyAlias ) ) {
            //Check if this node or ancestor has it
            DynamicNode currentNode = func != null ? model.AncestorOrSelf( func ) : model;
            if ( currentNode != null ) {
              rtnValue = GetPropertyValueInternal( currentNode, propertyAlias, func == null );
            }

            //Check if we found the value
            if ( string.IsNullOrEmpty( rtnValue ) ) {

              //Check if we can find a master relation
              string masterRelationNodeId = GetPropertyValueInternal( model, Constants.ProductPropertyAliases.MasterRelationPropertyAlias, true );
              if ( !string.IsNullOrEmpty( masterRelationNodeId ) ) {
            rtnValue = GetPropertyValue( new DynamicNode( masterRelationNodeId ), propertyAlias, func );
              }

            }
              }

              return rtnValue;
        }
開發者ID:uniquelau,項目名稱:Tea-Commerce-for-Umbraco,代碼行數:25,代碼來源:DynamicNodeProductInformationExtractor.cs

示例3: ApplyTemplate

        public HelperResult ApplyTemplate(DynamicNode node, string mode)
        {
            Func<DynamicNode, string, HelperResult> template;

            //if we are not in debug mode we should use the cached templates
            //please remember to restart your application if you do any template
            //changes in production (for files in App_Code this will happen automatically)
            if (!_debugMode)
            {
                var key = new CacheKey { NodeTypeAlias = node.NodeTypeAlias, Mode = mode };
                if (_templatesCache.ContainsKey(key))
                {
                    template = _templatesCache[key];
                }
                else
                {
                    template = GetTemplate(node.NodeTypeAlias, mode);
                    _templatesCache.Add(key, template);
                }
            }
            else
            {
                template = GetTemplate(node.NodeTypeAlias, mode);
            }

            return template(node, mode);
        }
開發者ID:jracabado,項目名稱:RazorScaffold,代碼行數:27,代碼來源:RazorScaffoldCore.cs

示例4: createFolderScructure

        private int createFolderScructure(DateTime dt, DynamicNode stream)
        {
            var names = new string[] {dt.Year.ToString(), dt.Month.ToString(), dt.Day.ToString()};

            var cs = new ContentService();
            var current = stream;
            var lookUp = true;

            foreach (var name in names)
            {
                if (lookUp)
                {

                    var exists = current.Children.Where(x => x.Name == name).FirstOrDefault();
                    if (exists == null)
                    {
                        lookUp = false;
                        var node = cs.CreateContent(name, current.Id, "Folder");
                        cs.SaveAndPublish(node);

                        Thread.Sleep(2000);
                        current = current.Children.Where(x => x.Name == name).FirstOrDefault();
                    }
                }
                else
                {
                    var node = cs.CreateContent(name, current.Id, "Folder");
                    cs.SaveAndPublish(node);
                    current = current.Children.Where(x => x.Name == name).FirstOrDefault();
                }
            }

            return current.Id;
        }
開發者ID:perploug,項目名稱:umblr,代碼行數:34,代碼來源:PostPublisher.cs

示例5: GetXmlPropertyValue

        public virtual DynamicXml GetXmlPropertyValue( DynamicNode model, string propertyAlias, Func<DynamicNode, bool> func = null )
        {
            DynamicXml xmlNode = null;
              string propertyValue = GetPropertyValue( model, propertyAlias, func );

              if ( !string.IsNullOrEmpty( propertyValue ) ) {
            xmlNode = new DynamicXml( XElement.Parse( propertyValue, LoadOptions.None ) );
              }

              return xmlNode;
        }
開發者ID:uniquelau,項目名稱:Tea-Commerce-for-Umbraco,代碼行數:11,代碼來源:DynamicNodeProductInformationExtractor.cs

示例6: GetBattleTagByNodeID

        public static string GetBattleTagByNodeID(int id)
        {
            DynamicNode profile = new DynamicNode(id);
            string battletag = null;

            if(profile.NodeTypeAlias == BattleTagProfile.documentTypeAlias)
            {
                battletag = profile.Name;
                return battletag;
            }
            else
            {
                return battletag;
            }
        }
開發者ID:SkouRene,項目名稱:Diablo3profiler,代碼行數:15,代碼來源:D3pUtilities.cs

示例7: Get

        public static BlogPost Get(DynamicNodeContext nodeContext, int postId = -1)
        {
            if (postId == -1)
            {
                postId = GetBlogPostId();
            }

            if (postId <= 0)
            {
                return GetEmptyPost();
            }

            var post = new DynamicNode(postId);

            return MapToBlogPost(post);
        }
開發者ID:benmcevoy,項目名稱:FatDividends,代碼行數:16,代碼來源:ArticleRepository.cs

示例8: GetRelatedLinks

        public static List<RelatedLink> GetRelatedLinks(string property, DynamicNode model)
        {
            var rlinks = new List<RelatedLink>();

            if (string.IsNullOrEmpty(model.GetPropertyValue(property)))
            {
                return rlinks;
            }

            foreach (var item in (IEnumerable<dynamic>)JsonConvert.DeserializeObject(model.GetPropertyValue(property)))
            {
                var result = new RelatedLink();
                result.Url = (bool)item.isInternal ? new DynamicNode(item["internal"]).Url : item.link;
                result.Target = (bool)item.newWindow ? "_blank" : null;
                result.Caption = item.caption;
                rlinks.Add(result);
            }

            return rlinks;
        }
開發者ID:danielribamar,項目名稱:mojopin,代碼行數:20,代碼來源:UmbracoContentHelper.cs

示例9: SiteMapTemplate

        /// <summary>
        /// The site map.
        /// </summary>
        /// <param name="renderModel">
        /// The render model.
        /// </param>
        /// <returns>
        /// The <see cref="ActionResult"/>.
        /// </returns>
        public ActionResult SiteMapTemplate(RenderModel renderModel)
        {
            List<SiteMapViewModel> sitemapElements = new List<SiteMapViewModel>();

            DynamicNode homepage = new DynamicNode(1089);

            if (homepage.GetProperty("showInSiteMap") != null && homepage.GetProperty("showInSiteMap").Value == "1")
            {
                sitemapElements.Add(new SiteMapViewModel { Url = homepage.Url, LastModified = homepage.UpdateDate });
            }

            DynamicNodeList sitemapPages =
                homepage.Descendants(
                    n => n.GetProperty("showInSiteMap") != null && n.GetProperty("showInSiteMap").HasValue() && n.GetProperty("showInSiteMap").Value == "1");

            foreach (DynamicNode page in sitemapPages)
            {
                sitemapElements.Add(new SiteMapViewModel { Url = page.Url, LastModified = page.UpdateDate });
            }

            return this.View("SiteMapTemplate", sitemapElements);
        }
開發者ID:JimBobSquarePants,項目名稱:blog-umbraco,代碼行數:31,代碼來源:BlogSiteMapController.cs

示例10: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        currentNode = new DynamicNode(Node.getCurrentNodeId());
        heroPageUrl = "/profile/heroes/hero.aspx";

        if (!Page.IsPostBack && !string.IsNullOrEmpty(Request.QueryString["id"]))
        {

            profile = new DynamicNode(Convert.ToInt32(Request.QueryString["id"]));

            //check if profile has heroes else show the download heroes panel
            if (!profile.Descendants(x => x.NodeTypeAlias == Hero.documentTypeAlias).IsNull())
            {
                rViewHeroes.DataSource = profile.Descendants(Hero.documentTypeAlias);
                rViewHeroes.DataBind();
            }
            else
            {

            }
        }
    }
開發者ID:SkouRene,項目名稱:Diablo3profiler,代碼行數:22,代碼來源:HeroesPage.ascx.cs

示例11: IsAncestorOrSelf

 public bool IsAncestorOrSelf(DynamicNode other)
 {
     var descendants = this.DescendantsOrSelf();
     return IsHelper(n => descendants.Items.Find(descendant => descendant.Id == other.Id) != null);
 }
開發者ID:phaniarveti,項目名稱:Experiments,代碼行數:5,代碼來源:DynamicNode.cs

示例12: IsDescendantOrSelf

 public HtmlString IsDescendantOrSelf(DynamicNode other, string valueIfTrue, string valueIfFalse)
 {
     var ancestors = this.AncestorsOrSelf();
     return IsHelper(n => ancestors.Items.Find(ancestor => ancestor.Id == other.Id) != null, valueIfTrue, valueIfFalse);
 }
開發者ID:phaniarveti,項目名稱:Experiments,代碼行數:5,代碼來源:DynamicNode.cs

示例13: IsNotEqual

 public HtmlString IsNotEqual(DynamicNode other, string valueIfTrue, string valueIfFalse)
 {
     return IsHelper(n => n.Id != other.Id, valueIfTrue, valueIfFalse);
 }
開發者ID:phaniarveti,項目名稱:Experiments,代碼行數:4,代碼來源:DynamicNode.cs

示例14: Render

 public static HelperResult Render(DynamicNode node, string mode = "")
 {
     return RazorScaffoldCore.Instance.ApplyTemplate(node, mode);
 }
開發者ID:jracabado,項目名稱:RazorScaffold,代碼行數:4,代碼來源:RazorScaffold.cs

示例15: GetHomeNodeStrongTyped

 public static DynamicNode GetHomeNodeStrongTyped(DynamicNode model)
 {
     return model.AncestorOrSelf("Home");
 }
開發者ID:AndreiGorshunov,項目名稱:UmbracoFramework,代碼行數:4,代碼來源:SearchHelper.cs


注:本文中的umbraco.MacroEngines.DynamicNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。