示例#1
0
 private void lnkSurvey_ClickOverride()
 {
     ReportRepository repo = new ReportRepository();
     opts.EntityType = Model.IndicatorEntityType.Survey;
     opts.AvailableIndicators = repo.GetSurveyIndicators(false);
     SurveyRepository typeRepo = new SurveyRepository();
     var types = typeRepo.GetSurveyTypes();
     opts.FormTypes = types.Select(t => t.SurveyTypeName).OrderBy(t => t).ToList();
     OnSwitchStep(new IndStepIndicators(opts));
 }
示例#2
0
 private void lnkSurvey_ClickOverride()
 {
     ReportRepository repo = new ReportRepository();
     report.ReportOptions.ShowDiseasesOption = false;
     report.ReportOptions.EntityType = Model.IndicatorEntityType.Survey;
     report.ReportOptions.CategoryName = Translations.Surveys;
     report.ReportOptions.ReportGenerator = new SurveyReportGenerator();
     report.ReportOptions.AvailableIndicators = repo.GetSurveyIndicators();
     report.ReportOptions.HideAggregation = true;
     OnSwitchStep(new StepIndicators(report));
 }
示例#3
0
        public void CreateIndicatorOptionUpdateForm()
        {
            string path = ConfigurationManager.AppSettings["AutomatedListsSavePath"];

            DataTable table = new DataTable();
            table.Columns.Add(new DataColumn("Indicator Id"));
            table.Columns.Add(new DataColumn("Type Id"));
            table.Columns.Add(new DataColumn("Type Name"));
            table.Columns.Add(new DataColumn("Form Name"));
            table.Columns.Add(new DataColumn("Indicator Name"));
            table.Columns.Add(new DataColumn("Indicator Option ID"));
            table.Columns.Add(new DataColumn("Indicator Option"));
            table.Columns.Add(new DataColumn("Weighted Ranking"));
            ReportRepository repo = new ReportRepository();
            List<ReportIndicator> indicators = repo.GetDiseaseDistroIndicators();
            foreach (var cmpc in indicators)
                foreach (var cat in cmpc.Children)
                    AddOptions(table, cat.Children.Where(x => x.DataTypeId == (int)IndicatorDataType.Dropdown), cat.Name, IndicatorEntityType.DiseaseDistribution);
            indicators = repo.GetSurveyIndicators();
            foreach (var cmpc in indicators)
                foreach (var cat in cmpc.Children)
                    AddOptions(table, cat.Children.Where(x => x.DataTypeId == (int)IndicatorDataType.Dropdown), cat.Name, IndicatorEntityType.Survey);
            indicators = repo.GetIntvIndicators();
            foreach (var cmpc in indicators)
                foreach (var cat in cmpc.Children)
                    AddOptions(table, cat.Children.Where(x => x.DataTypeId == (int)IndicatorDataType.Dropdown), cat.Name, IndicatorEntityType.Intervention);
            indicators = repo.GetProcessIndicators();
            foreach (var cmpc in indicators)
                foreach (var cat in cmpc.Children)
                    AddOptions(table, cat.Children.Where(x => x.DataTypeId == (int)IndicatorDataType.Dropdown), cat.Name, IndicatorEntityType.Process);

            ProcessRepository prepo = new ProcessRepository();
            ProcessBase saes = prepo.Create(9);
            foreach (var i in saes.ProcessType.Indicators)
                indicators.Add(ReportRepository.CreateReportIndicator(saes.ProcessType.Id, i));
            AddOptions(table, indicators.Where(x => x.DataTypeId == (int)IndicatorDataType.Dropdown), saes.ProcessType.TypeName, IndicatorEntityType.Process);

            using (ExcelPackage pck = new ExcelPackage())
            {
                ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Sheet1");
                ws.Cells["A1"].LoadFromDataTable(table, true);
                File.WriteAllBytes(path + string.Format("IndicatorDropdownWeightedRules_{0}.xlsx", DateTime.Now.ToString("yyyyMMdd")), pck.GetAsByteArray());
            }
        }