示例#1
0
        private async Task SetHomepageKpiDetails()
        {
            var userType = _userService.GetUserType(User);

            if (userType == UserType.NhsUser)
            {
                var tbServiceCodes = (await _userService.GetTbServicesAsync(User))
                                     .Select(x => x.Code)
                                     .ToList();
                HomepageKpiDetails = await _homepageKpiService.GetKpiForTbService(tbServiceCodes);
            }
            else
            {
                var phecCodes = (await _userService.GetPhecCodesAsync(User)).ToList();
                HomepageKpiDetails = await _homepageKpiService.GetKpiForPhec(phecCodes);
            }
            KpiFilter = new SelectList(HomepageKpiDetails.OrderBy(x => x.Name), nameof(HomepageKpi.Code), nameof(HomepageKpi.Name));
        }
示例#2
0
        private async Task SetHomepageKpiDetails()
        {
            var userPermissionsFilter = await _userService.GetUserPermissionsFilterAsync(User);

            if (userPermissionsFilter.Type == UserType.NationalTeam)
            {
                HomepageKpiDetails = await _homepageKpiService.GetKpiForAllPhec();
            }
            else if (userPermissionsFilter.IsInAtLeastOneRegion)
            {
                HomepageKpiDetails = await _homepageKpiService.GetKpiForPhec(userPermissionsFilter.IncludedPHECCodes);
            }
            else
            {
                HomepageKpiDetails = await _homepageKpiService.GetKpiForTbService(userPermissionsFilter.IncludedTBServiceCodes);
            }

            KpiFilter = new SelectList(HomepageKpiDetails.OrderBy(x => x.Name), nameof(HomepageKpi.Code), nameof(HomepageKpi.Name));
        }