当前位置: 首页>>代码示例>>C#>>正文


C# INode.GetProperty方法代码示例

本文整理汇总了C#中INode.GetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# INode.GetProperty方法的具体用法?C# INode.GetProperty怎么用?C# INode.GetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在INode的用法示例。


在下文中一共展示了INode.GetProperty方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetCaseFromUmbracoNode

        private Case GetCaseFromUmbracoNode(INode customerCase)
        {
            //laver cropUp imageUrl
            var imageId = customerCase.GetProperty("images").Value.Split(',').Where(x => string.IsNullOrEmpty(x) == false).Select(x => int.Parse(x)).FirstOrDefault();
            var imageUrl = imageId > 0 ? Umbraco.Media(imageId).Url : "";

            if (string.IsNullOrEmpty(imageUrl) == false)
            {
                var cropUpSizeDesktop = new ImageSizeArguments { Width = 300, Height = 225, CropMode = CropUpMode.BestFit, Zoom = true };
                imageUrl = CropUp.GetUrl("~" + imageUrl, cropUpSizeDesktop);
            }

            //henter kategori
            var catNode = new Node(Convert.ToInt32(customerCase.GetProperty("kategorier").Value));

            //laver return objekt
            var p = new Case
                {
                    Id = 0,
                    Headline = customerCase.Name,
                    Customer = customerCase.Parent.Name,
                    ImageUrl = imageUrl,
                    Url = customerCase.NiceUrl,
                    Created = customerCase.CreateDate,
                    Modified = customerCase.UpdateDate,
                    CategoryId = catNode.Id,
                    CategoryName = catNode.Name,
                    SortOrder = customerCase.Parent.SortOrder
                };

            return p;
        }
开发者ID:rpjengaard,项目名称:louiseBankDk,代码行数:32,代码来源:CasesController.cs

示例2: GetPropertyAlias

 public static string GetPropertyAlias(INode node, string alias)
 {
     if (alias == "pageName")
         return node.Name;
     if (node.GetProperty(alias) != null)
     {
         if (node.GetProperty(alias) != null)
         {
             return (node.GetProperty(alias).Value);
         }
     }
     return String.Empty;
 }
开发者ID:jamesdrever,项目名称:cpx,代码行数:13,代码来源:UmbracoHelper.cs

示例3: PageNode

 public PageNode(INode node)
 {
     Id = node.Id;
     NiceUrl = node.NiceUrl;
     NodeName = node.Name;
     PageTitle = UmbracoFieldReader.ReadStringField(node.GetProperty("pageTitle"));
     NodeTypeAlias = node.NodeTypeAlias;
 }
开发者ID:rubenski,项目名称:Tekstenuitleg,代码行数:8,代码来源:BasicNode.cs

示例4: MapAgendaItem

 public AgendaItem MapAgendaItem(INode nodetomap)
 {
     if (nodetomap == null) return null;
     var fCat = new AgendaItem
     {
         Id = nodetomap.Id,
         Title = nodetomap.Name,
         Url = library.NiceUrl(nodetomap.Id),
         Description = nodetomap.GetProperty("description").Value,
     };
     return fCat;
 }
开发者ID:wakkomail,项目名称:community-framework,代码行数:12,代码来源:NodeMapper.cs

