当前位置: 首页>>代码示例>>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;未经允许,请勿转载。