// Build the report
        public void BuildReport(DashboardReportBuilder builder, DashboardStatistics statistics)
        {
            var resultTable = builder.BuildResultTable(statistics);

            builder.CreateRepository();
            builder.AddSource(resultTable);
            builder.CreateReport();
            builder.AddModels();
            builder.AddViews();
            builder.FillResultTable(resultTable);
        }
Пример #2
0
        // Build and returns the result table
        public DataTable BuildResultTable(DashboardStatistics statistics)
        {
            var resultTable = new DataTable();

            resultTable.Columns.Add(new DataColumn(COLUMN_STATISTIC, typeof(string)));
            resultTable.Columns.Add(new DataColumn(COLUMN_VALUE, typeof(int)));
            resultTable.Rows.Add(STAT_CONFORM, statistics.PlayersConformCount);
            resultTable.Rows.Add(STAT_NOT_CONFORM, statistics.PlayersNotConformCount);
            resultTable.Rows.Add(STAT_OK, statistics.PlayersOkCount);
            resultTable.Rows.Add(STAT_UNREACHABLE, statistics.PlayersUnreachableCount);
            resultTable.Rows.Add(STAT_UP_TO_DATE, statistics.PlayersUpToDateCount);
            resultTable.Rows.Add(STAT_NOT_UP_TO_DATE, statistics.PlayersNotUpToDateCount);

            return(resultTable);
        }
Пример #3
0
        public static void GenerateConformityReport(DashboardStatistics data, ReportFormat format)
        {
            // Create the repository
            var repository = Repository.Create();
            // Create the NoSql source
            var source = CreateSource(repository);
            // Create the result DataTable
            var resultTable = CreateResultTable();
            // Create the master table and add it to the data source
            var master = CreateMasterTable(source, resultTable);
            // Create the report
            var report = CreateReport(repository);

            // Add models
            AddModel("Conformite", report, master, data);
            AddModel("Connexion", report, master, data);
            AddModel("Maj", report, master, data);
            // Add views
            AddViews(report);

            // Execute the report
            report.RenderOnly = true;
            report.Format     = format;
            report.Views[0].PdfConfigurations.Add(getPdfHeaderConfiguration());
            var execution = new ReportExecution()
            {
                Report = report
            };

            execution.Execute();
            while (report.IsExecuting)
            {
                System.Threading.Thread.Sleep(100);
            }

            // Generate the report
            var outputFile = execution.GeneratePrintResult();

            var destFileName = Path.GetFileName(outputFile);
            var destFilePath = Path.Combine(Directory.GetCurrentDirectory(), destFileName);

            File.Copy(outputFile, destFilePath, true);
            //sendEmail(outputFile);

            // Show the report
            Process.Start(destFilePath);
        }
Пример #4
0
        public static DataTable GetResultTable(string modelName, DashboardStatistics data)
        {
            var resultTable = CreateResultTable();

            if (modelName == "Conformite")
            {
                resultTable.Rows.Add("Conforme", data.PlayersConformCount);
                resultTable.Rows.Add("Non conforme", data.PlayersNotConformCount);
            }
            else if (modelName == "Connexion")
            {
                resultTable.Rows.Add("Connecté", data.PlayersOkCount);
                resultTable.Rows.Add("Injoignable", data.PlayersUnreachableCount);
            }
            else if (modelName == "Maj")
            {
                resultTable.Rows.Add("A jour", 10);
                resultTable.Rows.Add("Non à jour", 11);
            }

            return(resultTable);
        }
Пример #5
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();
        }