Пример #1
0
        private void PopulateJobGroupsSheet(IXLWorkbook workbook)
        {
            var jobGroups = jobGroupsDataService.GetJobGroupsAlphabetical()
                            .OrderBy(x => x.id)
                            .Select(
                item => new { JobGroupID = item.id, JobGroupName = item.name }
                );

            AddSheetToWorkbook(workbook, JobGroupsSheetName, jobGroups);
        }
Пример #2
0
 private void PopulateLearnerInformationExtraFields(
     LearnerInformationViewModel model,
     RegistrationData data
     )
 {
     model.CustomFields    = GetEditCustomFieldsFromModel(model, data.Centre !.Value);
     model.JobGroupOptions = SelectListHelper.MapOptionsToSelectListItems(
         jobGroupsDataService.GetJobGroupsAlphabetical(),
         model.JobGroup
         );
 }
Пример #3
0
        internal BulkUploadResult ProcessDelegatesTable(IXLTable table, int centreId, DateTime?welcomeEmailDate = null)
        {
            var jobGroupIds  = jobGroupsDataService.GetJobGroupsAlphabetical().Select(item => item.id).ToList();
            var delegateRows = table.Rows().Skip(1).Select(row => new DelegateTableRow(table, row)).ToList();

            foreach (var delegateRow in delegateRows)
            {
                ProcessDelegateRow(centreId, welcomeEmailDate, delegateRow, jobGroupIds);
            }

            return(new BulkUploadResult(delegateRows));
        }
Пример #4
0
        public IActionResult Index(
            int page             = 1,
            string?searchString  = null,
            string?sortBy        = null,
            string sortDirection = BaseSearchablePageViewModel.Ascending,
            string?filterBy      = null,
            string?filterValue   = null
            )
        {
            sortBy ??= DefaultSortByOptions.Name.PropertyName;
            filterBy = FilteringHelper.GetFilterBy(
                filterBy,
                filterValue,
                Request,
                DelegateFilterCookieName,
                DelegateActiveStatusFilterOptions.IsActive.FilterValue
                );

            var centreId      = User.GetCentreId();
            var jobGroups     = jobGroupsDataService.GetJobGroupsAlphabetical();
            var customPrompts = centreCustomPromptHelper.GetCustomPromptsForCentre(centreId);
            var delegateUsers = userDataService.GetDelegateUserCardsByCentreId(centreId);

            var model = new AllDelegatesViewModel(
                delegateUsers,
                jobGroups,
                customPrompts,
                page,
                searchString,
                sortBy,
                sortDirection,
                filterBy
                );

            Response.UpdateOrDeleteFilterCookie(DelegateFilterCookieName, filterBy);

            return(View(model));
        }
Пример #5
0
        public IActionResult Index(
            string?filterBy    = null,
            string?filterValue = null,
            bool selectAll     = false
            )
        {
            var newFilterBy   = FilteringHelper.GetFilterBy(filterBy, filterValue, Request, EmailDelegateFilterCookieName);
            var jobGroups     = jobGroupsDataService.GetJobGroupsAlphabetical();
            var customPrompts = centreCustomPromptHelper.GetCustomPromptsForCentre(User.GetCentreId());
            var delegateUsers = GetDelegateUserCards();

            var model = new EmailDelegatesViewModel(
                delegateUsers,
                jobGroups,
                customPrompts,
                newFilterBy,
                selectAll
                );

            Response.UpdateOrDeleteFilterCookie(EmailDelegateFilterCookieName, newFilterBy);

            return(View(model));
        }
Пример #6
0
        public IActionResult EditDetails(DlsSubApplication dlsSubApplication)
        {
            var userAdminId    = User.GetAdminId();
            var userDelegateId = User.GetCandidateId();

            var(adminUser, delegateUser) = userService.GetUsersById(userAdminId, userDelegateId);

            var jobGroups     = jobGroupsDataService.GetJobGroupsAlphabetical().ToList();
            var customPrompts =
                promptsService.GetEditDelegateRegistrationPromptViewModelsForCentre(delegateUser, User.GetCentreId());

            var model = new MyAccountEditDetailsViewModel(
                adminUser,
                delegateUser,
                jobGroups,
                customPrompts,
                dlsSubApplication
                );

            return(View(model));
        }
Пример #7
0
        public void GetDelegatesAndJobGroupDownloadFileForCentre_returns_expected_excel_data()
        {
            // Given
            A.CallTo(() => jobGroupsDataService.GetJobGroupsAlphabetical()).Returns(
                JobGroupsTestHelper.GetDefaultJobGroupsAlphabetical()
                );

            A.CallTo(() => userDataService.GetDelegateUserCardsByCentreId(2)).Returns(delegateUserCards);

            // When
            var resultBytes = delegateDownloadFileService.GetDelegatesAndJobGroupDownloadFileForCentre(2);

            using var resultsStream  = new MemoryStream(resultBytes);
            using var resultWorkbook = new XLWorkbook(resultsStream);

            // Then
            using var expectedWorkbook = new XLWorkbook(
                      TestContext.CurrentContext.TestDirectory + DelegateUploadFileServiceTests.TestDelegateUploadRelativeFilePath
                      );
            SpreadsheetTestHelper.AssertSpreadsheetsAreEquivalent(expectedWorkbook, resultWorkbook);
        }
        GenerateGroupsFromRegistrationField_calls_data_service_methods_with_correct_values_for_job_group()
        {
            // Given
            const string groupName  = "Nursing";
            const int    jobGroupId = 1;

            var timeNow   = DateTime.UtcNow;
            var jobGroups = new List <(int id, string name)> {
                (jobGroupId, groupName)
            };
            var registrationField      = RegistrationField.JobGroup;
            var groupGenerationDetails = new GroupGenerationDetails(
                1,
                101,
                registrationField,
                false,
                true,
                false,
                true,
                true
                );

            A.CallTo(() => jobGroupsDataService.GetJobGroupsAlphabetical()).Returns(jobGroups);

            SetUpGenerateGroupFakes(timeNow);

            // When
            groupsService.GenerateGroupsFromRegistrationField(groupGenerationDetails);

            // Then
            AssertCorrectMethodsAreCalledForGenerateGroups(
                groupGenerationDetails,
                timeNow,
                registrationField.LinkedToFieldId,
                groupName,
                groupName,
                jobGroupId
                );
        }
Пример #9
0
 public IEnumerable <(int, string)> GetJobGroupsAlphabetical()
 {
     return(jobGroupsDataService.GetJobGroupsAlphabetical());
 }