示例5: MapForumPost

        /// <summary>
        /// Maps an Umbraco 'Post' Node to the ForumPost type
        /// </summary>
        /// <param name="nodetomap"></param>
        /// <returns></returns>
        public ForumPost MapForumPost(INode nodetomap)
        {
            if (nodetomap == null) return null;
            var fCat = new ForumPost
            {
                Id = nodetomap.Id,
                CreatedOn = nodetomap.CreateDate,
                ParentId = nodetomap.Parent.Id,
                Name = nodetomap.Name,
                Url = library.NiceUrl(nodetomap.Id),
                Content = Helpers.HtmlDecode(nodetomap.GetProperty("forumPostContent").Value),
                Owner = MembershipHelper.ReturnMember(nodetomap.GetProperty("forumPostOwnedBy").Value.ToInt32()),
                LastEdited = Helpers.InternalDateFixer(nodetomap.GetProperty("forumPostLastEdited").Value),
                IsSolution = nodetomap.GetProperty("forumPostIsSolution").Value == "1",
                IsTopicStarter = nodetomap.GetProperty("forumPostIsTopicStarter").Value == "1",
                Karma = nodetomap.GetProperty("forumPostKarma").Value.ToInt32(),
                VotedMembersIds = Helpers.StringArrayToIntList(nodetomap.GetProperty("forumPostUsersVoted").Value),
                ParentTopicId = nodetomap.GetProperty("forumPostParentID").Value.ToInt32(),
                SortOrder = nodetomap.SortOrder
            };

            return fCat;
        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:28,代码来源:NodeMapper.cs

示例6: MapForumCategory

 /// <summary>
 /// Maps an Umbraco 'Category' Node to the ForumCategory type
 /// </summary>
 /// <param name="nodetomap"></param>
 /// <returns></returns>
 public ForumCategory MapForumCategory(INode nodetomap)
 {
     if (nodetomap == null) return null;
     var fCat = new ForumCategory
     {
         Id = nodetomap.Id,
         CreatedOn = nodetomap.CreateDate,
         Name = nodetomap.Name,
         Url = library.NiceUrl(nodetomap.Id),
         Description = nodetomap.GetProperty("forumCategoryDescription").Value,
         IsMainCategory = nodetomap.GetProperty("forumCategoryIsMainCategory").Value == "1",
         IsPrivate = nodetomap.GetProperty("forumCategoryIsPrivate").Value == "1",
         KarmaAccessAmount = nodetomap.GetProperty("forumCategoryPermissionKarmaAmount").Value.ToInt32(),
         KarmaPostAmount = nodetomap.GetProperty("forumCategoryPostPermissionKarmaAmount").Value.ToInt32(),
         ParentId = nodetomap.Parent.Id,
         ParentCategoryId = nodetomap.GetProperty("forumCategoryParentID").Value.ToInt32(),
         SortOrder = nodetomap.SortOrder
     };
     return fCat;
 }
开发者ID:elrute,项目名称:Triphulcas,代码行数:25,代码来源:NodeMapper.cs

示例7: MapForumTopic

 /// <summary>
 /// Maps an Umbraco 'Topic' Node to the ForumTopic type
 /// </summary>
 /// <param name="nodetomap"></param>
 /// <returns></returns>
 public ForumTopic MapForumTopic(INode nodetomap)
 {
     if (nodetomap == null) return null;
     var fCat = new ForumTopic
     {
         Id = nodetomap.Id,
         Url = library.NiceUrl(nodetomap.Id),
         Name = nodetomap.Name,
         CreatedOn = nodetomap.CreateDate,
         ParentId = nodetomap.Parent.Id,
         CategoryId = nodetomap.GetProperty("forumTopicParentCategoryID").Value.ToInt32(),
         Owner = MembershipHelper.ReturnMember(nodetomap.GetProperty("forumTopicOwnedBy").Value.ToInt32()),
         IsClosed = nodetomap.GetProperty("forumTopicClosed").Value == "1",
         IsSolved = nodetomap.GetProperty("forumTopicSolved").Value == "1",
         IsSticky = nodetomap.GetProperty("forumTopicIsSticky").Value == "1",
         SubscriberIds = Helpers.StringArrayToIntList(nodetomap.GetProperty("forumTopicSubscribedList").Value),
         LastPostDate = Helpers.InternalDateFixer(nodetomap.GetProperty("forumTopicLastPostDate").Value),
         SortOrder = nodetomap.SortOrder
     };
     return fCat;
 }
开发者ID:elrute,项目名称:Triphulcas,代码行数:26,代码来源:NodeMapper.cs

示例8: GetPropertyInternal

        private PropertyResult GetPropertyInternal(string alias, INode content)
        {
            bool propertyExists = false;
            var prop = content.GetProperty(alias, out propertyExists);
            if (prop != null)
            {
                return new PropertyResult(prop) { ContextAlias = content.NodeTypeAlias, ContextId = content.Id };
            }
            else
            {
                if (alias.Substring(0, 1).ToUpper() == alias.Substring(0, 1) && !propertyExists)
                {
                    prop = content.GetProperty(alias.Substring(0, 1).ToLower() + alias.Substring((1)), out propertyExists);
                    if (prop != null)
                    {
                        return new PropertyResult(prop) { ContextAlias = content.NodeTypeAlias, ContextId = content.Id };
                    }
                    else
                    {
                        //reflect
                        object result = null;
                        try
                        {
                            result = content.GetType().InvokeMember(alias,
                                                      System.Reflection.BindingFlags.GetProperty |
                                                      System.Reflection.BindingFlags.Instance |
                                                      System.Reflection.BindingFlags.Public,
                                                      null,
                                                      content,
                                                      null);
                        }
                        catch (MissingMethodException)
                        {

                        }
                        if (result != null)
                        {
                            return new PropertyResult(alias, string.Format("{0}", result)) { ContextAlias = content.NodeTypeAlias, ContextId = content.Id };
                        }
                    }
                }
            }
            return null;
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:44,代码来源:DynamicBackingItem.cs

示例9: InsertPropertyAliases

        public static string InsertPropertyAliases(INode node, string alias)
        {
            //if no multiple aliases defined, just return the single alias
            if (!alias.Contains("{")) { return GetPropertyAlias(node, alias); }

            //get all aliases between {}
            Regex regexObj = new Regex(@"(?<=\{)[^{}]*(?=\})");
            var allMatchResults = regexObj.Matches(alias);
            foreach (Match match in allMatchResults)
            {
                if (match.ToString() == "pageName")
                {
                    alias = alias.Replace("{pageName}", node.Name);
                }
                else
                {
                    bool aliasExists;
                    IProperty propertyAlias = node.GetProperty(match.ToString(), out aliasExists);
                    if (aliasExists)
                    {
                        alias = alias.Replace("{" + match.ToString() + "}", propertyAlias.Value);
                    }
                }
            }
            //strip out unnecessary time fields
            alias = alias.Replace("T00:00:00", "");
            return alias;
        }
开发者ID:jamesdrever,项目名称:cpx,代码行数:28,代码来源:UmbracoHelper.cs

示例10: GetEmailAdressesFromUmbracoProperty

 IEnumerable<MailAddress> GetEmailAdressesFromUmbracoProperty(INode node, EnmUmbracoPropertyAlias alias, bool recursive = true)
 {
     bool atleastOneResult = false;
     var p = node.GetProperty(alias.ToString());
     if (p != null && !String.IsNullOrEmpty(p.Value))
     {
         var data = Helper.FromJSON<List<PerplexEmailadres>>(p.Value);
         if (data != null)
             foreach (var email in data)
             {
                 MailAddress m = null;
                 try
                 {
                     if (!String.IsNullOrEmpty(email.Address))
                     {
                         var emailaddress = ReplaceTags(email.Address);
                         if (!String.IsNullOrEmpty(emailaddress) && System.Text.RegularExpressions.Regex.IsMatch(emailaddress, Constants.REGEX_EMAIL))
                             m = new MailAddress(emailaddress, ReplaceTags(email.DisplayName));
                     }
                 }
                 catch { } // "Jammer joh" exception
                 if (m != null)
                 {
                     atleastOneResult = true;
                     yield return m;
                 }
             }
     }
     if (!atleastOneResult && recursive)
         foreach (var email in GetEmailAdressesFromUmbracoProperty(node.Parent, alias, false))
             yield return email;
 }
开发者ID:PerplexInternetmarketing,项目名称:PerplexMail-for-Umbraco,代码行数:32,代码来源:Email.cs

示例11: MapForumNodeToModel

 private void MapForumNodeToModel(INode forumRoot)
 {
     Id = forumRoot.Id;
     CreatedOn = forumRoot.CreateDate;
     Url = Helpers.ReturnSiteDomainName();
     Name = forumRoot.GetProperty("forumName").Value;
     PageTitle = string.IsNullOrEmpty(forumRoot.GetProperty("pageTitle").Value) ? Name : forumRoot.GetProperty("pageTitle").Value;
     MetaDescription = forumRoot.GetProperty("metaDescription").Value;
     EmailAdmin = forumRoot.GetProperty("forumAdminEmail").Value;
     EmailNotification = forumRoot.GetProperty("forumNotificationReplyEmail").Value;
     IsClosed = forumRoot.GetProperty("forumClosed").Value == "1";
     EnableKarma = forumRoot.GetProperty("forumEnableKarma").Value == "1";
     EnableAjaxPostSnippets = forumRoot.GetProperty("forumEnableAjaxPostSnippets").Value == "1";
     EnableMemberReporting = forumRoot.GetProperty("forumEnableMemberReporting").Value == "1";
     EnablePrivateMessaging = forumRoot.GetProperty("forumEnablePrivateMessaging").Value == "1";
     PrivateMessagingFloodControlTimeSpan = forumRoot.GetProperty("forumPrivateMessageFloodControl").Value.ToInt32();
     EnableRssFeeds = forumRoot.GetProperty("forumEnableRSSFeeds").Value == "1";
     EnableMarkAsSolution = forumRoot.GetProperty("forumEnableMarkAsSolution").Value == "1";
     EnableSpamReporting = forumRoot.GetProperty("forumEnableSpamReporting").Value == "1";
     EnableTopicEmailSubscriptions = forumRoot.GetProperty("forumEnableTopicEmailSubscriptions").Value == "1";
     ManuallyAuthoriseNewMembers = forumRoot.GetProperty("forumManuallyAuthoriseNewMembers").Value == "1";
     EmailAdminOnNewMemberSignUp = forumRoot.GetProperty("forumEmailAdminOnNewMemberSignUp").Value == "1";
     TopicsPerPage = forumRoot.GetProperty("forumTopicsPerPage").Value.ToInt32();
     PostsPerPage = forumRoot.GetProperty("forumPostsPerPage").Value.ToInt32();
     KarmaPointsAddedPerPost = forumRoot.GetProperty("karmaPointsAddedPerPost").Value.ToInt32();
     KarmaPointsAddedForThumbUps = forumRoot.GetProperty("karmaPointsAddedForThumbsUp").Value.ToInt32();
     KarmaAllowedToVote = forumRoot.GetProperty("forumKarmaAllowedToVoteAmount").Value.ToInt32();
 }
开发者ID:elrute,项目名称:Triphulcas,代码行数:28,代码来源:Forum.cs

示例12: GetPropertyValueRecursive

        /// <summary>
        /// Returns the value (not null and empty) of the property with the given alias recursively
        /// Time: O(n), Space O(n); where n - content tree height.
        /// </summary>
        /// <param name="node">The node</param>
        /// <param name="propertyAlias">The alias of the property</param>
        /// <returns>The property's value</returns>
        public static string GetPropertyValueRecursive(INode node, string propertyAlias)
        {
            if(node.GetProperty(propertyAlias) != null && !string.IsNullOrEmpty(node.GetProperty(propertyAlias).Value))
                return node.GetProperty(propertyAlias).Value;

            if(node.Parent != null)
                return GetPropertyValueRecursive(node.Parent, propertyAlias);

            return string.Empty;
        }
开发者ID:SkouRene,项目名称:Diablo3profiler,代码行数:17,代码来源:UmbracoUtilities.cs


注:本文中的INode.GetProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。