當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。