示例#1
0
        // Add the master table to the source from the input table
        protected void AddMasterTable(MetaSource source, DataTable table)
        {
            // Remove the master tables
            source.MetaData.Tables.RemoveAll(t => t.Alias == MetaData.MasterTableName);

            var master = MetaTable.Create();

            master.DynamicColumns = true;
            master.IsEditable     = false;
            master.Alias          = MetaData.MasterTableName;
            master.Source         = source;

            foreach (DataColumn column in table.Columns)
            {
                var metaColumn = MetaColumn.Create(column.ColumnName);
                metaColumn.Source       = source;
                metaColumn.DisplayName  = Seal.Helpers.Helper.DBNameToDisplayName(column.ColumnName.Trim());
                metaColumn.Category     = "Master";
                metaColumn.DisplayOrder = master.GetLastDisplayOrder();
                metaColumn.Type         = Seal.Helpers.Helper.NetTypeConverter(column.DataType);
                metaColumn.SetStandardFormat();

                master.Columns.Add(metaColumn);
            }

            source.MetaData.Tables.Add(master);
        }
示例#2
0
        public static MetaTable CreateMasterTable(MetaSource source, DataTable table)
        {
            var master = MetaTable.Create();

            master.DynamicColumns = true;
            master.IsEditable     = false;
            master.Alias          = MetaData.MasterTableName;
            master.Source         = source;

            foreach (DataColumn column in table.Columns)
            {
                var metaColumn = MetaColumn.Create(column.ColumnName);
                metaColumn.Source       = source;
                metaColumn.DisplayName  = Helper.DBNameToDisplayName(column.ColumnName.Trim());
                metaColumn.Category     = "Master";
                metaColumn.DisplayOrder = master.GetLastDisplayOrder();
                metaColumn.Type         = Helper.NetTypeConverter(column.DataType);
                metaColumn.SetStandardFormat();
                master.Columns.Add(metaColumn);
            }

            source.MetaData.Tables.Add(master);

            return(master);
        }