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


C# Models.ContentPartFieldDefinition类代码示例

本文整理汇总了C#中Orchard.ContentManagement.MetaData.Models.ContentPartFieldDefinition的典型用法代码示例。如果您正苦于以下问题:C# ContentPartFieldDefinition类的具体用法?C# ContentPartFieldDefinition怎么用?C# ContentPartFieldDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ContentPartFieldDefinition类属于Orchard.ContentManagement.MetaData.Models命名空间,在下文中一共展示了ContentPartFieldDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PartFieldEditor

 public override IEnumerable<TemplateViewModel> PartFieldEditor(ContentPartFieldDefinition definition) {
     if (definition.FieldDefinition.Name == "TaxonomyField") {
         var model = definition.Settings.GetModel<TaxonomyFieldSettings>();
         model.Taxonomies = _taxonomyService.GetTaxonomies();
         yield return DefinitionTemplate(model);
     }
 }
开发者ID:ThinkPublishing,项目名称:Summit.Core,代码行数:7,代码来源:TaxonomyFieldEditorEvents.cs

示例2: Render

        public dynamic Render(PropertyContext context, ContentItem contentItem, IFieldTypeEditor fieldTypeEditor, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) {
            var p = contentItem.Parts.FirstOrDefault( x => x.PartDefinition.Name == part.Name);

            if(p == null) {
                return String.Empty;
            }

            var f = p.Fields.FirstOrDefault(x => x.Name == field.Name);

            if(f == null) {
                return String.Empty;
            }

            object value = null;

            _contentFieldValueProviders.Invoke(provider => {
                var result = provider.GetValue(contentItem, f);
                if (result != null) {
                    value = result;
                }
            }, Logger);

            if (value == null) {
                value = f.Storage.Get<object>(storageName);
            }

            if (value == null) {
                return null;
            }

            // call specific formatter rendering
            return _propertyFormater.Format(storageType, value, context.State);
        }
开发者ID:wezmag,项目名称:Coevery,代码行数:33,代码来源:ContentFieldProperties.cs

示例3: PartFieldEditor

 public override IEnumerable<TemplateViewModel> PartFieldEditor(ContentPartFieldDefinition definition)
 {
     if (definition.FieldDefinition.Name == "BlogPostPickerField") {
         var model = definition.Settings.GetModel<BlogPostPickerFieldSettings>();
         yield return DefinitionTemplate(model);
     }
 }
开发者ID:brunoAltinet,项目名称:orchard-featuredposts,代码行数:7,代码来源:BlogPostPickerFieldEditorEvents.cs

