Example #1
0
        } // findClients

        public RiskMap projectRiskMap(Guid?orgId, Guid projId)
        {
            using (var rmRepo = new RiskMapRepository(orgId)) {
                var riskMap = projects.Where(s => s.Id == projId).Single().RiskFramework;
                return(rmRepo.RiskMap(riskMap));
            } // using ...
        }     // projectRiskMap
Example #2
0
        public static ReportData <ThemeRow> build(Guid orgId, Guid projId, Guid?locId, DateTime?startDate, DateTime?endDate)
        {
            ProjectOrganisationRepository poRepo = new ProjectOrganisationRepository();
            RiskMapRepository             rmRepo = new RiskMapRepository(orgId);
            ClientRepository clientRepo          = new ClientRepository();

            ProjectOrganisation po      = poRepo.Get(orgId);
            Project             project = poRepo.FindProject(orgId, projId);
            RiskMap             riskMap = rmRepo.RiskMap(project.RiskFramework);
            IList <ClientData>  clients = clientRepo.ProjectClientData(projId, locId);

            IDictionary <Guid, ResolutionRow> report = new Dictionary <Guid, ResolutionRow>();

            foreach (var risk in riskMap.Risks)
            {
                report.Add(risk.Id, new ResolutionRow(risk));
            }

            HashSet <Guid> clientsSeen = new HashSet <Guid>();

            foreach (var client in clients)
            {
                if (client.RiskAssessments == null || client.RiskAssessments.Count == 0)
                {
                    continue;
                }
                foreach (var rad in client.RiskAssessments)
                {
                    if (Reports.outOfBounds(rad.Timestamp, startDate, endDate))
                    {
                        continue;
                    }
                    foreach (var riskId in rad.Risks())
                    {
                        ResolutionRow row = report[riskId];
                        row.Open(client);
                    }
                    foreach (var riskId in rad.ResolvedRisks())
                    {
                        ResolutionRow row = report[riskId];
                        row.Close(client);
                    }

                    clientsSeen.Add(client.Id);
                } // foreach RiskAssessment
            }     // foreach Client

            IList <ThemeRow> themes = new List <ThemeRow>();

            foreach (var theme in riskMap.AllThemes())
            {
                var catRows = buildCatRows(theme, riskMap, report);
                themes.Add(new ThemeRow(theme, catRows));
            } // foreach

            ReportData <ThemeRow> reportData =
                new ReportData <ThemeRow>(themes);

            reportData.Put("clientCount", clientsSeen.Count.ToString());
            reportData.Put("csvurl", Reports.csvUrl("resolution", orgId, projId, locId, startDate, endDate));

            return(reportData);
        } // resolutionReport
 protected RiskMap riskMap(Guid id)
 {
     using (var riskMapRepo = new RiskMapRepository(null))
         return(riskMapRepo.RiskMap(id));
 } // RiskMap