Exemple #1
0
        /// <summary>Gets the map table columns.</summary>
        /// <param name="data">The forecast data.</param>
        /// <returns>Collection of <see cref="TableColumn"/></returns>
        public ICollection <TableColumn> GetMapTableColumns(ForecastData data)
        {
            var mapColumns = new List <TableColumn>();

            foreach (ColumnInfo column in data.Columns)
            {
                var periodCode = column.Period.Name.Replace(" ", "_");
                var item       = mapColumns.FirstOrDefault(a => a.Code.Equals(periodCode));
                if (item == null)
                {
                    item = new TableColumn {
                        Id       = column.Period.Id,
                        Code     = periodCode,
                        Caption  = column.Period.Name,
                        Children = new List <TableColumn>()
                    };
                    mapColumns.Add(item);
                }
                if (!column.IsHide)
                {
                    item.Children.Add(new TableColumn {
                        Id         = column.Id,
                        Code       = column.Id.ToString(),
                        Caption    = column.Title,
                        IsEditable = column.TypeId == ForecastConsts.EditableColumnTypeId
                    });
                }
            }
            return(mapColumns);
        }
Exemple #2
0
        /// <summary>Gets the map tree table data items.</summary>
        /// <param name="data">The forecast data.</param>
        /// <param name="columns">The forecast columns.</param>
        /// <returns>Collection of <see cref="TreeTableDataItem"/></returns>
        public ICollection <TreeTableDataItem> GetMapTreeTableDataItems(ForecastData data,
                                                                        ICollection <TableColumn> columns)
        {
            var mapSourceData = new List <TreeTableDataItem>();

            foreach (Row row in data.Rows)
            {
                var item = GetTreeTableDataItem(row);
                FillColumnValues(columns, row, item);
                mapSourceData.Add(item);
            }
            return(mapSourceData);
        }