private async Task OpenReportCommandEvent(SavedReport savedReport)
 {
     await Launcher.OpenAsync(new OpenFileRequest
     {
         File = new ReadOnlyFile(savedReport.FilePath)
     });
 }
Example #2
0
 public StepLocations(SavedReport o, IWizardStep p)
     : base()
 {
     prev = p;
     report = o;
     InitializeComponent();
 }
        private async Task RefreshCommandEvent()
        {
            try
            {
                List <SavedReport> reports = new List <SavedReport>();
                bool permissionGranted     = await AskForPermission(new Permissions.StorageRead());

                if (permissionGranted)
                {
                    string folderpath = DependencyService.Get <IFileHelper>().GetLocalFilePath("");
                    if (Directory.Exists(folderpath))
                    {
                        string[] files = Directory.GetFiles(folderpath, "*.csv");
                        foreach (var file in files)
                        {
                            SavedReport savedReport = new SavedReport()
                            {
                                FilePath      = file,
                                FileName      = Path.GetFileName(file),
                                FileCreatedOn = File.GetCreationTime(file),
                            };
                            reports.Add(savedReport);
                        }
                        Reports = reports.OrderByDescending(r => r.FileCreatedOn).ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                await BaseContent.DisplayAlert("Error", ex.Message, "Ok");
            }
        }
Example #4
0
        public async Task SaveReportAsync(SavedReport report)
        {
            try
            {
                if (report != null)
                {
                    var advanceSavedReport = new AdvanceSavedReport()
                    {
                        ReportName   = report.ReportName,
                        ReportDesc   = string.IsNullOrWhiteSpace(report.ReportDesc) ? string.Empty : report.ReportDesc,
                        ReportType   = report.ReportType,
                        SavedDateUTC = DateTime.UtcNow,
                        ReportData   = report.ReportData.ToJson()
                    };


                    if (report.ReportId.HasValue)
                    {
                        advanceSavedReport.ReportId = report.ReportId.Value;
                        _context.AdvanceSavedReports.Update(advanceSavedReport);
                    }
                    else
                    {
                        _context.AdvanceSavedReports.Add(advanceSavedReport);
                    }

                    await _context.SaveChangesAsync();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("SaveReport", ex);
            }
        }
 public EliminationOptions(SavedReport o)
     : base()
 {
     report = o;
     options = (EliminationReportOptions)o.StandardReportOptions;
     InitializeComponent();
 }
 public override ReportResult Run(SavedReport report)
 {
     repo = new ReportRepository();
     ReportResult result = new ReportResult();
     result.DataTableResults = repo.RunRedistrictingReport();
     result.ChartData = null;
     return result;
 }
 private async Task ShareReportCommandEvent(SavedReport savedReport)
 {
     await Share.RequestAsync(new ShareFileRequest
     {
         Title = savedReport.FileName,
         File  = new ShareFile(savedReport.FilePath)
     });
 }
Example #8
0
    private static SavedReport getNewSavedReport()
    {
        SavedReport settings;

        settings              = new SavedReport();
        settings.Created      = DateTime.UtcNow;
        settings.Name         = string.Format("Report Created {0:d}", DateTime.UtcNow);
        settings.ReportTypeId = 1;

        return(settings);
    }
Example #9
0
        /// <summary>
        /// Adding new report into database.
        /// </summary>
        /// <param name="newReport">New report entity.</param>
        /// <returns>ID for created report.</returns>
        public int AddReport(SavedReport newReport)
        {
            using (PhotoCollectionDatabaseEntities context = new PhotoCollectionDatabaseEntities(_connectionString))
            {
                newReport.ID = context.Tags.NextId(p => p.ID);

                context.SavedReports.AddObject(newReport);
                context.SaveChanges();

                return(newReport.ID);
            }
        }
        public PersonsTreatedCoverageOptions(SavedReport o)
            : base()
        {
            report = o;
            options = (PersonsTreatedCoverageReportOptions)o.StandardReportOptions;

            // Clear previous report results
            report.ReportOptions.Columns = new Dictionary<string, AggregateIndicator>();
            report.ReportOptions.SelectedIndicators = new List<ReportIndicator>();

            InitializeComponent();
        }
Example #11
0
        public GeneratedReportPart GenerateReport(int componentTypeId, SavedReport savedReport)
        {
            switch (componentTypeId)
            {
            //Custom trend report
            case 1:
                return(generateTrendReport(savedReport));

            default:
                return(null);
            }
        }
        private async Task DeleteCommandEvent(SavedReport savedReport)
        {
            bool shouldDelete = await BaseContent.DisplayAlert("Delete Report", "Are you sure you want to delete " + savedReport.FileName, "Yes", "No");

            if (shouldDelete)
            {
                if (File.Exists(savedReport.FilePath))
                {
                    File.Delete(savedReport.FilePath);
                }
                RefreshCommand.Execute(null);
            }
        }
Example #13
0
    public void SaveSettings(RankChartParameters settings, string reportName)
    {
        SavedReport sr;
        int?        settingsId;
        bool        newSettings;

        settingsId = getDisplayedSettingsId();

        newSettings = settingsId == null;

        if (newSettings)
        {
            sr         = new SavedReport();
            sr.Created = DateTime.UtcNow;
        }
        else
        {
            //Load the options to set the fields we're not explicitly setting
            sr = _db.ORManager.Get <SavedReport>((int)settingsId);
        }

        sr.XmlData      = settings.XmlSerialize();
        sr.UserId       = _userId;
        sr.ReportTypeId = 1;
        sr.LastSaved    = DateTime.UtcNow;

        if (sr.Name != reportName)
        {
            sr.Name = reportName;

            if (!newSettings)
            {
                lstReports.SelectedItem.Text = reportName;
            }
        }

        _db.ORManager.SaveOrUpdate(sr);

        if (newSettings)
        {
            //Add the item to the report list
            lstReports.Items.Add(new ListItem(sr.Name, sr.Id.ToString()));
            lstReports.SelectedIndex = lstReports.Items.Count - 1;

            //Set the saved report as the one that's displayed, so that
            //subsequent saves overwrite the settings.
            setDisplayedSettingsId(sr.Id.Value);
        }
    }
Example #14
0
        private GeneratedReportPart generateTrendReport(SavedReport savedReport)
        {
            RankChartGenerator  generator;
            RankChartParameters rcp;

            byte[] bytes;
            GeneratedReportPart grp;

            rcp = RankChartParameters.XmlDeserialize(savedReport.XmlData);

            generator = new RankChartGenerator(_db, rcp, savedReport.Name);
            bytes     = generator.GenerateChart();

            grp       = new GeneratedReportPart();
            grp.Bytes = bytes;

            return(grp);
        }
Example #15
0
    private void setCurrentParameters(RankChartParameters rcp, SavedReport savedReport)
    {
        overviewTab.DisplaySettings(savedReport);

        if (rcp != null)
        {
            //A couple of old reports might not have a range value, so we'll just use custom
            //for backwards compatibility
            if (rcp.DateRangeType == 0)
            {
                rcp.DateRangeType = DateRangeSelector.DateRanges.Custom;
            }

            overviewTab.DateSelector.SetTimeRange(rcp.StartTime, rcp.EndTime, rcp.DateRangeType);
            overviewTab.ChartSize = rcp.ChartSize;
            datasourceList.SetSelectedDatasources(rcp.Datasources);
            eventCategoryList.SetSelectedEventCategories(rcp.EventCategories);
        }
    }
Example #16
0
 public void DisplaySettings(SavedReport settings)
 {
     //if (settings == null)
     //{
     //  txtReportName.Text = string.Format("Report Created {0}", Rt.Website.Global.ConvertToUserTime(DateTime.UtcNow).ToString());
     //  lblReportCreated.Text = "N/A";
     //  lblReportLastSaved.Text = "Never";
     //}
     //else
     //{
     txtReportName.Text    = settings.Name;
     lblReportCreated.Text = Global.ConvertToUserTime(settings.Created).ToString();
     if (settings.LastSaved == null)
     {
         lblReportLastSaved.Text = "Never";
     }
     else
     {
         lblReportLastSaved.Text = Global.ConvertToUserTime(settings.LastSaved.Value).ToString();
     }
     //}
 }
        /// <summary>
        /// create
        /// </summary>
        /// <param name="resource">resource</param>
        /// <returns>ApiResultSavedReport</returns>
        public ApiResultSavedReport CreateSavedReport(SavedReport resource)
        {
            // verify the required parameter 'resource' is set
            if (resource == null)
            {
                throw new ApiException(400, "Missing required parameter 'resource' when calling CreateSavedReport");
            }


            var path = "/reports";

            path = path.Replace("{format}", "json");

            var    queryParams  = new Dictionary <String, String>();
            var    headerParams = new Dictionary <String, String>();
            var    formParams   = new Dictionary <String, String>();
            var    fileParams   = new Dictionary <String, FileParameter>();
            String postBody     = null;

            postBody = ApiClient.Serialize(resource);                                     // http body (model) parameter

            // authentication setting, if any
            String[] authSettings = new String[] { "FortifyToken" };

            // make the HTTP request
            IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);

            if (((int)response.StatusCode) >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling CreateSavedReport: " + response.Content, response.Content);
            }
            else if (((int)response.StatusCode) == 0)
            {
                throw new ApiException((int)response.StatusCode, "Error calling CreateSavedReport: " + response.ErrorMessage, response.ErrorMessage);
            }

            return((ApiResultSavedReport)ApiClient.Deserialize(response.Content, typeof(ApiResultSavedReport), response.Headers));
        }
        public override ReportResult Run(SavedReport report)
        {
            PersonsTreatedCoverageReportOptions standardOpts = (PersonsTreatedCoverageReportOptions)report.StandardReportOptions;

            // Options
            report.ReportOptions.IsByLevelAggregation = true;
            report.ReportOptions.IsCountryAggregation = false;
            report.ReportOptions.IsNoAggregation = false;

            // Get all admin levels
            if (report.ReportOptions.IsAllLocations)
                report.ReportOptions.SelectedAdminLevels = DemoRepo.GetAdminLevelByLevel(standardOpts.DistrictType.LevelNumber).Where(a => a.LevelNumber == standardOpts.DistrictType.LevelNumber).ToList();

            List<int> filteredIntvIds;
            if (this.GetType() == typeof(PersonsTreatedCoverageDrugPackageReportGenerator))
            {
                // Determine intervention types
                IntvTypes = DetermineIntvTypes(standardOpts);
                // Get all the matching interventions based on the report options
                List<IntvBase> intvs = GetIntvsByReportOptions(IntvTypes, report.ReportOptions);
                // Determine the diseases
                Diseases = DetermineDiseases(standardOpts, intvs);
                // Drug package report does not need to be filtered
                filteredIntvIds = null;
            }
            else
            {
                // It is a disease report, so first set the diseases thats were selected
                Diseases = DetermineDiseases(standardOpts);
                // Deterine the interventions associated to the diseases
                IntvTypes = DetermineIntvTypes(Diseases);
                // Determine which interventions should be used in the report
                filteredIntvIds = DetermineInterventionsByDiseasesTargeted(standardOpts.AvailableDrugPackages, report.ReportOptions, Diseases);
            }

            // There was no data at this reporting level
            if (Diseases == null || IntvTypes == null || Diseases.Count < 1 || IntvTypes.Count < 1)
            {
                ReportResult result = new ReportResult();
                result.DataTableResults = new DataTable();
                return result;
            }

            // Run the distribution report for the disease dist related data
            ReportResult distReportResult = RunDistributionReport(CloneReport(report), standardOpts);
            // Aggregate the dist data
            AggregateDistData(distReportResult);

            // Run the intervention report
            ReportResult intvReportResult = RunIntvReport(CloneReport(report), standardOpts, filteredIntvIds);
            // Remove the district and year columns from the intervention report result
            RemovePastColumn(intvReportResult.DataTableResults, TranslationLookup.GetValue("Year"));
            // Aggregate the Report data
            DataTable intvDataTable = AggregateIntvData(intvReportResult);

            // Merge the results
            CopyDataTableToSameRows(intvDataTable, distReportResult.DataTableResults);

            distReportResult.ChartData = distReportResult.DataTableResults.Copy();
            distReportResult.DataTableResults.Columns.Remove(TranslationLookup.GetValue("Type"));
            return distReportResult;
        }
        protected ReportResult RunIntvReport(SavedReport report, PersonsTreatedCoverageReportOptions standardOpts, List<int> filteredIntvIds)
        {
            // Add all the relevant intervention indicators
            foreach (IntvType intvType in IntvTypes)
            {
                AddIndicators(intvType.Id, "PcIntvNumEligibleIndividualsTargeted", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions);
                AddIndicators(intvType.Id, "PcIntvNumIndividualsTreated", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions);
                AddIndicators(intvType.Id, "PcIntvPsacTreated", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions);
                AddIndicators(intvType.Id, "PcIntvNumSacTreated", intvType, intvType.IntvTypeName, intvType.DisplayNameKey, report.ReportOptions);
            }

            // Report gen
            IntvReportGenerator gen = new IntvReportGenerator();
            // Set the IDs of the filtererd interventions
            if (filteredIntvIds != null && filteredIntvIds.Count > 0)
                gen.CmdTextOverride = DetermineInterventionSql(filteredIntvIds, report.ReportOptions);
            // Recent distro static classs
            RecentDistro recentDistro = RecentDistro.GetInstance(true /* instantiate */);
            recentDistro.Run(report.ReportOptions);
            // Run the report
            ReportResult result = gen.Run(report);
            // Clear the RecentDistro from memory
            RecentDistro.ClearInstance();

            return result;
        }
        protected ReportResult RunDistributionReport(SavedReport report, PersonsTreatedCoverageReportOptions standardOpts)
        {
            // Add the disease indicators to the report
            foreach (var disease in Diseases)
            {
                DiseaseDistroPc dd = DiseaseRepo.Create((DiseaseType)disease.Id);

                switch (disease.Id)
                {

                    case (int)DiseaseType.Lf:
                        AddIndicators(disease.Id, "DDLFPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions);
                        break;
                    case (int)DiseaseType.Trachoma:
                        AddIndicators(disease.Id, "DDTraPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions);
                        break;
                    case (int)DiseaseType.Oncho:
                        AddIndicators(disease.Id, "DDOnchoPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions);
                        break;
                    case (int)DiseaseType.STH:
                        AddIndicators(disease.Id, "DDSTHPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions);
                        break;
                    case (int)DiseaseType.Schisto:
                        AddIndicators(disease.Id, "DDSchistoPopulationAtRisk", dd, dd.Disease.DisplayName, dd.Disease.DisplayNameKey, report.ReportOptions);
                        break;
                    default:
                        break;
                }
            }

            // Run the report
            DistributionReportGenerator gen = new DistributionReportGenerator();
            ReportResult result = gen.Run(report);

            return result;
        }
 /// <summary>
 /// Clones a saved report so the report options can be re-used for another report.
 /// 
 /// Clears out the selected indicators since that is the only report option that needs to be changed for this report
 /// </summary>
 /// <param name="report"></param>
 /// <returns></returns>
 protected SavedReport CloneReport(SavedReport report)
 {
     SavedReport newReport = new SavedReport();
     newReport.ReportOptions = Util.DeepClone(report.ReportOptions);
     newReport.ReportOptions.SelectedIndicators = new List<ReportIndicator>();
     return newReport;
 }
Example #22
0
 private void RunEliminationReport(SavedReport r)
 {
     CustomReportView report = new CustomReportView(r);
     report.OnEditReport = EditEliminationReport;
     report.Show();
 }
Example #23
0
 private void RunCustomReport(SavedReport r)
 {
     CustomReportView report = new CustomReportView(r);
     report.OnEditReport = EditCustomReport;
     report.OnSave = LoadSavedReports;
     report.Show();
 }
Example #24
0
        public void Save(SavedReport report, int userId)
        {
            bool transWasStarted = false;
            OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString);
            using (connection)
            {
                connection.Open();
                try
                {
                    // START TRANS
                    OleDbCommand command = new OleDbCommand("BEGIN TRANSACTION", connection);
                    command.ExecuteNonQuery();
                    transWasStarted = true;

                    if (report.Id > 0)
                        command = new OleDbCommand(@"UPDATE CustomReports SET DisplayName=@DisplayName, ReportOptions=@ReportOptions,
                           UpdatedById=@UpdatedById, UpdatedAt=@UpdatedAt WHERE ID=@id", connection);
                    else
                        command = new OleDbCommand(@"INSERT INTO CustomReports (DisplayName, ReportOptions, UpdatedById, 
                            UpdatedAt, CreatedById, CreatedAt) values (@DisplayName, @ReportOptions, @UpdatedById, @UpdatedAt, @CreatedById,
                            @CreatedAt)", connection);

                    command.Parameters.Add(new OleDbParameter("@DisplayName", report.DisplayName));
                    command.Parameters.Add(new OleDbParameter("@ReportOptions", report.Serialize()));
                    command.Parameters.Add(new OleDbParameter("@UpdatedById", userId));
                    command.Parameters.Add(OleDbUtil.CreateDateTimeOleDbParameter("@UpdatedAt", DateTime.Now));
                    if (report.Id > 0)
                        command.Parameters.Add(new OleDbParameter("@id", report.Id));
                    else
                    {
                        command.Parameters.Add(new OleDbParameter("@CreatedById", userId));
                        command.Parameters.Add(OleDbUtil.CreateDateTimeOleDbParameter("@CreatedAt", DateTime.Now));
                    }

                    command.ExecuteNonQuery();
                    if (report.Id <= 0)
                    {
                        command = new OleDbCommand(@"SELECT Max(ID) FROM CustomReports", connection);
                        report.Id = (int)command.ExecuteScalar();
                    }

                    // COMMIT TRANS
                    command = new OleDbCommand("COMMIT TRANSACTION", connection);
                    command.ExecuteNonQuery();
                    transWasStarted = false;
                }
                catch (Exception)
                {
                    if (transWasStarted)
                    {
                        try
                        {
                            OleDbCommand cmd = new OleDbCommand("ROLLBACK TRANSACTION", connection);
                            cmd.ExecuteNonQuery();
                        }
                        catch { }
                    }
                    throw;
                }
            }

        }
Example #25
0
 private void RunReport(SavedReport options)
 {
     this.Close();
     OnRunReport(options);
 }
        public override ReportResult Run(SavedReport report)
        {
            EliminationReportOptions standardOpts = (EliminationReportOptions)report.StandardReportOptions;
            ReportOptions options = report.ReportOptions;
            DistributionReportGenerator gen = new DistributionReportGenerator();
            DiseaseRepository repo = new DiseaseRepository();
            foreach (var disease in standardOpts.Diseases)
            {
                DiseaseDistroPc dd = repo.Create((DiseaseType)disease.Id);

                switch (disease.Id)
                {

                    case (int)DiseaseType.Lf:
                        AddIndicators(disease.Id, "DDLFPopulationAtRisk", dd, options);
                        AddIndicators(disease.Id, "DDLFPopulationLivingInTheDistrictsThatAc", dd, options);
                        break;
                    case (int)DiseaseType.Trachoma:
                        AddIndicators(disease.Id, "DDTraPopulationAtRisk", dd, options);
                        AddIndicators(disease.Id, "DDTraPopulationLivingInAreasDistrict", dd, options);
                        break;
                    case (int)DiseaseType.Oncho:
                        AddIndicators(disease.Id, "DDOnchoPopulationAtRisk", dd, options);
                        AddIndicators(disease.Id, "DDOnchoPopulationLivingInTheDistrictsTha", dd, options);
                        break;
                    case (int)DiseaseType.STH:
                        AddIndicators(disease.Id, "DDSTHPopulationAtRisk", dd, options);
                        AddIndicators(disease.Id, "DDSTHPopulationLivingInTheDistrictsThatA", dd, options);
                        break;
                    case (int)DiseaseType.Schisto:
                        AddIndicators(disease.Id, "DDSchistoPopulationAtRisk", dd, options);
                        AddIndicators(disease.Id, "DDSchistoPopulationLivingInTheDistrictsT", dd, options);
                        break;
                    default:
                        break;
                }
            }

            ReportResult result = gen.Run(report);

            // loop table, make sure column exists (with 0), sum other columns to good column and delete other columns if they have em.
            result.DataTableResults.Columns.Add(new DataColumn(TranslationLookup.GetValue("EliminationAtRisk")));
            result.DataTableResults.Columns.Add(new DataColumn(TranslationLookup.GetValue("EliminationLiving")));
            foreach (DataRow row in result.DataTableResults.Rows)
            {
                double totalAtRisk = 0, totalLiving = 0;
                totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDLFPopulationAtRisk") + " - " + TranslationLookup.GetValue("LF"), result.DataTableResults, row);
                totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDTraPopulationAtRisk") + " - " + TranslationLookup.GetValue("Trachoma"), result.DataTableResults, row);
                totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDOnchoPopulationAtRisk") + " - " + TranslationLookup.GetValue("Oncho"), result.DataTableResults, row);
                totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDSTHPopulationAtRisk") + " - " + TranslationLookup.GetValue("STH"), result.DataTableResults, row);
                totalAtRisk += GetColumnDouble(TranslationLookup.GetValue("DDSchistoPopulationAtRisk") + " - " + TranslationLookup.GetValue("Schisto"), result.DataTableResults, row);
                totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDLFPopulationLivingInTheDistrictsThatAc") + " - " + TranslationLookup.GetValue("LF"), result.DataTableResults, row);
                totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDTraPopulationLivingInAreasDistrict") + " - " + TranslationLookup.GetValue("Trachoma"), result.DataTableResults, row);
                totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDSTHPopulationLivingInTheDistrictsThatA") + " - " + TranslationLookup.GetValue("STH"), result.DataTableResults, row);
                totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDOnchoPopulationLivingInTheDistrictsTha") + " - " + TranslationLookup.GetValue("Oncho"), result.DataTableResults, row);
                totalLiving += GetColumnDouble(TranslationLookup.GetValue("DDSchistoPopulationLivingInTheDistrictsT") + " - " + TranslationLookup.GetValue("Schisto"), result.DataTableResults, row);
                row[TranslationLookup.GetValue("EliminationAtRisk")] = totalAtRisk;
                row[TranslationLookup.GetValue("EliminationLiving")] = totalLiving;
            }

            TryRemoveColumn(TranslationLookup.GetValue("DDLFPopulationAtRisk") + " - " + TranslationLookup.GetValue("LF"), result.DataTableResults);
            TryRemoveColumn(TranslationLookup.GetValue("DDLFPopulationLivingInTheDistrictsThatAc") + " - " + TranslationLookup.GetValue("LF"), result.DataTableResults);
            TryRemoveColumn(TranslationLookup.GetValue("DDTraPopulationAtRisk") + " - " + TranslationLookup.GetValue("Trachoma"), result.DataTableResults);
            TryRemoveColumn(TranslationLookup.GetValue("DDOnchoPopulationAtRisk") + " - " + TranslationLookup.GetValue("Oncho"), result.DataTableResults);
            TryRemoveColumn(TranslationLookup.GetValue("DDSTHPopulationAtRisk") + " - " + TranslationLookup.GetValue("STH"), result.DataTableResults);
            TryRemoveColumn(TranslationLookup.GetValue("DDSchistoPopulationAtRisk") + " - " + TranslationLookup.GetValue("Schisto"), result.DataTableResults);
            TryRemoveColumn(TranslationLookup.GetValue("DDTraPopulationLivingInAreasDistrict") + " - " + TranslationLookup.GetValue("Trachoma"), result.DataTableResults);
            TryRemoveColumn(TranslationLookup.GetValue("DDSTHPopulationLivingInTheDistrictsThatA") + " - " + TranslationLookup.GetValue("STH"), result.DataTableResults);
            TryRemoveColumn(TranslationLookup.GetValue("DDOnchoPopulationLivingInTheDistrictsTha") + " - " + TranslationLookup.GetValue("Oncho"), result.DataTableResults);
            TryRemoveColumn(TranslationLookup.GetValue("DDSchistoPopulationLivingInTheDistrictsT") + " - " + TranslationLookup.GetValue("Schisto"), result.DataTableResults);

            result.ChartData = result.DataTableResults.Copy();
            result.DataTableResults.Columns.Remove(TranslationLookup.GetValue("Type"));
            if (options.IsCountryAggregation)
                result.DataTableResults.Columns.RemoveAt(0);
            return result;
        }
Example #27
0
 private void EditCustomReport(SavedReport r)
 {
     WizardForm wiz = new WizardForm(new StepIndicators(r), Translations.CustomReportBuilder);
     wiz.Height = 695;
     wiz.OnRunReport = RunCustomReport;
     wiz.Show();
 }
Example #28
0
 private void redistrictingReport_ClickOverride()
 {
     SavedReport r = new SavedReport { TypeName = Translations.RedistrictingReport };
     r.ReportOptions = new ReportOptions();
     r.ReportOptions.ReportGenerator = new RedistrictingReportGenerator();
     CustomReportView report = new CustomReportView(r);
     report.OnEditReport = null;
     report.Show();
 }
Example #29
0
 private void EditEliminationReport(SavedReport r)
 {
     WizardForm wiz = new WizardForm(new EliminationOptions(r), Translations.ReportProgressTowardsEliminiation);
     wiz.Height = 685;
     wiz.OnRunReport = RunEliminationReport;
     wiz.Show();
 }
        public async Task <IActionResult> PostSaveReport([FromBody] SavedReport savedReport)
        {
            await _advanceReportProvider.SaveReportAsync(savedReport);

            return(new JsonResult(true));
        }
Example #31
0
        public List<SavedReport> GetCustomReports()
        {
            List<SavedReport> list = new List<SavedReport>();

            OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString);
            using (connection)
            {
                connection.Open();
                try
                {
                    OleDbCommand command = new OleDbCommand(@"Select ID, DisplayName, ReportOptions, aspnet_users.UserName, UpdatedAt, CreatedAt, c.UserName as CreatedBy from 
                        ((CustomReports INNER JOIN aspnet_users on CustomReports.UpdatedById = aspnet_users.userid)
                        INNER JOIN aspnet_users c on CustomReports.CreatedById = c.userid)
                        WHERE IsDeleted=0", connection);
                    using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var report = new SavedReport
                            {
                                Id = reader.GetValueOrDefault<int>("ID"),
                                DisplayName = reader.GetValueOrDefault<string>("DisplayName"),
                                UpdatedBy = GetAuditInfo(reader)
                            };
                            report.Deserialize(reader.GetValueOrDefault<string>("ReportOptions"));
                            list.Add(report);

                        }
                        reader.Close();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return list;
        }
Example #32
0
        public void DeleteCustomReport(SavedReport report, int userId)
        {
            OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString);
            using (connection)
            {
                connection.Open();
                try
                {
                    // START TRANS
                    OleDbCommand command = new OleDbCommand("BEGIN TRANSACTION", connection);
                    command.ExecuteNonQuery();
                    // START TRANS
                    command =  new OleDbCommand(@"UPDATE CustomReports SET IsDeleted= Yes,
                           UpdatedById=@UpdatedById, UpdatedAt=@UpdatedAt WHERE ID=@id", connection);
                    command.Parameters.Add(new OleDbParameter("@UpdatedById", userId));
                    command.Parameters.Add(OleDbUtil.CreateDateTimeOleDbParameter("@UpdatedAt", DateTime.Now));
                    command.Parameters.Add(new OleDbParameter("@ID", report.Id));
                    
                    command.ExecuteNonQuery();

                    command = new OleDbCommand("COMMIT TRANSACTION", connection);
                    command.ExecuteNonQuery();
                    
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
        public async Task <IActionResult> PostRunReport([FromBody] SavedReport savedReport)
        {
            var result = await _advanceReportProvider.RunReportAsync(savedReport);

            return(Ok(result.ToJson()));
        }
Example #34
0
 private void personsTreatedAndCoverageReport_ClickOverride()
 {
     SavedReport sr = new SavedReport { StandardReportOptions = new PersonsTreatedCoverageReportOptions() };
     sr.ReportOptions.IsAllLocations = true;
     sr.ReportOptions.IsCountryAggregation = true;
     sr.ReportOptions.IsByLevelAggregation = false;
     sr.ReportOptions.IsNoAggregation = false;
     WizardForm wiz = new WizardForm(new PersonsTreatedCoverageOptions(sr), Translations.PersonsTreatedAndCoverageReport);
     wiz.OnFinish = () => { };
     wiz.Height = 685;
     wiz.OnRunReport = RunPersonsTreatedAndCoverageReport;
     wiz.Show();
 }
Example #35
0
 private void eliminationReport_ClickOverride()
 {
     SavedReport sr = new SavedReport { StandardReportOptions = new EliminationReportOptions() };
     sr.ReportOptions.IsAllLocations = true;
     sr.ReportOptions.IsCountryAggregation = true;
     sr.ReportOptions.IsByLevelAggregation = false;
     sr.ReportOptions.IsNoAggregation = false;
     WizardForm wiz = new WizardForm(new EliminationOptions(sr), Translations.ReportProgressTowardsEliminiation);
     wiz.OnFinish = () => { };
     wiz.Height = 685;
     wiz.OnRunReport = RunEliminationReport;
     wiz.Show();
 }
Example #36
0
        public async Task <ReportResult> RunReportAsync(SavedReport report, string connectionString = null)
        {
            if (string.IsNullOrWhiteSpace(connectionString))
            {
                connectionString = _context.ConnectionString;
            }
            var           reportResult    = new ReportResult();
            List <string> selectList      = new List <string>();
            List <string> filterCriteria  = new List <string>();
            List <string> groupCriteria   = new List <string>();
            List <string> dateTypeFilters = new List <string>();

            try
            {
                bool   isChart       = false;
                string tableName     = null;
                string orderByColumn = string.Empty;
                bool   orderByIsDesc = false;
                if (report != null && report.ReportData != null)
                {
                    var data = await _context.AdvanceReportViews.Where(x => x.ReportViewId == report.ReportData.SelectedViewId).ToListAsync();

                    if (data.Any())
                    {
                        var table = data.First();
                        tableName = table.ViewName;
                        if (report.ReportData.SelectedFields != null && report.ReportData.SelectedFields.Any())
                        {
                            if (!report.ReportType.Equals(AdvanceReportType.List.ToString()))
                            {
                                isChart = true;
                                foreach (var item in report.ReportData.SelectedFields)
                                {
                                    if (ReportManager.GroupOnlyAggregate.Contains(item.SelectedFieldAggr))
                                    {
                                        selectList.Add(item.FieldName);
                                        groupCriteria.Add(item.FieldName);
                                    }
                                    else if (ReportManager.NonGroupAggregate.Contains(item.SelectedFieldAggr))
                                    {
                                        selectList.Add(string.Concat(item.FieldName, ReportManager.EqualDelimeter, item.SelectedFieldAggr));
                                    }
                                    else
                                    {
                                        selectList.Add(string.Concat(item.FieldName, ReportManager.EqualDelimeter, item.SelectedFieldAggr));
                                        groupCriteria.Add(string.Concat(item.FieldName, ReportManager.EqualDelimeter, item.SelectedFieldAggr));
                                    }
                                }
                            }
                            else
                            {
                                selectList = report.ReportData.SelectedFields.Select(x => x.FieldName).ToList();
                            }
                        }

                        if (report.ReportData.Filters != null && report.ReportData.Filters.Any())
                        {
                            filterCriteria  = report.ReportData.Filters.Select(x => string.Concat(x.AndOr, ReportManager.EqualDelimeter, x.Field.FieldName, ReportManager.EqualDelimeter, x.Operator, ReportManager.EqualDelimeter, x.FieldValue)).ToList();
                            dateTypeFilters = report.ReportData.Filters.Where(x => x.Field.IsDate).Select(x => x.Field.FieldName).ToList();
                        }

                        if (report.ReportData.SortBy != null && !string.IsNullOrWhiteSpace(report.ReportData.SortBy.SortField))
                        {
                            if (isChart)
                            {
                                var field = report.ReportData.SelectedFields.FirstOrDefault(x => x.FieldName == report.ReportData.SortBy.SortField);
                                if (field != null)
                                {
                                    if (ReportManager.DateFunctionOrderByMap.ContainsKey(field.SelectedFieldAggr))
                                    {
                                        orderByColumn = string.Concat(field.FieldName, ReportManager.EqualDelimeter, ReportManager.DateFunctionOrderByMap[field.SelectedFieldAggr]);
                                        groupCriteria.Add(orderByColumn);
                                    }
                                }
                            }

                            if (string.IsNullOrWhiteSpace(orderByColumn))
                            {
                                orderByColumn = report.ReportData.SortBy.SortField;
                            }



                            orderByIsDesc = report.ReportData.SortBy.SortType.Equals(ReportManager.SqlDesc.Trim());
                        }

                        QueryOption queryOption = new QueryOption(connectionString, tableName, selectList)
                        {
                            WhereCriteria    = filterCriteria,
                            OrderByColumn    = orderByColumn,
                            IsOrderByDesc    = orderByIsDesc,
                            GroupByColumns   = groupCriteria,
                            IsChartQuery     = isChart,
                            IsGetDataColumns = isChart,
                            DateTypeFilters  = dateTypeFilters
                        };

                        reportResult = ReportManager.RunQuery(queryOption);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("RunReport", ex);
            }

            return(reportResult);;
        }
Example #37
0
 public StepOptions(SavedReport o)
     : base()
 {
     report = o;
     InitializeComponent();
 }
        public override ReportResult Run(SavedReport report)
        {
            EliminationReportOptions standardOpts = (EliminationReportOptions)report.StandardReportOptions;
            ReportOptions options = report.ReportOptions;
            DistributionReportGenerator gen = new DistributionReportGenerator();
            DiseaseRepository repo = new DiseaseRepository();
            DemoRepository demo = new DemoRepository();
            foreach (var disease in standardOpts.Diseases)
            {
                DiseaseDistroPc dd = repo.Create((DiseaseType)disease.Id);

                switch (disease.Id)
                {
                    case (int)DiseaseType.Lf:
                        AddIndicators(disease.Id, "DDLFDiseaseDistributionPcInterventions", dd, options);
                        break;
                    case (int)DiseaseType.Trachoma:
                        AddIndicators(disease.Id, "DDTraDiseaseDistributionPcInterventions", dd, options);
                        break;
                    case (int)DiseaseType.Oncho:
                        AddIndicators(disease.Id, "DDOnchoDiseaseDistributionPcInterventio", dd, options);
                        break;
                    case (int)DiseaseType.STH:
                        AddIndicators(disease.Id, "DDSTHDiseaseDistributionPcInterventions", dd, options);
                        break;
                    case (int)DiseaseType.Schisto:
                        AddIndicators(disease.Id, "DDSchistoDiseaseDistributionPcIntervent", dd, options);
                        break;
                    default:
                        break;
                }
            }

            // need to add the proper sumation stuff
            report.ReportOptions.IsByLevelAggregation = true;
            report.ReportOptions.IsCountryAggregation = false;
            report.ReportOptions.IsNoAggregation = false;
            report.ReportOptions.SelectedAdminLevels = demo.GetAdminLevelByLevel(standardOpts.DistrictType.LevelNumber).Where(a => a.LevelNumber == standardOpts.DistrictType.LevelNumber).ToList();

            // run report
            ReportResult result = gen.Run(report);

            Dictionary<string, DataRow> years = new Dictionary<string,DataRow>();
            DataTable summed = new DataTable();
            summed.Columns.Add(new DataColumn(TranslationLookup.GetValue("Location")));
            summed.Columns.Add(new DataColumn(TranslationLookup.GetValue("Year"), typeof(string)));
            summed.Columns.Add(new DataColumn(string.Format(TranslationLookup.GetValue("EliminationEndemicDistricts"), standardOpts.DistrictType.DisplayName), typeof(int)));
            summed.Columns.Add(new DataColumn(string.Format(TranslationLookup.GetValue("EliminationStoppedDistricts"), standardOpts.DistrictType.DisplayName), typeof(int)));
            
            foreach (DataRow row in result.DataTableResults.Rows)
            {
                string endemicty = "";
                int totalEndemic = 0, totalStopped = 0;
                if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDLFDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("LF")))
                {
                    endemicty = row[TranslationLookup.GetValue("DDLFDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("LF")].ToString();
                    if (endemicty == TranslationLookup.GetValue("LfEnd1") || endemicty == TranslationLookup.GetValue("LfEndPending"))
                        totalEndemic++;
                    else if (endemicty == TranslationLookup.GetValue("LfEnd100"))
                        totalStopped++;
                }
                if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDOnchoDiseaseDistributionPcInterventio") + " - " + TranslationLookup.GetValue("Oncho")))
                {
                    endemicty = row[TranslationLookup.GetValue("DDOnchoDiseaseDistributionPcInterventio") + " - " + TranslationLookup.GetValue("Oncho")].ToString();
                    if (endemicty == TranslationLookup.GetValue("Oncho1") || endemicty == TranslationLookup.GetValue("OnchoPending"))
                        totalEndemic++;
                    else if (endemicty == TranslationLookup.GetValue("Oncho100"))
                        totalStopped++;
                }
                if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDSchistoDiseaseDistributionPcIntervent") + " - " + TranslationLookup.GetValue("Schisto")))
                {
                    endemicty = row[TranslationLookup.GetValue("DDSchistoDiseaseDistributionPcIntervent") + " - " + TranslationLookup.GetValue("Schisto")].ToString();
                    if (endemicty == TranslationLookup.GetValue("Sch1") || endemicty == TranslationLookup.GetValue("Sch2") || endemicty == TranslationLookup.GetValue("Sch2a") || endemicty == TranslationLookup.GetValue("Sch3") || endemicty == TranslationLookup.GetValue("Sch3a")
                        || endemicty == TranslationLookup.GetValue("Sch3b") || endemicty == TranslationLookup.GetValue("Sch20") || endemicty == TranslationLookup.GetValue("Sch30") || endemicty == TranslationLookup.GetValue("Sch40")
                        || endemicty == TranslationLookup.GetValue("SchPending"))
                        totalEndemic++;
                    else if (endemicty == TranslationLookup.GetValue("Sch100"))
                        totalStopped++;
                }

                if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDSTHDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("STH")))
                {
                    endemicty = row[TranslationLookup.GetValue("DDSTHDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("STH")].ToString();
                    if (endemicty == TranslationLookup.GetValue("Sth2") || endemicty == TranslationLookup.GetValue("Sth3") || endemicty == TranslationLookup.GetValue("Sth10") || endemicty == TranslationLookup.GetValue("Sth20")
                        || endemicty == TranslationLookup.GetValue("Sth30") || endemicty == TranslationLookup.GetValue("Sth40") || endemicty == TranslationLookup.GetValue("SthPending"))
                        totalEndemic++;
                    else if (endemicty == TranslationLookup.GetValue("Sth100"))
                        totalStopped++;
                }
                if (result.DataTableResults.Columns.Contains(TranslationLookup.GetValue("DDTraDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("Trachoma")))
                {
                    endemicty = row[TranslationLookup.GetValue("DDTraDiseaseDistributionPcInterventions") + " - " + TranslationLookup.GetValue("Trachoma")].ToString();
                    if (endemicty == TranslationLookup.GetValue("Tra1") || endemicty == TranslationLookup.GetValue("Tra4") || endemicty == TranslationLookup.GetValue("Tra5")
                        || endemicty == TranslationLookup.GetValue("TraPending"))
                        totalEndemic++;
                    else if (endemicty == TranslationLookup.GetValue("Tra100"))
                        totalStopped++;
                }

                if (!years.ContainsKey(row[TranslationLookup.GetValue("Year")].ToString()))
                {
                    DataRow dr = summed.NewRow();
                    dr[TranslationLookup.GetValue("Year")] = row[TranslationLookup.GetValue("Year")];
                    dr[string.Format(TranslationLookup.GetValue("EliminationEndemicDistricts"), standardOpts.DistrictType.DisplayName)] = totalEndemic;
                    dr[string.Format(TranslationLookup.GetValue("EliminationStoppedDistricts"), standardOpts.DistrictType.DisplayName)] = totalStopped;
                    years.Add(row[TranslationLookup.GetValue("Year")].ToString(), dr);
                    summed.Rows.Add(dr);
                }
                else
                {
                    years[row[TranslationLookup.GetValue("Year")].ToString()][string.Format(TranslationLookup.GetValue("EliminationEndemicDistricts"), standardOpts.DistrictType.DisplayName)] =
                        totalEndemic + (int)years[row[TranslationLookup.GetValue("Year")].ToString()][string.Format(TranslationLookup.GetValue("EliminationEndemicDistricts"), standardOpts.DistrictType.DisplayName)];
                    years[row[TranslationLookup.GetValue("Year")].ToString()][string.Format(TranslationLookup.GetValue("EliminationStoppedDistricts"), standardOpts.DistrictType.DisplayName)] =
                        totalStopped + (int)years[row[TranslationLookup.GetValue("Year")].ToString()][string.Format(TranslationLookup.GetValue("EliminationStoppedDistricts"), standardOpts.DistrictType.DisplayName)];
                }
            }

            result.DataTableResults = summed;
            result.ChartData = summed.Copy();
            report.ReportOptions.IsByLevelAggregation = false;
            report.ReportOptions.IsCountryAggregation = true; // to show only year

            return result;
        }
Example #39
0
 private void EditPersonsTreatedAndCoverageReport(SavedReport r)
 {
     WizardForm wiz = new WizardForm(new PersonsTreatedCoverageOptions(r), Translations.PersonsTreatedAndCoverageReport);
     wiz.Height = 685;
     wiz.OnRunReport = RunPersonsTreatedAndCoverageReport;
     wiz.Show();
 }
Example #40
0
 public StepIndicators(SavedReport o)
     : base()
 {
     report = o;
     InitializeComponent();
 }
Example #41
0
 public CustomReportView(SavedReport o)
     : base()
 {
     report = o;
     InitializeComponent();
 }
Example #42
0
 private void RunPersonsTreatedAndCoverageReport(SavedReport r)
 {
     CustomReportView report = new CustomReportView(r);
     report.OnEditReport = EditPersonsTreatedAndCoverageReport;
     report.Show();
 }
Example #43
0
        /// <summary>
        /// Runs the report with the report options and collects all the disease distribution calculation
        /// </summary>
        /// <param name="mainReportOptions">The report options</param>
        public void Run(ReportOptions mainReportOptions)
        {
            SettingsRepository settingsRepo = new SettingsRepository();

            Report = new SavedReport();
            DistributionReportGenerator gen = new DistributionReportGenerator();

            Report.ReportOptions = new ReportOptions();
            Report.ReportOptions.SelectedIndicators = new List<ReportIndicator>();

            Report.ReportOptions.Years = Util.DeepClone(mainReportOptions.Years);
            Report.ReportOptions.SelectedAdminLevels = Util.DeepClone(mainReportOptions.SelectedAdminLevels);
            Report.ReportOptions.MonthYearStarts = 1;
            Report.ReportOptions.IsByLevelAggregation = true;
            Report.ReportOptions.IsCountryAggregation = false;
            Report.ReportOptions.IsNoAggregation = false;

            // Determine the name of the reporting admin level
            if (mainReportOptions.SelectedAdminLevels.Count > 0)
            {
                int levelNum = mainReportOptions.SelectedAdminLevels[0].LevelNumber;
                AdminLevelType adminLevelType = settingsRepo.GetAdminLevelTypeByLevel(levelNum);
                NameOfReportingAdminLevel = adminLevelType.DisplayName;
            }
            if (NameOfReportingAdminLevel == null)
                throw new ArgumentException("Could not determine reporting level");

            // STH
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.STH,
                        new KeyValuePair<string, Indicator>("DDSTHPopulationRequiringPc", new Indicator { Id = 141, DisplayName = "DDSTHPopulationRequiringPc" })));
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.STH,
                        new KeyValuePair<string, Indicator>("DDSTHPsacAtRisk", new Indicator { Id = 142, DisplayName = "DDSTHPsacAtRisk" })));
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.STH,
                        new KeyValuePair<string, Indicator>("DDSTHSacAtRisk", new Indicator { Id = 143, DisplayName = "DDSTHSacAtRisk" })));
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.STH,
                        new KeyValuePair<string, Indicator>("DDSTHPopulationAtRisk", new Indicator { Id = 140, DisplayName = "DDSTHPopulationAtRisk" })));
            // LF
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Lf,
                    new KeyValuePair<string, Indicator>("DDLFPopulationAtRisk", new Indicator { Id = 98, DisplayName = "DDLFPopulationAtRisk" })));
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Lf,
                        new KeyValuePair<string, Indicator>("DDLFPopulationRequiringPc", new Indicator { Id = 99, DisplayName = "DDLFPopulationRequiringPc" })));
            // Oncho
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Oncho,
                    new KeyValuePair<string, Indicator>("DDOnchoPopulationAtRisk", new Indicator { Id = 111, DisplayName = "DDOnchoPopulationAtRisk" })));
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Oncho,
                        new KeyValuePair<string, Indicator>("DDOnchoPopulationRequiringPc", new Indicator { Id = 112, DisplayName = "DDOnchoPopulationRequiringPc" })));
            // Schisto
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Schisto,
                        new KeyValuePair<string, Indicator>("DDSchistoPopulationAtRisk", new Indicator { Id = 125, DisplayName = "DDSchistoPopulationAtRisk" })));
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Schisto,
                        new KeyValuePair<string, Indicator>("DDSchistoPopulationRequiringPc", new Indicator { Id = 126, DisplayName = "DDSchistoPopulationRequiringPc" })));
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Schisto,
                        new KeyValuePair<string, Indicator>("DDSchistoSacAtRisk", new Indicator { Id = 127, DisplayName = "DDSchistoSacAtRisk" })));
            // Trachoma
            Report.ReportOptions.SelectedIndicators.Add(ReportRepository.CreateReportIndicator((int)DiseaseType.Trachoma,
                    new KeyValuePair<string, Indicator>("DDTraPopulationAtRisk", new Indicator { Id = 161, DisplayName = "DDTraPopulationAtRisk" })));

            // Run the report
            Result = gen.Run(Report);
        }