Ejemplo n.º 1
0
        protected void PopulateColumnsHierarchies()
        {
            const string QUERY_HIERARCHIES = @"
SELECT 
    DIMENSION_NAME AS TABLE_NAME, 
    COLUMN_ID AS STRUCTURE_NAME,
    SEGMENT_NUMBER, 
    TABLE_PARTITION_NUMBER, 
    USED_SIZE,
    TABLE_ID AS COLUMN_HIERARCHY_ID
FROM $SYSTEM.DISCOVER_STORAGE_TABLE_COLUMN_SEGMENTS
WHERE LEFT ( TABLE_ID, 2 ) = 'H$'
  AND SEGMENT_NUMBER = 0";

            var cmd = CreateCommand(QUERY_HIERARCHIES);

            cmd.CommandTimeout = CommandTimeout;

            using (var rdr = cmd.ExecuteReader()) {
                while (rdr.Read())
                {
                    string tableName            = rdr.GetString(0);
                    string structureName        = rdr.GetString(1);
                    long   segmentNumber        = rdr.GetInt64(2);
                    long   tablePartitionNumber = rdr.GetInt64(3);
                    long   usedSize             = (long)rdr.GetDecimal(4);
                    string columnHierarchyId    = rdr.GetString(5);
                    string columnDmv1100Id      = columnHierarchyId.Substring(columnHierarchyId.LastIndexOf('$') + 1);

                    ColumnHierarchy daxColumnHierarchy = GetDaxColumnHierarchyDmv1100Id(tableName, columnDmv1100Id, structureName, tablePartitionNumber, segmentNumber);
                    daxColumnHierarchy.UsedSize = usedSize;
                }
            }
        }
 public List <ColumnHierarchy> GetDataColumns()
 {
     if (_dataColumns == null)
     {
         var columnNames = ColumnHierarchy.GetVisibleColumns(ColumnsDic);
         _dataColumns = columnNames.Where(r => !(ColumnsDic[r.ColumnName].IsCrossColumn)).ToList();
     }
     return(_dataColumns);
 }
        public virtual void CreateHierarchy(ColumnHierarchy parent, List <ColumnHierarchy> columnHierarchy, Dictionary <string, BaseColumn> columnsDic)
        {
            columnHierarchy.SetOrders();
            var existsColumns = columnHierarchy.GetAllItems().Where(r => r.ColumnKey != null).ToDictionary(r => r.ColumnKey);

            columnHierarchy.Clear();
            CreateHierarchy(parent, columnHierarchy, existsColumns, GetListItems(), columnsDic);
            columnHierarchy.Order();
            ColumnHierarchyCreated = true;
        }
 public List <ColumnHierarchy> GetAllDataColumns()
 {
     if (_allDataColumns == null)
     {
         var columnNames = ColumnHierarchy.GetAllItems().
                           Where(r => !string.IsNullOrEmpty(r.ColumnName) && ColumnsDic.ContainsKey(r.ColumnName));
         _allDataColumns = columnNames.Where(r => !(ColumnsDic[r.ColumnName].IsCrossColumn)).ToList();
     }
     return(_allDataColumns);
 }
Ejemplo n.º 5
0
        public void RenderColumnHierarchy(ColumnHierarchy columnHierarchy, XmlTextWriter writer, int level, int inLevel, int maxRowSpan, Dictionary <string, BaseColumn> columnsDic)
        {
            if (level == 0 && !columnHierarchy.HideInHeader)
            {
                RenderColumnHierarchy(columnHierarchy, writer);
            }

            foreach (var child in columnHierarchy.GetChilds().Where(r => r.IsVisibleColumn(columnsDic)))
            {
                RenderColumnHierarchy(child, writer, level - columnHierarchy.RowSpan, inLevel + columnHierarchy.RowSpan, maxRowSpan - columnHierarchy.RowSpan, columnsDic);
            }
        }
 protected virtual void InitHierarchy(ColumnHierarchy newItem, CrossColumnDataSourceItem item, Dictionary <string, ColumnHierarchy> existsColumns, Dictionary <string, BaseColumn> columnsDic)
 {
     if (newItem.ColumnName != null && !newItem.Delete)
     {
         columnsDic[newItem.ColumnName] = item.BaseColumn;
     }
     if (existsColumns.ContainsKey(newItem.ColumnKey))
     {
         newItem.Init(existsColumns[newItem.ColumnKey]);
     }
     InitedHierarchy(newItem, item, existsColumns, columnsDic);
 }
