示例#1
0
        public static Dictionary <string, object> GenerateRequiredProperties(FieldType fieldType, Properties.Label label)
        {
            var result = new Dictionary <string, object>
            {
                [Properties.PropertyName.SType.GetEnumStringValue()] = (int)fieldType,
                [Properties.PropertyName.Label.GetEnumStringValue()] = CommonMapperValue.LabelMapperValue[label],
            };

            if (fieldType == FieldType.File)
            {
                result.Add(Properties.PropertyName.DType.GetEnumStringValue(), (int)Properties.DType.Five);
                result.Add(Properties.PropertyName.Height.GetEnumStringValue(), 50);
                result.Add(Properties.PropertyName.VType.GetEnumStringValue(), CommonConstants.Files[FileType.Bmp].MimeType);
            }
            if (fieldType == FieldType.Option)
            {
                var optionInfos = SelectionHelper.GetOptionInfos(SelectionHelper.GetOptionsAlias()[new Random().Next(SelectionHelper.GetOptionsAlias().Count)]);
                result.Add(Properties.PropertyName.Id.GetEnumStringValue(), optionInfos.FirstOrDefault().Key);
                result.Add(Properties.PropertyName.DType.GetEnumStringValue(), (int)SelectionHelper.DTypeMapper[fieldType]);
                result.Add(Properties.PropertyName.Count.GetEnumStringValue(), (int)Properties.OptionCount.Zero);
            }
            return(result);
        }