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


C# IContent.GetValue方法代码示例

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


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

示例1: GetFormModel

 public static FormModel GetFormModel(IContent document)
 {
     if (document == null)
     {
         return null;
     }
     var property = GetFormModelProperty(document.ContentType);
     if (property == null)
     {
         return null;
     }
     var json = document.GetValue(property.Alias) as string;
     if (string.IsNullOrEmpty(json))
     {
         return null;
     }
     return SerializationHelper.DeserializeFormModel(json);
 }
开发者ID:alecrt,项目名称:FormEditor,代码行数:18,代码来源:ContentHelper.cs

示例2: GetObjectByPage

        public static CanvasModel GetObjectByPage(IContent node)
        {
            try
            {
                string json = node.GetValue<string>("canvas");

                var model = new CanvasModel();

                if (!string.IsNullOrEmpty(json))
                {
                    model = JsonConvert.DeserializeObject<CanvasModel>(json);
                }

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

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

示例3: FormBulkRemove

 private IContent FormBulkRemove(IContent form, BulkUpdateModel model)
 {
     if (model.Tags != null)
     {
         form.RemoveTags("formTags", model.Tags, TAG_GROUP_GLEANER_FORM);
     }
     if (model.Groups != null)
     {
         var currentValue = form.GetValue<string>("associatedGroups").ToDelimitedList().Select(Int32.Parse);
         form.SetValue("associatedGroups", string.Join(",", currentValue.Except(model.Groups)));
     }
     return form;
 }
开发者ID:AzarinSergey,项目名称:project-site,代码行数:13,代码来源:FormService.cs

示例4: GetFormVersionItem

 private FormVersionListItemDisplay GetFormVersionItem(IContent content)
 {
     var glVersion = content.GetValue<string>("glVersion") ?? string.Empty;
     var formUpload = content.GetValue<string>("formUpload");
     var files = string.IsNullOrEmpty(formUpload)
         ? new List<KeyValuePair<string, string>>()
         : formUpload.ToDelimitedList()
             .Where(x => !string.IsNullOrEmpty(x))
             .Select(path => new KeyValuePair<string, string>(path, Path.GetFileName(path)))
             .ToList();
     var item = new FormVersionListItemDisplay
     {
         Files = files,
         GlVersion = glVersion,
         UpdateDate = content.UpdateDate,
         Updater = Mapper.Map<IProfile, UserBasic>(Services.UserService.GetProfileById(content.WriterId)),
         VersionType = glVersion.Contains(".") ? "Update" : (glVersion.Equals("1") ? "New Version" : "New Document")
     };
     return item;
 }
开发者ID:AzarinSergey,项目名称:project-site,代码行数:20,代码来源:FormApiController.cs

示例5: FromContent

 private object FromContent(IContent post)
 {
     return new MetaWeblogPost
     {
         AllowComments = post.GetValue<bool>("enableComments") ? 1 : 2,
         Author = post.GetValue<string>("author"),
         Categories = post.GetValue<string>("categories").Split(new[]{','}, StringSplitOptions.RemoveEmptyEntries),
         Content = post.ContentType.Alias == "ArticulateRichText"
             ? post.GetValue<string>("richText")
             : new MarkdownDeep.Markdown().Transform(post.GetValue<string>("markdown")),
         CreateDate = post.UpdateDate,
         Id = post.Id.ToString(CultureInfo.InvariantCulture),
         Slug = post.GetValue<string>("umbracoUrlName").IsNullOrWhiteSpace()
             ? post.Name.ToUrlSegment()
             : post.GetValue<string>("umbracoUrlName").ToUrlSegment(),
         Excerpt = post.GetValue<string>("excerpt"),
         Tags = string.Join(",",post.GetValue<string>("tags").Split(new[]{','}, StringSplitOptions.RemoveEmptyEntries)),
         Title = post.Name
     };
 }
开发者ID:Jeavon,项目名称:Articulate,代码行数:20,代码来源:MetaWeblogHandler.cs

示例6: EnsureNavigationTitle

        /// <summary>
        /// Ensures that the node name is the same as the post title
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public IContent EnsureNavigationTitle(IContent doc)
        {
            var navTitle = doc.GetValue<string>("uBlogsyNavigationTitle");
            var title = doc.GetValue<string>("uBlogsyContentTitle");

            if (string.IsNullOrEmpty(navTitle) && !string.IsNullOrEmpty(title))
            {
                navTitle = title;
                // ensure node name is same as title
                doc.SetValue("uBlogsyNavigationTitle", navTitle);
                ApplicationContext.Current.Services.ContentService.Save(doc, 0, false);
            }

            return doc;
        }
开发者ID:NikRimington,项目名称:uBlogsy,代码行数:20,代码来源:PostService.cs

示例7: UpdateFormVersion

 private void UpdateFormVersion(IContent savingContent)
 {
     if (!savingContent.IsDirty())
     {
         return;
     }
     var glVersion = savingContent.GetValue<string>("glVersion");
     var version = "1";
     if (!string.IsNullOrEmpty(glVersion))
     {
         var parts = glVersion.ToDelimitedList(".");
         var major = Int32.Parse(parts[0]);
         var minor = parts.Count > 1 ? Int32.Parse(parts[1]) : 0;
         var isNewVersion = savingContent.IsPropertyDirty("formUpload");
         version = isNewVersion
             ? (major + 1).ToString()
             : string.Join(".", major, minor + 1);
     }
     savingContent.SetValue("glVersion", version);
 }
开发者ID:AzarinSergey,项目名称:project-site,代码行数:20,代码来源:UmbracoApplicationEventHandler.cs

示例8: EnsureCorrectPostTitle

        /// <summary>
        /// Ensures that the node name is the same as the post title
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public IContent EnsureCorrectPostTitle(IContent doc)
        {
            var title = doc.GetValue<string>("uBlogsyContentTitle");
            if (string.IsNullOrEmpty(title))
            {
                // ensure node name is same as title
                doc.SetValue("uBlogsyContentTitle", doc.Name);
                ApplicationContext.Current.Services.ContentService.Save(doc, 0, false);
            }

            return doc;
        }
开发者ID:NikRimington,项目名称:uBlogsy,代码行数:17,代码来源:PostService.cs

示例9: EnsureCorrectPostNodeName

        /// <summary>
        /// Ensures that the node name is the same as the post title
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public IContent EnsureCorrectPostNodeName(IContent doc)
        {
            var useTitleAsNodeName = IContentHelper.GetValueFromAncestor(doc, "uBlogsyLanding", "uBlogsyGeneralUseTitleAsNodeName");

            if (useTitleAsNodeName == "1")
            {
                var title = doc.GetValue<string>("uBlogsyContentTitle");
                if (!string.IsNullOrEmpty(title) && doc.Name != title)
                {
                    // ensure node name is same as title
                    doc.Name = title;
                    ApplicationContext.Current.Services.ContentService.Save(doc, 0, false);
                }
            }

            return doc;
        }
开发者ID:NikRimington,项目名称:uBlogsy,代码行数:22,代码来源:PostService.cs

示例10: EnsureOthersDontHave

 /// <summary>
 /// Обеспечивает отсутствие в прочих опубликованных акциях тех товаров, которые включены в текущую.
 /// При наличии таковых товары убираются из прочих акций, которые затем перепубликовываются без отработки событий.
 /// Внимание! Umbraco HQ выражала намерение убрать возможность публиковать узлы без отработки событий. Это не должно
 /// поломать логику метода, но стоит помнить про вероятность такого развития событий при обновлениях CMS.
 /// </summary>
 /// <param name="promoEventNode"></param>
 public static void EnsureOthersDontHave(IContent promoEventNode)
 {
     var contentService = global::Umbraco.Core.ApplicationContext.Current.Services.ContentService;
     var thisPromoProductsIds = promoEventNode.GetValue<string>("products").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => Int32.Parse(x));
     var otherPublishedPromos = PromoEvent.Cache.Where(x => x.Node.Id != promoEventNode.Id);
     foreach (var otherPublishedPromo in otherPublishedPromos)
     {
         var otherPromoProductIds = otherPublishedPromo.Products.Select(x => x.Node.Id);
         if (thisPromoProductsIds.Intersect(otherPromoProductIds).Any())
         {
             var newOtherPromoProductIds = String.Join(",", otherPromoProductIds.Except(thisPromoProductsIds));
             var otherPromo = contentService.GetById(otherPublishedPromo.Node.Id);
             otherPromo.SetValue("products", newOtherPromoProductIds);
             contentService.SaveAndPublish(otherPromo, 0, false);
         }
     }
 }
开发者ID:AzarinSergey,项目名称:UmbracoE-commerceBadPractic_1,代码行数:24,代码来源:Unico.Etechno.PromoEvent.cs

示例11: GetPostAuthorPhotoUrl

        private string GetPostAuthorPhotoUrl(IContent post)
        {
            var authorId = post.GetValue<int>("postAuthor");
            var author = Members.GetById(authorId);

            string profilePhotoUrl = null;

            if (author != null)
            {
                var profilePhoto = Umbraco.TypedMedia(author.GetPropertyValue<int>("photo"));
                if (profilePhoto != null)
                {
                    profilePhotoUrl = profilePhoto.Url;
                }
            }

            if (String.IsNullOrEmpty(profilePhotoUrl))
            {
                profilePhotoUrl = "http://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&f=y"; // the gray man...
            }

            return profilePhotoUrl;
        }
开发者ID:AzarinSergey,项目名称:project-site,代码行数:23,代码来源:DashboardArborController.cs

示例12: GetPostAuthorFullName

        private string GetPostAuthorFullName(IContent post)
        {
            string memberFullName = null;

            var authorId = post.GetValue<int>("postAuthor");
            var author = Members.GetById(authorId);

            if (author != null)
            {
                memberFullName = String.Format("{0} {1}", author.GetPropertyValue<String>("arborFirstName"), author.GetPropertyValue<String>("arborLastName")).Trim();

                if (String.IsNullOrEmpty(memberFullName))
                {
                    memberFullName = String.Format("{0} {1}", author.GetPropertyValue<String>("firstName"), author.GetPropertyValue<String>("lastName")).Trim();
                }

                if (String.IsNullOrEmpty(memberFullName))
                {
                    memberFullName = author.Name;
                }
            }

            if (String.IsNullOrEmpty(memberFullName))
            {
                memberFullName = "Not Available";
            }

            return memberFullName;
        }
开发者ID:AzarinSergey,项目名称:project-site,代码行数:29,代码来源:DashboardArborController.cs


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