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


C# IPublishedContent.HasProperty方法代码示例

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


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

示例1: GetThemePath

 /// <summary>
 /// Gets the path to the currently assigned theme.
 /// </summary>
 /// <param name="model">
 /// The <see cref="IMasterModel"/>.
 /// </param>
 /// <returns>
 /// The <see cref="string"/> representing the path to the starter kit theme folder.
 /// </returns>
 public static string GetThemePath(IPublishedContent model)
 {
     const string Path = "~/App_Plugins/Merchello.Bazaar/Themes/{0}/";
     return model.HasProperty("theme") && model.HasValue("theme") ? 
         string.Format(Path, model.GetPropertyValue<string>("theme")) :
         string.Empty;
 }
开发者ID:drpeck,项目名称:Merchello,代码行数:16,代码来源:PathHelper.cs

示例2: TitleTag

        public static string TitleTag(IPublishedContent currentPage)
        {
            if (currentPage.HasProperty(Up.Mixins.Seo.TitleTag) && currentPage.HasValue(Up.Mixins.Seo.TitleTag)) { return currentPage.GetPropertyValue<string>(Up.Mixins.Seo.TitleTag); }

            if (currentPage.Level > 1) { return currentPage.Name; }

            return Settings.DefaultTitleTag;
        }
开发者ID:Philo,项目名称:gulp-test,代码行数:8,代码来源:SEOHelpers.cs

