示例#1
0
        private async Task <EstablishmentSearchViewModel> PopulateLookups(EstablishmentSearchViewModel vm)
        {
            vm.LocalAuthorities = (await _lookupService.LocalAuthorityGetAllAsync()).OrderBy(x => x.Name)
                                  .Select(x => new LookupItemViewModel(x));
            vm.GovernorRoles = (await _lookupService.GovernorRolesGetAllAsync()).OrderBy(x => x.Name)
                               .Select(x => new LookupItemViewModel(x));
            vm.AdmissionsPolicies = (await _lookupService.AdmissionsPoliciesGetAllAsync()).OrderBy(x => x.Name)
                                    .Select(x => new LookupItemViewModel(x));
            vm.BoardingProvisions = (await _lookupService.ProvisionBoardingGetAllAsync()).OrderBy(x => x.Name)
                                    .Select(x => new LookupItemViewModel(x));
            vm.Dioceses = (await _lookupService.DiocesesGetAllAsync()).OrderBy(x => x.Name)
                          .Select(x => new LookupItemViewModel(x));
            vm.Districts = (await _lookupService.AdministrativeDistrictsGetAllAsync()).OrderBy(x => x.Name)
                           .Select(x => new LookupItemViewModel(x));
            vm.FurtherEducationTypes = (await _lookupService.FurtherEducationTypesGetAllAsync())
                                       .OrderBy(x => x.Name)
                                       .Select(x => new LookupItemViewModel(x));
            vm.Genders = (await _lookupService.GendersGetAllAsync()).OrderBy(x => x.Name)
                         .Select(x => new LookupItemViewModel(x));
            vm.GORs = (await _lookupService.GovernmentOfficeRegionsGetAllAsync()).OrderBy(x => x.Name)
                      .Select(x => new LookupItemViewModel(x));
            vm.NurseryProvisions = (await _lookupService.ProvisionNurseriesGetAllAsync()).OrderBy(x => x.Name)
                                   .Select(x => new LookupItemViewModel(x));
            vm.ParliamentaryConstituencies = (await _lookupService.ParliamentaryConstituenciesGetAllAsync())
                                             .OrderBy(x => x.Name)
                                             .Select(x => new LookupItemViewModel(x));
            vm.ReligiousEthoses = (await _lookupService.ReligiousEthosGetAllAsync()).OrderBy(x => x.Name)
                                  .Select(x => new LookupItemViewModel(x));
            vm.RSCRegions = (await _lookupService.RscRegionsGetAllAsync()).OrderBy(x => x.Name)
                            .Select(x => new LookupItemViewModel(x));
            vm.Section41Designations = (await _lookupService.Section41ApprovedGetAllAsync()).OrderBy(x => x.Name)
                                       .Select(x => new LookupItemViewModel(x));
            vm.SixthFormProvisions = (await _lookupService.ProvisionOfficialSixthFormsGetAllAsync())
                                     .OrderBy(x => x.Name)
                                     .Select(x => new LookupItemViewModel(x));
            vm.SpecialClassesProvisions = (await _lookupService.ProvisionSpecialClassesGetAllAsync())
                                          .OrderBy(x => x.Name)
                                          .Select(x => new LookupItemViewModel(x));
            vm.TypeOfSENProvisions = (await _lookupService.SpecialEducationNeedsGetAllAsync()).OrderBy(x => x.Name)
                                     .Select(x => new LookupItemViewModel(x));
            vm.UrbanRuralDesignations = (await _lookupService.UrbanRuralGetAllAsync()).OrderBy(x => x.Name)
                                        .Select(x => new LookupItemViewModel(x));
            vm.OfstedRatings = (await _lookupService.OfstedRatingsGetAllAsync()).OrderBy(x => x.Name)
                               .Select(x => new LookupItemViewModel(x));

            return(vm);
        }
示例#2
0
        private async Task DetectSENChanges(EstablishmentModel original, EstablishmentModel model, List <ChangeDescriptorDto> retVal)
        {
            var originalSenIds = (original.SENIds ?? new int[0]).OrderBy(x => x);
            var newSenIds      = (model.SENIds ?? new int[0]).OrderBy(x => x);

            if (!originalSenIds.SequenceEqual(newSenIds))
            {
                var sens = await _cachedLookupService.SpecialEducationNeedsGetAllAsync();

                var originalSenNames = StringUtil.SentencifyNoFormating(originalSenIds.Select(x => sens.FirstOrDefault(s => s.Id == x)?.Name).ToArray());
                var newSenNames      = StringUtil.SentencifyNoFormating(newSenIds.Select(x => sens.FirstOrDefault(s => s.Id == x)?.Name).ToArray());
                retVal.Add(new ChangeDescriptorDto
                {
                    Name     = "Type of SEN provision",
                    NewValue = newSenNames,
                    OldValue = originalSenNames
                });
            }
        }