示例4: ApplyFilter

 public override void ApplyFilter(FilterContext context, string storageName, Type storageType, ContentPartDefinition part, ContentPartFieldDefinition field) {
     var op = (OptionSetOperator) Enum.Parse(typeof (OptionSetOperator), (string) context.State.Operator);
     string value = context.State.Value;
     var valueArr = value != null
         ? value.Split('&').Select(int.Parse).ToArray()
         : new[] {0};
     switch (op) {
         case OptionSetOperator.MatchesAny:
             Action<IAliasFactory> selectorAny = alias => alias.ContentPartRecord<OptionItemContainerPartRecord>().Property("OptionItems", "opits").Property("OptionItemRecord", "opcpr");
             Action<IHqlExpressionFactory> filterAny = x => x.InG("Id", valueArr);
             context.Query.Where(selectorAny, filterAny);
             break;
         case OptionSetOperator.MatchesAll:
             foreach (var id in valueArr) {
                 var optionId = id;
                 Action<IAliasFactory> selectorAll =
                     alias => alias.ContentPartRecord<OptionItemContainerPartRecord>().Property("OptionItems", "opit" + optionId);
                 Action<IHqlExpressionFactory> filterAll = x => x.Eq("OptionItemRecord.Id", optionId);
                 context.Query.Where(selectorAll, filterAll);
             }
             break;
         case OptionSetOperator.NotMatchesAny:
             Action<IAliasFactory> selectorNotAny = alias => alias.ContentPartRecord<OptionItemContainerPartRecord>().Property("OptionItems", "opits").Property("OptionItemRecord", "opcpr");
             Action<IHqlExpressionFactory> filterNotAny = x => x.Not(y => y.InG("Id", valueArr));
             context.Query.Where(selectorNotAny, filterNotAny);
             break;
     }
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:28,代码来源:OptionSetFieldTypeEditor.cs

示例5: PartFieldEditor

 public override IEnumerable<TemplateViewModel> PartFieldEditor(ContentPartFieldDefinition definition) {
     if (definition.FieldDefinition.Name == "PhoneField"
         || definition.FieldDefinition.Name == "PhoneFieldCreate") {
         var model = definition.Settings.GetModel<PhoneFieldSettings>();
         yield return DefinitionTemplate(model);
     }
 }
开发者ID:wezmag,项目名称:Coevery,代码行数:7,代码来源:PhoneFieldEditorEvents.cs

示例6: PartFieldEditor

 public override IEnumerable<TemplateViewModel> PartFieldEditor(ContentPartFieldDefinition definition)
 {
     if (definition.FieldDefinition.Name.Equals(typeof(MoneyField).Name))
     {
         yield return DefinitionTemplate(definition.Settings.GetModel<MoneyFieldSettings>());
     }
 }
开发者ID:SmartFire,项目名称:Lombiq-Fields,代码行数:7,代码来源:MoneyFieldEditorEvents.cs

示例7: BindStorage

        public IFieldStorage BindStorage(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition) {
            var partName = XmlConvert.EncodeLocalName(contentPart.PartDefinition.Name);
            var fieldName = XmlConvert.EncodeLocalName(partFieldDefinition.Name);
            var infosetPart = contentPart.As<InfosetPart>();

            return new SimpleFieldStorage(
                (name, valueType) => Get(infosetPart.Infoset.Element, partName, fieldName, name),
                (name, valueType, value) => {
                        Set(infosetPart.Infoset.Element, partName, fieldName, name, value);

                        var context = new FieldStorageEventContext {
                                        FieldName = partFieldDefinition.Name,
                                        PartName = contentPart.PartDefinition.Name,
                                        Value = value,
                                        ValueName = name,
                                        ValueType = valueType,
                                        Content = infosetPart
                                    };

                        foreach(var fieldEvent in _events) {
                            fieldEvent.SetCalled(context);
                        }
                    }
                );
        }
开发者ID:rupertwhitlock,项目名称:IncreasinglyAbsorbing,代码行数:25,代码来源:InfosetStorageProvider.cs

示例8: EditPartFieldViewModel

 public EditPartFieldViewModel(int index, ContentPartFieldDefinition field) {
     Index = index;
     Name = field.Name;
     FieldDefinition = new EditFieldViewModel(field.FieldDefinition);
     Settings = field.Settings;
     _Definition = field;
 }
开发者ID:rupertwhitlock,项目名称:IncreasinglyAbsorbing,代码行数:7,代码来源:EditPartFieldViewModel.cs

示例9: DisplaySortCriterion

        public LocalizedString DisplaySortCriterion(SortCriterionContext context, ContentPartDefinition part, ContentPartFieldDefinition fieldDefinition) {
            bool ascending = (bool)context.State.Sort;

            return ascending
                       ? T("Ordered by field {0}, ascending", fieldDefinition.Name)
                       : T("Ordered by field {0}, descending", fieldDefinition.Name);

        }
开发者ID:wezmag,项目名称:Coevery,代码行数:8,代码来源:ContentFieldsSortCriteria.cs

示例10: PartFieldEditor

 public override IEnumerable<TemplateViewModel> PartFieldEditor(ContentPartFieldDefinition definition)
 {
     if (definition.FieldDefinition.Name == typeof(HintField).Name)
     {
         var model = definition.Settings.GetModel<HintFieldSettings>();
         yield return DefinitionTemplate(model);
     }
 }
开发者ID:Lombiq,项目名称:Helpful-Extensions,代码行数:8,代码来源:HintFieldSettings.cs

示例11: PartFieldEditor

 public override IEnumerable<TemplateViewModel> PartFieldEditor(ContentPartFieldDefinition definition)
 {
     if (definition.FieldDefinition.Name.Equals(typeof(MediaLibraryUploadField).Name))
     {
         var model = definition.Settings.GetModel<MediaLibraryUploadFieldSettings>();
         yield return DefinitionTemplate(model);
     }
 }
开发者ID:SmartFire,项目名称:Lombiq-Fields,代码行数:8,代码来源:MediaLibraryUploadFieldEditorEvents.cs

示例12: PartFieldEditor

   PartFieldEditor(ContentPartFieldDefinition definition)
 {
     if (definition.FieldDefinition.Name == "DateTimeField")
     {
         var model = definition.Settings.GetModel<DateTimeFieldSettings>();
         yield return DefinitionTemplate(model);
     }
 }
开发者ID:netvoxlab,项目名称:Nvx.Orchard,代码行数:8,代码来源:DateTimeFieldEditorEvents.cs

示例13: BuildPartFieldEditorAsync

 public Task BuildPartFieldEditorAsync(ContentPartFieldDefinition model, BuildEditorContext context)
 {
     return _partFieldDisplayDrivers.InvokeAsync(async contentDisplay =>
     {
         var result = await contentDisplay.BuildEditorAsync(model, context);
         if (result != null)
             result.Apply(context);
     }, Logger);
 }
开发者ID:yanghl22,项目名称:Orchard2,代码行数:9,代码来源:ContentDefinitionDisplayCoordinator.cs

示例14: PartFieldEditor

 public override IEnumerable<TemplateViewModel> PartFieldEditor(ContentPartFieldDefinition definition) {
     if (definition.FieldDefinition.Name == "TextField") {
         var model = new TextFieldSettingsEventsViewModel {
             Settings = definition.Settings.GetModel<TextFieldSettings>(),
         };
             
         yield return DefinitionTemplate(model);
     }
 }
开发者ID:SunRobin2015,项目名称:RobinWithOrchard,代码行数:9,代码来源:TextFieldSettingsEvents.cs

示例15: BindStorage

        public IFieldStorage BindStorage(ContentPart contentPart, ContentPartFieldDefinition partFieldDefinition) {
            var partName = XmlConvert.EncodeLocalName(contentPart.PartDefinition.Name);
            var fieldName = XmlConvert.EncodeLocalName(partFieldDefinition.Name);
            var infosetPart = contentPart.As<InfosetPart>();

            return new SimpleFieldStorage(
                (name, valueType) => Get(infosetPart.ContentItem.VersionRecord == null ? infosetPart.Infoset.Element : infosetPart.VersionInfoset.Element, partName, fieldName, name),
                (name, valueType, value) => Set(infosetPart.ContentItem.VersionRecord == null ? infosetPart.Infoset.Element : infosetPart.VersionInfoset.Element, partName, fieldName, name, value));
        }
开发者ID:anycall,项目名称:Orchard,代码行数:9,代码来源:InfosetStorageProvider.cs


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