示例3: OGImage

        public static string OGImage(IPublishedContent currentPage)
        {
            if (currentPage.HasProperty(Up.Mixins.Seo.OgImage) && currentPage.HasValue(Up.Mixins.Seo.OgImage))
            {
                return @"<meta property=""og:image"" content=""" + Settings.BaseUrlWithoutSlash + new UmbracoHelper(UmbracoContext.Current).TypedMedia(currentPage.GetPropertyValue<int>(Up.Mixins.Seo.OgImage)).GetCropUrl(CropSize.OGImage_1200_x_630) + @""">";
            }

            return "";
        }
开发者ID:Philo,项目名称:gulp-test,代码行数:9,代码来源:SEOHelpers.cs

示例4: GetObjectByNode

        public static CanvasModel GetObjectByNode(IPublishedContent node)
        {
            try
            {
                var model = new CanvasModel();

                if (node.HasProperty("canvas") && node.HasValue("canvas"))
                {

                    string json = node.GetPropertyValue<string>("canvas");

                    model = JsonConvert.DeserializeObject<CanvasModel>(json);

                }

                return model;
            }
            catch (Exception ex)
            {
                Log.Error("Canvas error on GetObjectByNode in Repository.", ex);
                return null;
            }

        }
开发者ID:Vettvangur,项目名称:Canvas,代码行数:24,代码来源:Repository.cs

示例5: ConvertToItem

        private ItemPreview ConvertToItem(IPublishedContent result)
        {
            var item = new ItemPreview();
            item.NodeId = result.Id;
            item.NodeTypeAlias = result.DocumentTypeAlias;
            item.ParentName = result.Parent.Name;
            item.ParentUrl = result.Parent.Url;
            item.Url = result.Url;
            if (result.HasProperty("contentTitle") && result.HasValue("contentTitle"))
            {
                item.Title = result.GetPropertyValue<string>("contentTitle");
            }
            if (result.HasProperty("contentSubtitle") && result.HasValue("contentSubtitle"))
            {
                item.Subtitle = result.GetPropertyValue<string>("contentSubtitle");
            }
            if (result.HasProperty("contentDescription") && result.HasValue("contentDescription"))
            {
                item.Description = result.GetPropertyValue<string>("contentDescription");
            }
            if (result.HasProperty("contentThumbnail") && result.HasValue("contentThumbnail"))
            {
                item.ThumbnailImageUrl = umbracoHelper.TypedMedia(result.GetPropertyValue("contentThumbnail")).Url;
            }
            if (result.HasProperty("contentThumbnailVideo") && result.HasValue("contentThumbnailVideo"))
            {
                item.ThumnailVideoUrl = result.GetPropertyValue<string>("contentThumbnailVideo");
            }
            if (result.HasProperty("contentDate") && result.HasValue("contentDate"))
            {
                item.Date = result.GetPropertyValue<DateTime>("contentDate");
                item.DateFormatted = item.Date.ToString("dd MMMMMMMMM, yyyy", CultureInfo.GetCultureInfoByIetfLanguageTag("pt"));
            }

            return item;
        }
开发者ID:danielribamar,项目名称:mojopin,代码行数:36,代码来源:SearchService.cs

示例6: GetSelectedUsers

        /// <summary>
        /// Gets selected users list from Multi User Select type field
        /// </summary>
        /// <param name="node"></param>
        /// <param name="propertyAlias"></param>
        /// <returns></returns>
        public static IEnumerable<User> GetSelectedUsers(IPublishedContent node, String propertyAlias)
        {
            List<User> selectedUsers = new List<User>();

            if (node != null && !String.IsNullOrEmpty(propertyAlias) && node.HasProperty(propertyAlias) && node.HasValue(propertyAlias))
            {
                var userIds = node.GetPropertyValue<String>(propertyAlias).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var selectedUserId in userIds)
                {
                    User user = User.GetUser(Int32.Parse(selectedUserId));
                    if (user != null)
                    {
                        selectedUsers.Add(user);
                    }
                }
            }

            return selectedUsers;
        }
开发者ID:pawelgur,项目名称:UmbracoExtensions,代码行数:25,代码来源:UmbracoNodeHelpers.cs

示例7: HasSortingConfiguration

 static bool HasSortingConfiguration(IPublishedContent node)
 {
     return node != null && node.HasProperty("sortBy") && node.HasProperty("sortOrderNew");
 }
开发者ID:pawelgur,项目名称:UmbracoExtensions,代码行数:4,代码来源:SortingHelper.cs

示例8: OGTitle

        public static string OGTitle(IPublishedContent currentPage)
        {
            if (currentPage.HasProperty(Up.Mixins.Seo.OgTitle) && currentPage.HasValue(Up.Mixins.Seo.OgTitle)) { return currentPage.GetPropertyValue<string>(Up.Mixins.Seo.OgTitle); }

            return TitleTag(currentPage);
        }
开发者ID:Philo,项目名称:gulp-test,代码行数:6,代码来源:SEOHelpers.cs

示例9: OGDescription

        public static string OGDescription(IPublishedContent currentPage)
        {
            if (currentPage.HasProperty(Up.Mixins.Seo.OgDescription) && currentPage.HasValue(Up.Mixins.Seo.OgDescription)) { return currentPage.GetPropertyValue<string>(Up.Mixins.Seo.OgDescription); }

            return MetaDescription(currentPage);
        }
开发者ID:Philo,项目名称:gulp-test,代码行数:6,代码来源:SEOHelpers.cs

示例10: GetPickedGroups

        /// <summary>
        /// Gets the list of personalisation group content items associated with the current content item
        /// </summary>
        /// <param name="content">Instance of IPublished content</param>
        /// <returns>List of personalisation group content items</returns>
        private static IList<IPublishedContent> GetPickedGroups(IPublishedContent content)
        {
            var propertyAlias = GetGroupPickerAlias();
            if (content.HasProperty(propertyAlias))
            {
                var propertyValue = content.GetProperty(propertyAlias).DataValue.ToString();
                if (!string.IsNullOrEmpty(propertyValue))
                {
                    var pickedGroupIds = propertyValue
                        .Split(',')
                        .Select(x => int.Parse(x));

                    var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
                    return umbracoHelper.TypedContent(pickedGroupIds).ToList();
                }
            }

            return new List<IPublishedContent>();
        }
开发者ID:wderoo,项目名称:UmbracoPersonalisationGroups,代码行数:24,代码来源:PublishedContentExtensions.cs


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