private void lnkProcess_ClickOverride()
 {
     ReportRepository repo = new ReportRepository();
     opts.EntityType = Model.IndicatorEntityType.Process;
     opts.AvailableIndicators = repo.GetProcessIndicators();
     ProcessRepository typeRepo = new ProcessRepository();
     var types = typeRepo.GetProcessTypes().Select(t => t.TypeName).ToList();
     ProcessBase saes = typeRepo.Create(9);
     types.Add(saes.ProcessType.TypeName);
     opts.FormTypes = types.OrderBy(t => t).ToList();
     OnSwitchStep(new IndStepIndicators(opts));
 }
        private List<KeyValuePair<string, int>> GetFormTypes(DataRow dr)
        {
            var result = new List<KeyValuePair<string, int>>();
            if (!string.IsNullOrEmpty(dr["Type ID"].ToString()))
            {
                var entityType = (IndicatorEntityType)Convert.ToInt32(dr["Type ID"]);

                switch (entityType)
                {
                    case IndicatorEntityType.DiseaseDistribution:
                        DiseaseRepository typeRepo = new DiseaseRepository();
                        result = typeRepo.GetSelectedDiseases().Select(d => new KeyValuePair<string, int>(d.DisplayName, d.Id)).ToList();
                        break;
                    case IndicatorEntityType.Intervention:
                        IntvRepository intv = new IntvRepository();
                        result = intv.GetAllTypes().Select(d => new KeyValuePair<string, int>(d.IntvTypeName, d.Id)).ToList();
                        break;
                    case IndicatorEntityType.Survey:
                        SurveyRepository sRepo = new SurveyRepository();
                        result = sRepo.GetSurveyTypes().Select(d => new KeyValuePair<string, int>(d.SurveyTypeName, d.Id)).ToList();
                        break;
                    case IndicatorEntityType.Process:
                        ProcessRepository pRepo = new ProcessRepository();
                        result = pRepo.GetProcessTypes().Select(d => new KeyValuePair<string, int>(d.TypeName, d.Id)).ToList();
                        break;
                }        
            }
            return result;
        }
        public List<ReportIndicator> GetProcessIndicators()
        {
            List<ReportIndicator> indicators = new List<ReportIndicator>();
            ProcessRepository repo = new ProcessRepository();
            var types = repo.GetProcessTypes();
            var pc = new ReportIndicator { Name = TranslationLookup.GetValue("PcNtds"), IsCategory = true };
            var cm = new ReportIndicator { Name = TranslationLookup.GetValue("OtherNtds"), IsCategory = true };
            types.RemoveAll(t => t.TypeName == TranslationLookup.GetValue("SAEs"));
            indicators.Add(pc);
            indicators.Add(cm);
            foreach (var t in types.Where(i => i.DiseaseType == TranslationLookup.GetValue("PC")).OrderBy(t => t.TypeName))
            {
                var cat = new ReportIndicator { Name = t.TypeName, IsCategory = true };
                var instance = repo.Create(t.Id);
                foreach (var i in instance.ProcessType.Indicators)
                    cat.Children.Add(CreateReportIndicator(t.Id, i, t.TypeName, t.DisplayNameKey));
                cat.Children = cat.Children.OrderBy(c => c.Name).ToList();
                pc.Children.Add(cat);
            }
            foreach (var t in types.Where(i => i.DiseaseType == TranslationLookup.GetValue("CM")).OrderBy(t => t.TypeName))
            {
                var cat = new ReportIndicator { Name = t.TypeName, IsCategory = true };
                var instance = repo.Create(t.Id);
                foreach (var i in instance.ProcessType.Indicators)
                    cat.Children.Add(CreateReportIndicator(t.Id, i, t.TypeName, t.DisplayNameKey));
                cat.Children = cat.Children.OrderBy(c => c.Name).ToList();
                cm.Children.Add(cat);
            }

            // SAEs
            ProcessBase saes = repo.Create(9);
            var saeCat = new ReportIndicator { Name = saes.ProcessType.TypeName, IsCategory = true };
            foreach (var i in saes.ProcessType.Indicators)
                saeCat.Children.Add(CreateReportIndicator(saes.ProcessType.Id, i, saes.ProcessType.TypeName, saes.ProcessType.DisplayNameKey));
            saeCat.Children = saeCat.Children.OrderBy(c => c.Name).ToList();
            indicators.Add(saeCat);

            return indicators;
        }