예제 #1
0
        public override IDictionary <string, FieldMetadata> GetFieldMetadata()
        {
            var fmd = base.GetFieldMetadata();

            var minFs = new IntegerFieldSetting
            {
                Name           = MinValueName,
                DisplayName    = GetTitleString(MinValueName),
                Description    = GetDescString(MinValueName),
                ShortName      = "Integer",
                FieldClassName = typeof(IntegerField).FullName
            };
            var maxFs = new IntegerFieldSetting
            {
                Name           = MaxValueName,
                DisplayName    = GetTitleString(MaxValueName),
                Description    = GetDescString(MaxValueName),
                ShortName      = "Integer",
                FieldClassName = typeof(IntegerField).FullName
            };

            minFs.Initialize();
            maxFs.Initialize();

            fmd.Add(MinValueName, new FieldMetadata
            {
                FieldName = MinValueName, CanRead = true, CanWrite = true, FieldSetting = minFs
            });

            fmd.Add(MaxValueName, new FieldMetadata
            {
                FieldName = MaxValueName, CanRead = true, CanWrite = true, FieldSetting = maxFs
            });

            fmd.Add(ShowAsPercentageName, new FieldMetadata
            {
                FieldName    = ShowAsPercentageName, CanRead = true, CanWrite = true,
                FieldSetting = new YesNoFieldSetting
                {
                    Name           = ShowAsPercentageName,
                    DisplayName    = GetTitleString(ShowAsPercentageName),
                    Description    = GetDescString(ShowAsPercentageName),
                    DisplayChoice  = DisplayChoice.RadioButtons,
                    DefaultValue   = YesNoFieldSetting.NoValue,
                    FieldClassName = typeof(YesNoField).FullName,
                }
            });

            return(fmd);
        }
예제 #2
0
        public override IDictionary <string, FieldMetadata> GetFieldMetadata()
        {
            var fmd      = base.GetFieldMetadata();
            var digitsFs = new IntegerFieldSetting
            {
                Name           = DigitsName,
                DisplayName    = GetTitleString(DigitsName),
                Description    = GetDescString(DigitsName),
                ShortName      = "Integer",
                FieldClassName = typeof(IntegerField).FullName
            };

            digitsFs.Initialize();
            digitsFs.MinValue = 0;
            digitsFs.MaxValue = 10;

            fmd.Add(MinValueName, new FieldMetadata
            {
                FieldName    = MinValueName,
                CanRead      = true,
                CanWrite     = true,
                FieldSetting = new NumberFieldSetting
                {
                    Name           = MinValueName,
                    DisplayName    = GetTitleString(MinValueName),
                    Description    = GetDescString(MinValueName),
                    ShortName      = "Number",
                    FieldClassName = typeof(NumberField).FullName,
                    MinValue       = ActiveSchema.DecimalMinValue,
                    MaxValue       = ActiveSchema.DecimalMaxValue,
                    Digits         = 2
                }
            });

            fmd.Add(MaxValueName, new FieldMetadata
            {
                FieldName    = MaxValueName,
                CanRead      = true,
                CanWrite     = true,
                FieldSetting = new NumberFieldSetting
                {
                    Name           = MaxValueName,
                    DisplayName    = GetTitleString(MaxValueName),
                    Description    = GetDescString(MaxValueName),
                    ShortName      = "Number",
                    FieldClassName = typeof(NumberField).FullName,
                    MinValue       = ActiveSchema.DecimalMinValue,
                    MaxValue       = ActiveSchema.DecimalMaxValue,
                    Digits         = 2
                }
            });

            fmd.Add(DigitsName, new FieldMetadata
            {
                FieldName    = DigitsName,
                PropertyType = typeof(int?),
                FieldType    = DynamicContentTools.GetSuggestedFieldType(typeof(int?)),
                DisplayName  = GetTitleString(DigitsName),
                Description  = GetDescString(DigitsName),
                CanRead      = true,
                CanWrite     = true,
                FieldSetting = digitsFs
            });

            fmd.Add(ShowAsPercentageName, new FieldMetadata
            {
                FieldName    = ShowAsPercentageName,
                CanRead      = true,
                CanWrite     = true,
                FieldSetting = new YesNoFieldSetting
                {
                    Name           = ShowAsPercentageName,
                    DisplayName    = GetTitleString(ShowAsPercentageName),
                    Description    = GetDescString(ShowAsPercentageName),
                    DisplayChoice  = DisplayChoice.RadioButtons,
                    DefaultValue   = YesNoFieldSetting.NoValue,
                    FieldClassName = typeof(YesNoField).FullName,
                }
            });

            return(fmd);
        }