Ejemplo n.º 1
0
        public static CubeModel GenerateFromDataTable(DataTable table, Dictionary <string, DataType> columnTypes = null)
        {
            var model = new CubeModel(table.TableName);

            foreach (DataColumn col in table.Columns)
            {
                var type = DataType.Text;
                if (columnTypes != null)
                {
                    if (!columnTypes.TryGetValue(col.ColumnName, out type))
                    {
                        type = Helper.ToDataType(col.DataType);
                    }
                }
                else
                {
                    type = Helper.ToDataType(col.DataType);
                }
                var isMeasure = Helper.IsMeasure(type);
                if (isMeasure)
                {
                    var measure = new MeasureModel(col.ColumnName, type);
                    if (!string.IsNullOrEmpty(col.Caption))
                    {
                        measure.Caption = col.Caption;
                    }
                    model.Measures.Add(measure);
                }
                else
                {
                    var dimension = new DimensionModel(col.ColumnName, type);
                    if (!string.IsNullOrEmpty(col.Caption))
                    {
                        dimension.Caption = col.Caption;
                    }
                    model.Dimensions.Add(dimension);
                }
            }

            return(model);
        }
Ejemplo n.º 2
0
 public DataEngine(CubeModel model)
 {
     this.model = model;
 }
 public DataListEngine(CubeModel model)
     : base(model)
 {
 }
Ejemplo n.º 4
0
        public static CubeModel GenerateFromDataTable(DataTable table, Dictionary<string, DataType> columnTypes = null)
        {
            var model = new CubeModel(table.TableName);

            foreach (DataColumn col in table.Columns)
            {
                var type = DataType.Text;
                if (columnTypes != null)
                {
                    if (!columnTypes.TryGetValue(col.ColumnName, out type))
                        type = Helper.ToDataType(col.DataType);
                }
                else type = Helper.ToDataType(col.DataType);
                var isMeasure = Helper.IsMeasure(type);
                if (isMeasure)
                {
                    var measure = new MeasureModel(col.ColumnName, type);
                    if (!string.IsNullOrEmpty(col.Caption))
                        measure.Caption = col.Caption;
                    model.Measures.Add(measure);
                }
                else
                {
                    var dimension = new DimensionModel(col.ColumnName, type);
                    if (!string.IsNullOrEmpty(col.Caption))
                        dimension.Caption = col.Caption;
                    model.Dimensions.Add(dimension);
                }
            }

            return model;
        }