Пример #1
0
        public static void AddField(HtmlTable t, string columnName, string defaultValue, bool isSerial, bool isNullable, string dataType, string domain, int maxLength, string parentTableSchema, string parentTable, string parentTableColumn, string displayFields, string displayViews, string selectedValues)
        {
            if (string.IsNullOrWhiteSpace(parentTableColumn))
            {
                switch (dataType)
                {
                case "national character varying":
                case "character varying":
                case "national character":
                case "character":
                case "char":
                case "varchar":
                case "nvarchar":
                case "text":
                    ScrudTextBox.AddTextBox(t, columnName, defaultValue, isNullable, maxLength);
                    break;

                case "smallint":
                case "integer":
                case "bigint":
                    ScrudNumberTextBox.AddNumberTextBox(t, columnName, defaultValue, isSerial, isNullable, maxLength, domain);
                    break;

                case "numeric":
                case "money":
                case "double":
                case "double precision":
                case "float":
                case "real":
                case "currency":
                    ScrudDecimalTextBox.AddDecimalTextBox(t, columnName, defaultValue, isNullable, maxLength, domain);
                    break;

                case "boolean":
                    ScrudRadioButtonList.AddRadioButtonList(t, columnName, isNullable, Resources.ScrudResource.YesNo, "true,false", defaultValue);
                    break;

                case "date":
                    ScrudDateTextBox.AddDateTextBox(t, columnName, defaultValue, isNullable, maxLength);
                    break;

                case "bytea":
                    ScrudFileUpload.AddFileUpload(t, columnName, isNullable);
                    break;

                case "timestamp with time zone":
                    //Do not show this field
                    break;
                }
            }
            else
            {
                ScrudDropDownList.AddDropDownList(t, columnName, isNullable, parentTableSchema, parentTable, parentTableColumn, defaultValue, displayFields, displayViews, selectedValues);
            }
        }
Пример #2
0
        internal static void AddField(HtmlTable htmlTable, string resourceClassName, string itemSelectorPath, string columnName, string defaultValue, bool isSerial, bool isNullable, string dataType, string domain, int maxLength, string parentTableSchema, string parentTable, string parentTableColumn, string displayFields, string displayViews, bool useDisplayFieldAsParent, string selectedValues, string errorCssClass, Assembly assembly, bool disabled)
        {
            if (isSerial)
            {
                disabled = true;
            }

            if (htmlTable == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(columnName))
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(parentTableColumn))
            {
                if (ScrudTypes.Strings.Contains(dataType))
                {
                    ScrudTextBox.AddTextBox(htmlTable, resourceClassName, columnName, dataType, defaultValue, isNullable, maxLength, errorCssClass, assembly, disabled);
                }

                if (ScrudTypes.Shorts.Contains(dataType) || ScrudTypes.Integers.Contains(dataType) || ScrudTypes.Longs.Contains(dataType))
                {
                    ScrudNumberTextBox.AddNumberTextBox(htmlTable, resourceClassName, columnName, defaultValue, isSerial, isNullable, maxLength, domain, errorCssClass, assembly, disabled);
                }

                if (ScrudTypes.Decimals.Contains(dataType))
                {
                    ScrudDecimalTextBox.AddDecimalTextBox(htmlTable, resourceClassName, columnName, defaultValue, isNullable, maxLength, domain, errorCssClass, assembly, disabled);
                }

                if (ScrudTypes.Bools.Contains(dataType))
                {
                    ScrudRadioButtonList.AddRadioButtonList(htmlTable, resourceClassName, columnName, isNullable, Titles.YesNo, "true,false", defaultValue, errorCssClass, assembly, disabled);
                }

                if (ScrudTypes.Dates.Contains(dataType))
                {
                    ScrudDateTextBox.AddDateTextBox(htmlTable, resourceClassName, columnName, defaultValue, isNullable, errorCssClass, assembly, disabled);
                }

                if (ScrudTypes.Files.Contains(dataType))
                {
                    ScrudFileUpload.AddFileUpload(htmlTable, resourceClassName, columnName, isNullable, errorCssClass, assembly);
                }
            }
            else
            {
                ScrudDropDownList.AddDropDownList(htmlTable, resourceClassName, itemSelectorPath, columnName, isNullable, parentTableSchema, parentTable, parentTableColumn, defaultValue, displayFields, displayViews, useDisplayFieldAsParent, selectedValues, errorCssClass, assembly, disabled);
            }
        }
Пример #3
0
        public static void AddField(HtmlTable htmlTable, string resourceClassName, string itemSelectorPath, string columnName, string defaultValue, bool isSerial, bool isNullable, string dataType, string domain, int maxLength, string parentTableSchema, string parentTable, string parentTableColumn, string displayFields, string displayViews, bool useDisplayFieldAsParent, string selectedValues)
        {
            if (htmlTable == null)
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(columnName))
            {
                return;
            }

            if (string.IsNullOrWhiteSpace(parentTableColumn))
            {
                switch (dataType)
                {
                case "national character varying":
                case "character varying":
                case "national character":
                case "character":
                case "char":
                case "varchar":
                case "nvarchar":
                case "text":
                    ScrudTextBox.AddTextBox(htmlTable, resourceClassName, columnName, defaultValue, isNullable, maxLength);
                    break;

                case "smallint":
                case "integer":
                case "bigint":
                    ScrudNumberTextBox.AddNumberTextBox(htmlTable, resourceClassName, columnName, defaultValue, isSerial, isNullable, maxLength, domain);
                    break;

                case "numeric":
                case "money":
                case "double":
                case "double precision":
                case "float":
                case "real":
                case "currency":
                    ScrudDecimalTextBox.AddDecimalTextBox(htmlTable, resourceClassName, columnName, defaultValue, isNullable, maxLength, domain);
                    break;

                case "boolean":
                    ScrudRadioButtonList.AddRadioButtonList(htmlTable, resourceClassName, columnName, isNullable, ScrudResource.YesNo, "true,false", defaultValue);
                    break;

                case "date":
                    ScrudDateTextBox.AddDateTextBox(htmlTable, resourceClassName, columnName, defaultValue, isNullable);
                    break;

                case "bytea":
                    ScrudFileUpload.AddFileUpload(htmlTable, resourceClassName, columnName, isNullable);
                    break;

                case "timestamp with time zone":
                    //Do not show this field
                    break;
                }
            }
            else
            {
                //Todo: Add an implementation of overriding the behavior of the parent table data being populated into the list.
                ScrudDropDownList.AddDropDownList(htmlTable, resourceClassName, itemSelectorPath, columnName, isNullable, parentTableSchema, parentTable, parentTableColumn, defaultValue, displayFields, displayViews, useDisplayFieldAsParent, selectedValues);
            }
        }