Beispiel #1
0
        public IEnumerable <TracingCentreStats> GetAllTracingCentreStats()
        {
            var TracingCentres = _tracingCentreRepository.GetAllTracingCentres().ToList();

            List <TracingCentreStats> AllStats = new List <TracingCentreStats>();

            foreach (TracingCentre centre in TracingCentres)
            {
                var CasesAssignedLast28Days_    = _caseService.CasesAssignedToTracingCentreLast28Days(centre);
                var CasesReachedLast28Days_     = _caseService.CasesTracedByTracingCentreLast28Days(centre);
                var AverageTraceTimeLast28Days_ = _caseService.AverageTraceTimeOfCentreLast28Days(centre);


                TracingCentreStats stats = new TracingCentreStats
                {
                    Name = centre.Name,
                    AverageTraceTimeLast28Days       = AverageTraceTimeLast28Days_,
                    CasesAssignedLast28Days          = CasesAssignedLast28Days_,
                    CasesReachedLast28Days           = CasesReachedLast28Days_,
                    PercentageCasesReachedLast28Days = Math.Round((double)CasesReachedLast28Days_ / CasesAssignedLast28Days_ * 100, 1)
                };
                AllStats.Add(stats);
            }

            return(AllStats);
        }