Exemple #1
0
        public static jsColumn[] PopulateColumns(tgEntity entity)
        {
            List<jsColumn> cols = new List<jsColumn>();

            // we just put some fake data in the footer section for the demo
            decimal footer = 100M;

            List<string> columns = entity.GetCurrentListOfColumns();

            foreach (string column in columns)
            {
                tgColumnMetadata esCol = entity.tg.Meta.Columns.FindByColumnName(column);

                jsColumn c = new jsColumn();

                footer += 2M;

                if (esCol != null)
                {
                    c.isVisible = true;
                    c.displayName = esCol.PropertyName;
                    c.dataType = esCol.Type.ToString();
                    c.columnName = esCol.Name;
                    c.propertyName = esCol.PropertyName;
                    c.ordinal = esCol.Ordinal;
                    c.numericPrecision = esCol.NumericPrecision;
                    c.numericScale = esCol.NumericScale;
                    c.characterMaxLength = esCol.CharacterMaxLength;
                    c.defaultValue = esCol.Default;
                    c.hasDefault = esCol.HasDefault;
                    c.isInPrimaryKey = esCol.IsInPrimaryKey;
                    c.isAutoIncrement = esCol.IsAutoIncrement;
                    c.isNullable = esCol.IsNullable;
                    c.isConcurrency = esCol.IsConcurrency || esCol.IsEntitySpacesConcurrency;
                    c.isSortable = true;
                    c.footerValue = "$" + Convert.ToString(footer);
                }
                else
                {
                    object o = entity.GetColumn(column);

                    if (o != DBNull.Value && o != null)
                    {
                        c.dataType = o.GetType().ToString();
                    }

                    c.isVisible = true;
                    c.displayName = column;
                    c.columnName = column;
                    c.propertyName = column;
                    c.isSortable = false;
                    c.footerValue = "$" + Convert.ToString(footer);
                }

                cols.Add(c);
            }

            return cols.ToArray();
        }
Exemple #2
0
        static public jsColumn[] PopulateColumns(tgEntity entity)
        {
            List <jsColumn> cols = new List <jsColumn>();

            // we just put some fake data in the footer section for the demo
            decimal footer = 100M;

            List <string> columns = entity.GetCurrentListOfColumns();

            foreach (string column in columns)
            {
                tgColumnMetadata esCol = entity.tg.Meta.Columns.FindByColumnName(column);

                jsColumn c = new jsColumn();

                footer += 2M;

                if (esCol != null)
                {
                    c.isVisible          = true;
                    c.displayName        = esCol.PropertyName;
                    c.dataType           = esCol.Type.ToString();
                    c.columnName         = esCol.Name;
                    c.propertyName       = esCol.PropertyName;
                    c.ordinal            = esCol.Ordinal;
                    c.numericPrecision   = esCol.NumericPrecision;
                    c.numericScale       = esCol.NumericScale;
                    c.characterMaxLength = esCol.CharacterMaxLength;
                    c.defaultValue       = esCol.Default;
                    c.hasDefault         = esCol.HasDefault;
                    c.isInPrimaryKey     = esCol.IsInPrimaryKey;
                    c.isAutoIncrement    = esCol.IsAutoIncrement;
                    c.isNullable         = esCol.IsNullable;
                    c.isConcurrency      = esCol.IsConcurrency || esCol.IsTiraggoConcurrency;
                    c.isSortable         = true;
                    c.footerValue        = "$" + Convert.ToString(footer);
                }
                else
                {
                    object o = entity.GetColumn(column);

                    if (o != DBNull.Value && o != null)
                    {
                        c.dataType = o.GetType().ToString();
                    }

                    c.isVisible    = true;
                    c.displayName  = column;
                    c.columnName   = column;
                    c.propertyName = column;
                    c.isSortable   = false;
                    c.footerValue  = "$" + Convert.ToString(footer);
                }

                cols.Add(c);
            }

            return(cols.ToArray());
        }