Esempio n. 1
0
        public PropertyDefinition(string propertyName, string label, System.Type dataType,
                                  PropertyInputType type = PropertyInputType.text, bool isPrimaryKey = false)
        {
            FieldName = propertyName;
            Label     = label;

            DataType  = dataType;
            BasicType = Lib.GetBasicType(DataType);
            if (BasicType == BasicType.Bit)
            {
                inputType = PropertyInputType.checkbox;
            }
            else if (BasicType == BasicType.DateTime)
            {
                Type         = PropertyInputType.date;
                ClientFormat = DefaultDateClientFormat;
            }

            if (Label == "")
            {
                NoLabelRequired = true;
            }
            Type = type;
            if (Type == PropertyInputType.text)
            {
                this.MaxLength = 90;
            }

            IsPrimaryKey = isPrimaryKey;

            NoChecking = true;
        }
Esempio n. 2
0
        public PropertyDefinition(ColumnDefinition colDef)
        {
            IsDBField  = true;
            IsNullable = colDef.IsNullable;
            if (!IsNullable)
            {
                Required = true;
            }

            IsComputed   = colDef.IsComputed;
            IsPrimaryKey = colDef.IsPrimaryKey;
            if (IsComputed)
            {
                IsReadOnly = true;
                NoChecking = true;
            }
            FieldName = colDef.ColumnName;
            DataType  = colDef.DataType;
            BasicType = Lib.GetBasicType(DataType);
            MaxLength = colDef.MaxLength;

            if (BasicType == BasicType.Text && MaxLength == int.MaxValue)
            {
                BasicType = BasicType.TextLong;
            }
            if (BasicType == BasicType.Bit && !IsNullable)
            {
                DefaultValue  = false;
                DefaultSearch = "0";
            }

            if (BasicType == BasicType.Bit)
            {
                inputType = PropertyInputType.checkbox;
            }
            else if (BasicType == BasicType.DateTime)
            {
                Type         = PropertyInputType.date;
                ClientFormat = DefaultDateClientFormat;
            }

            if (FieldName.Length > 1)
            {
                Label = FieldName[0].ToString().ToUpper() + FieldName.Substring(1);
            }
        }