Exemple #1
0
        public static ReportData <Row> build(Guid orgId)
        {
            var repo     = new ProjectOrganisationRepository();
            var agencies = repo.FetchReferralAgencies(orgId);

            var rows = new List <Row>();

            foreach (var agency in agencies)
            {
                rows.Add(new Row(agency.Id, agency.Name, agency.ReviewDate));
            }

            rows.Sort(
                delegate(Row lhs, Row rhs) {
                if (!lhs.ReviewDate.HasValue)
                {
                    return(1);
                }
                if (!rhs.ReviewDate.HasValue)
                {
                    return(-1);
                }
                return(lhs.ReviewDate.Value.CompareTo(rhs.ReviewDate.Value));
            }
                );

            ReportData <Row> reportData = new ReportData <Row>(rows);

            reportData.Put("agencyCount", rows.Count.ToString());

            return(reportData);
        } // build
Exemple #2
0
        } // createReferralReport

        private ReferralReport createReferralReport(Client client)
        {
            var poRepo     = new ProjectOrganisationRepository();
            var projectOrg = poRepo.GetByStaffMember(User.Identity.Name);

            var report = new ReferralReport(staffName(User.Identity.Name));

            var ra = client.CurrentRiskAssessment;

            var who = poRepo.FetchReferralAgencies(projectOrg.Id);

            foreach (var theme in ra.ThemeAssessments)
            {
                foreach (var category in theme.Categories)
                {
                    foreach (var risk in category.Risks)
                    {
                        if (risk.Status == "notAtRisk")
                        {
                            continue;
                        }

                        foreach (var agency in who)
                        {
                            foreach (var riskId in agency.AssociatedRiskIds)
                            {
                                if (riskId == risk.Id)
                                {
                                    report.add(risk.Id, agency);
                                }
                            }
                        }
                    }
                }
            }
            return(report);
        } // createReferralReport
 public IEnumerable<ReferralAgency> OrganisationReferralAgencies(Guid id) {
   return repo_.FetchReferralAgencies(id);
 } // OrganisationReferralAgencies