Esempio n. 1
0
        // Add a model to the report
        protected void AddModel(string modelName)
        {
            if (_report == null)
            {
                CreateReport();
            }

            var model = _report.AddModel(false);

            model.Name = modelName;

            var master = this.MasterTable;
            var column = master.Columns.FirstOrDefault(c => c.Name == COLUMN_STATISTIC);

            if (column != null)
            {
                var element = ReportElement.Create();
                element.MetaColumnGUID  = column.GUID;
                element.PivotPosition   = PivotPosition.Row;
                element.SerieDefinition = SerieDefinition.Axis;
                element.SerieSortType   = SerieSortType.None;
                element.SortOrder       = SortOrderConverter.kNoSortKeyword;
                model.Elements.Add(element);
            }

            column = master.Columns.FirstOrDefault(c => c.Name == COLUMN_VALUE);
            if (column != null)
            {
                var element = ReportElement.Create();
                element.MetaColumnGUID = column.GUID;
                element.PivotPosition  = PivotPosition.Data;
                element.ChartJSSerie   = ChartJSSerieDefinition.Pie;
                element.SerieSortType  = SerieSortType.None;
                element.SortOrder      = SortOrderConverter.kNoSortKeyword;
                model.Elements.Add(element);
            }

            model.InitReferences();
        }
Esempio n. 2
0
        public static void AddModel(string modelName, Report report, MetaTable master, DashboardStatistics data)
        {
            var model = report.AddModel(false);

            model.Name        = modelName;
            model.ResultTable = GetResultTable(modelName, data);

            foreach (var column in master.Columns)
            {
                var element = ReportElement.Create();
                element.MetaColumnGUID = column.GUID;

                switch (column.Name)
                {
                case "Nom":
                {
                    element.PivotPosition   = PivotPosition.Row;
                    element.SerieDefinition = SerieDefinition.Axis;
                    element.SerieSortType   = SerieSortType.None;
                    element.SortOrder       = SortOrderConverter.kNoSortKeyword;
                }
                break;

                case "Valeur":
                {
                    element.PivotPosition = PivotPosition.Data;
                    element.ChartJSSerie  = ChartJSSerieDefinition.Pie;
                    element.SerieSortType = SerieSortType.None;
                    element.SortOrder     = SortOrderConverter.kNoSortKeyword;
                }
                break;
                }

                model.Elements.Add(element);
            }

            model.InitReferences();
        }