Пример #1
0
        public static Dictionary <string, object> GenerateProperties(
            FieldType fieldType,
            Label label             = Label.Min,
            OptionCount optionCount = OptionCount.Zero,
            string optionAlias      = "",
            Caption caption         = Caption.Missing,
            Search search           = Search.Missing,
            Match match             = Match.Missing,
            Web web             = Web.Missing,
            Highlight highlight = Highlight.Missing,
            Require require     = Require.Missing,
            SelectionDefault selectionDefault = SelectionDefault.Missing)
        {
            var optionInfos = GetOptionInfos(optionAlias);
            var properties  = new Dictionary <string, object>
            {
                [PropertyName.SType.GetEnumStringValue()] = (int)fieldType,
                [PropertyName.Label.GetEnumStringValue()] = LabelMapperValue[label],
                [PropertyName.Id.GetEnumStringValue()]    = optionInfos.FirstOrDefault().Key,
                [PropertyName.DType.GetEnumStringValue()] = (int)DTypeMapper[fieldType],
                [PropertyName.Count.GetEnumStringValue()] = (int)optionCount
            };

            CaptionMapperValue[caption](properties);
            SearchMapperValue[search](properties);
            MatchMapperValue[match](properties);
            WebMapperValue[web](properties);
            HighlightMapperValue[highlight](properties);
            RequireMapperValue[require](properties);
            SelectionDefaultMapper[selectionDefault](optionInfos.FirstOrDefault().Value, properties);
            return(properties);
        }
Пример #2
0
        public static Dictionary <string, object> GenerateProperties(FieldType f, Label?l, Caption?c, Search?s, Match?m, Web?w, Highlight?h, Require?r, DateTimeDefault?d)
        {
            var properties = new Dictionary <string, object>
            {
                [PropertyName.SType.GetEnumStringValue()] = (int)f,
                [PropertyName.Label.GetEnumStringValue()] = LabelMapperValue[l ?? Label.Min],
            };

            CaptionMapperValue[c ?? Caption.Missing](properties);
            SearchMapperValue[s ?? Search.Missing](properties);
            MatchMapperValue[m ?? Match.Missing](properties);
            WebMapperValue[w ?? Web.Missing](properties);
            HighlightMapperValue[h ?? Highlight.Missing](properties);
            RequireMapperValue[r ?? Require.Missing](properties);
            DefaultDateMapper[d ?? DateTimeDefault.Missing](properties);
            return(properties);
        }