Esempio n. 1
0
        private static UserInterfaceType GetUserInterfaceType(CrocoTypeDescription desc)
        {
            var type = desc.ExtractType();

            if (type == typeof(bool) || type == typeof(bool?))
            {
                return(UserInterfaceType.DropDownList);
            }

            if (type == typeof(DateTime) || type == typeof(DateTime?))
            {
                return(UserInterfaceType.DatePicker);
            }

            if (desc.IsEnumeration)
            {
                return(UserInterfaceType.DropDownList);
            }

            if (desc.IsNumber)
            {
                return(UserInterfaceType.NumberBox);
            }

            return(UserInterfaceType.TextBox);
        }
Esempio n. 2
0
        private static UserInterfaceNumberBoxData GetNumberBoxDataForProperty(CrocoTypeDescription prop, UserInterfaceType interfaceType)
        {
            if (interfaceType != UserInterfaceType.NumberBox)
            {
                return(null);
            }

            var type = prop.ExtractType();

            if (CrocoClassDescriptionBuilder.IsNullable(type, out var extractedType))
            {
                type = extractedType;
            }

            if (IntegerTypes.TryGetValue(type, out var minMax))
            {
                return(new UserInterfaceNumberBoxData
                {
                    IsInteger = true,
                    MinValue = minMax.MinValue,
                    MaxValue = minMax.MaxValue
                });
            }
            ;
            minMax = NonIntegerTypes[type];

            return(new UserInterfaceNumberBoxData
            {
                IsInteger = false,
                MinValue = minMax.MinValue,
                MaxValue = minMax.MaxValue
            });
        }