Ejemplo n.º 7
0
 private void RenderColumnHierarchy(ColumnHierarchy columnHierarchy, XmlTextWriter writer)
 {
     RenderCell(writer, columnHierarchy.Header, columnHierarchy.RowSpan, columnHierarchy.ColSpan, columnHierarchy.StyleId ?? (columnHierarchy.IsVerticalHeader ? HeaderVertiacalStyleId : HeaderStyleId), ColumnType.Other, string.Empty);
 }
 protected virtual void CreateHierarchy(ColumnHierarchy parent, List <ColumnHierarchy> columnHierarchy, Dictionary <string, ColumnHierarchy> existsColumns, IEnumerable <CrossColumnDataSourceItem> listItems, Dictionary <string, BaseColumn> columnsDic)
 {
     foreach (var item in listItems)
     {
         if (item.BaseColumn != null && !item.BaseColumn.Visible)
         {
             continue;
         }
         //if (!item.HideInHeader) continue;
         var newItem =
             new ColumnHierarchy
         {
             HeaderTextRu     = item.HeaderRu ?? item.Header,
             HeaderTextKz     = item.HeaderKz ?? item.Header,
             ToolTipRu        = item.ToolTipRu,
             ToolTipKz        = item.ToolTipKz,
             HyperLinkOnClick = item.HyperLinkOnClick,
             HyperLinkTarget  = item.HyperLinkTarget,
             HyperLinkUrl     = item.HyperLinkUrl,
             IsVerticalHeader = item.IsVerticalHeader,
             CrossColumnKey   = item.BaseColumn != null
                                          ? item.BaseColumnName + "_" + item.BaseColumn.ColumnName + "_" + item.StringColumnId
                                          : item.BaseColumnName + "_Group_" + item.StringColumnId,
             ColumnName = item.BaseColumn != null
                                      ? item.BaseColumnName + "_" + item.BaseColumn.ColumnName + "_" + item.StringColumnId
                                      : null,
             ColSpan       = item.ColSpan,
             ClientColSpan = item.ColSpan,
             AggregateType = item.BaseColumn != null
                                         ? item.BaseColumn.AggregateType
                                         : ColumnAggregateType.None,
             BaseColumn           = item.BaseColumn,
             CrossColumnIDObject  = item.GetColumnID(),
             HideInHeader         = item.HideInHeader,
             CrossColumnHeaderRow = item.Row,
             Parent = parent,
         };
         newItem.CrossColumnID = newItem.CrossColumnIDObject == null
                                     ? null
                                     : newItem.CrossColumnIDObject.ToString();
         InitHierarchy(newItem, item, existsColumns, columnsDic);
         if (!newItem.Delete)
         {
             if (item.ChildItems.FirstOrDefault() != null)
             {
                 columnHierarchy.Add(newItem);
                 CreateHierarchy(newItem, newItem.Childs, existsColumns, item.ChildItems, columnsDic);
             }
             else if (newItem.BaseColumn != null && newItem.BaseColumn.IsCrossColumn)
             {
                 newItem.BaseColumn.BaseCrossColumnDataSource.CreateHierarchy(
                     parent, columnHierarchy, existsColumns,
                     newItem.BaseColumn.BaseCrossColumnDataSource.GetListItems(), columnsDic);
                 newItem.BaseColumn.BaseCrossColumnDataSource.ColumnHierarchyCreated = true;
             }
             else
             {
                 columnHierarchy.Add(newItem);
             }
             item.CreatedColumnKey  = newItem.ColumnKey;
             item.CreatedColumnName = newItem.ColumnName;
         }
     }
 }
 protected virtual void InitedHierarchy(ColumnHierarchy newItem, CrossColumnDataSourceItem item, Dictionary <string, ColumnHierarchy> existsColumns, Dictionary <string, BaseColumn> columnsDic)
 {
 }