public AllDelegatesViewModel(
            SearchSortFilterPaginationResult <DelegateUserCard> result,
            IReadOnlyCollection <CentreRegistrationPrompt> centreRegistrationPrompts,
            IEnumerable <FilterModel> availableFilters
            ) : base(
                result,
                true,
                availableFilters,
                "Search delegates"
                )
        {
            var promptsWithOptions =
                centreRegistrationPrompts.Where(registrationPrompt => registrationPrompt.Options.Count > 0);

            Delegates = result.ItemsToDisplay.Select(
                delegateUser =>
            {
                var delegateRegistrationPrompts =
                    PromptsService.GetDelegateRegistrationPrompts(delegateUser, centreRegistrationPrompts);
                return(new SearchableDelegateViewModel(
                           delegateUser,
                           delegateRegistrationPrompts,
                           promptsWithOptions,
                           result.GetReturnPageQuery($"{delegateUser.Id}-card")
                           ));
            }
                );
        }
        public AddGroupDelegateViewModel(
            SearchSortFilterPaginationResult <DelegateUserCard> result,
            IEnumerable <FilterModel> availableFilters,
            List <CentreRegistrationPrompt> customPrompts,
            int groupId,
            string groupName
            ) : base(
                result,
                true,
                availableFilters
                )
        {
            GroupId   = groupId;
            GroupName = groupName;
            var promptsWithOptions = customPrompts.Where(customPrompt => customPrompt.Options.Count > 0);

            Delegates = result.ItemsToDisplay.Select(
                delegateUser =>
            {
                var customFields = PromptsService.GetDelegateRegistrationPrompts(delegateUser, customPrompts);
                return(new SearchableDelegateViewModel(
                           delegateUser,
                           customFields,
                           promptsWithOptions,
                           null
                           ));
            }
                );
        }
        public void Setup()
        {
            centreRegistrationPromptsService = A.Fake <ICentreRegistrationPromptsService>();
            delegateDownloadFileService      = A.Fake <IDelegateDownloadFileService>();
            promptsHelper                   = new PromptsService(centreRegistrationPromptsService);
            userDataService                 = A.Fake <IUserDataService>();
            jobGroupsDataService            = A.Fake <IJobGroupsDataService>();
            searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>();

            httpRequest  = A.Fake <HttpRequest>();
            httpResponse = A.Fake <HttpResponse>();

            const string cookieValue = "ActiveStatus|Active|false";

            allDelegatesController = new AllDelegatesController(
                delegateDownloadFileService,
                userDataService,
                promptsHelper,
                jobGroupsDataService,
                searchSortFilterPaginateService
                )
                                     .WithMockHttpContext(httpRequest, CookieName, cookieValue, httpResponse)
                                     .WithMockUser(true)
                                     .WithMockServices()
                                     .WithMockTempData();
        }
        public void Setup()
        {
            centresDataService        = A.Fake <ICentresDataService>();
            cryptoService             = A.Fake <ICryptoService>();
            jobGroupsDataService      = A.Fake <IJobGroupsDataService>();
            registrationService       = A.Fake <IRegistrationService>();
            userService               = A.Fake <IUserService>();
            promptsService            = A.Fake <PromptsService>();
            featureManager            = A.Fake <IFeatureManager>();
            supervisorDelegateService = A.Fake <ISupervisorDelegateService>();
            request = A.Fake <HttpRequest>();

            controller = new RegisterController(
                centresDataService,
                jobGroupsDataService,
                registrationService,
                cryptoService,
                userService,
                promptsService,
                featureManager,
                supervisorDelegateService
                )
                         .WithDefaultContext()
                         .WithMockRequestContext(request)
                         .WithMockServices()
                         .WithMockTempData();
        }
Esempio n. 5
0
        public void Setup()
        {
            centreRegistrationPromptsService = A.Fake <ICentreRegistrationPromptsService>();
            promptsHelper                   = new PromptsService(centreRegistrationPromptsService);
            userService                     = A.Fake <IUserService>();
            jobGroupsDataService            = A.Fake <IJobGroupsDataService>();
            passwordResetService            = A.Fake <IPasswordResetService>();
            searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>();
            config = A.Fake <IConfiguration>();

            httpRequest  = A.Fake <HttpRequest>();
            httpResponse = A.Fake <HttpResponse>();

            const string cookieValue = "JobGroupId|JobGroupId|1";

            emailDelegatesController = new EmailDelegatesController(
                promptsHelper,
                jobGroupsDataService,
                passwordResetService,
                userService,
                searchSortFilterPaginateService,
                config
                )
                                       .WithMockHttpContext(httpRequest, CookieName, cookieValue, httpResponse)
                                       .WithMockUser(true)
                                       .WithMockServices()
                                       .WithMockTempData();
        }
Esempio n. 6
0
 public void Setup()
 {
     centreRegistrationPromptsService = A.Fake <ICentreRegistrationPromptsService>();
     userService          = A.Fake <IUserService>();
     imageResizeService   = A.Fake <ImageResizeService>();
     jobGroupsDataService = A.Fake <IJobGroupsDataService>();
     promptsService       = new PromptsService(centreRegistrationPromptsService);
 }
        public void SetUp()
        {
            promptsService       = A.Fake <PromptsService>();
            jobGroupsDataService = A.Fake <IJobGroupsDataService>();
            userService          = A.Fake <IUserService>();

            controller = new EditDelegateController(userService, jobGroupsDataService, promptsService)
                         .WithDefaultContext()
                         .WithMockUser(true);
        }
 public EditDelegateController(
     IUserService userService,
     IJobGroupsDataService jobGroupsDataService,
     PromptsService registrationPromptsService
     )
 {
     this.userService          = userService;
     this.jobGroupsDataService = jobGroupsDataService;
     promptsService            = registrationPromptsService;
 }
 public AllDelegatesController(
     IDelegateDownloadFileService delegateDownloadFileService,
     IUserDataService userDataService,
     PromptsService promptsService,
     IJobGroupsDataService jobGroupsDataService,
     ISearchSortFilterPaginateService searchSortFilterPaginateService
     )
 {
     this.delegateDownloadFileService = delegateDownloadFileService;
     this.userDataService             = userDataService;
     this.promptsService                  = promptsService;
     this.jobGroupsDataService            = jobGroupsDataService;
     this.searchSortFilterPaginateService = searchSortFilterPaginateService;
 }
Esempio n. 10
0
 public ViewDelegateController(
     IUserDataService userDataService,
     PromptsService promptsService,
     ICourseService courseService,
     IPasswordResetService passwordResetService,
     IConfiguration config
     )
 {
     this.userDataService      = userDataService;
     this.promptsService       = promptsService;
     this.courseService        = courseService;
     this.passwordResetService = passwordResetService;
     this.config = config;
 }
Esempio n. 11
0
 public GroupDelegatesController(
     IJobGroupsService jobGroupsService,
     IUserService userService,
     PromptsService promptsService,
     IGroupsService groupsService,
     ISearchSortFilterPaginateService searchSortFilterPaginateService
     )
 {
     this.promptsService   = promptsService;
     this.jobGroupsService = jobGroupsService;
     this.userService      = userService;
     this.groupsService    = groupsService;
     this.searchSortFilterPaginateService = searchSortFilterPaginateService;
 }
Esempio n. 12
0
 public MyAccountController(
     ICentreRegistrationPromptsService centreRegistrationPromptsService,
     IUserService userService,
     IImageResizeService imageResizeService,
     IJobGroupsDataService jobGroupsDataService,
     PromptsService registrationPromptsService
     )
 {
     this.centreRegistrationPromptsService = centreRegistrationPromptsService;
     this.userService          = userService;
     this.imageResizeService   = imageResizeService;
     this.jobGroupsDataService = jobGroupsDataService;
     promptsService            = registrationPromptsService;
 }
Esempio n. 13
0
        private IEnumerable <SelectListItem> GetRegistrationFieldOptionsSelectList(int?selectedId = null)
        {
            var centreId = User.GetCentreId();

            var centreCustomPrompts = centreRegistrationPromptsService
                                      .GetCentreRegistrationPromptsThatHaveOptionsByCentreId(centreId);
            var registrationFieldOptions =
                PromptsService.MapCentreRegistrationPromptsToDataForSelectList(centreCustomPrompts);

            var jobGroupOption = (RegistrationField.JobGroup.Id, "Job group");

            registrationFieldOptions.Add(jobGroupOption);

            return(SelectListHelper.MapOptionsToSelectListItems(registrationFieldOptions, selectedId));
        }
 public EmailDelegatesController(
     PromptsService promptsService,
     IJobGroupsDataService jobGroupsDataService,
     IPasswordResetService passwordResetService,
     IUserService userService,
     ISearchSortFilterPaginateService searchSortFilterPaginateService,
     IConfiguration config
     )
 {
     this.promptsService                  = promptsService;
     this.jobGroupsDataService            = jobGroupsDataService;
     this.passwordResetService            = passwordResetService;
     this.userService                     = userService;
     this.searchSortFilterPaginateService = searchSortFilterPaginateService;
     this.config = config;
 }
 public RegisterDelegateByCentreController(
     IJobGroupsDataService jobGroupsDataService,
     IUserService userService,
     PromptsService promptsService,
     ICryptoService cryptoService,
     IUserDataService userDataService,
     IRegistrationService registrationService,
     IConfiguration config
     )
 {
     this.jobGroupsDataService = jobGroupsDataService;
     this.userService          = userService;
     this.promptsService       = promptsService;
     this.userDataService      = userDataService;
     this.registrationService  = registrationService;
     this.cryptoService        = cryptoService;
     this.config = config;
 }
 public RegisterController(
     ICentresDataService centresDataService,
     IJobGroupsDataService jobGroupsDataService,
     IRegistrationService registrationService,
     ICryptoService cryptoService,
     IUserService userService,
     PromptsService promptsService,
     IFeatureManager featureManager,
     ISupervisorDelegateService supervisorDelegateService
     )
 {
     this.centresDataService        = centresDataService;
     this.jobGroupsDataService      = jobGroupsDataService;
     this.registrationService       = registrationService;
     this.cryptoService             = cryptoService;
     this.userService               = userService;
     this.promptsService            = promptsService;
     this.featureManager            = featureManager;
     this.supervisorDelegateService = supervisorDelegateService;
 }
        public void SetUp()
        {
            var centreCustomPromptsService = A.Fake <ICentreRegistrationPromptsService>();
            var centreCustomPromptsHelper  = new PromptsService(centreCustomPromptsService);
            var passwordResetService       = A.Fake <IPasswordResetService>();

            userDataService = A.Fake <IUserDataService>();
            courseService   = A.Fake <ICourseService>();
            config          = A.Fake <IConfiguration>();

            viewDelegateController = new ViewDelegateController(
                userDataService,
                centreCustomPromptsHelper,
                courseService,
                passwordResetService,
                config
                )
                                     .WithDefaultContext()
                                     .WithMockUser(true);
        }
        public void Setup()
        {
            jobGroupsDataService = A.Fake <IJobGroupsDataService>();
            userService          = A.Fake <IUserService>();
            userDataService      = A.Fake <IUserDataService>();
            promptsService       = A.Fake <PromptsService>();
            cryptoService        = A.Fake <ICryptoService>();
            registrationService  = A.Fake <IRegistrationService>();
            config = A.Fake <IConfiguration>();

            controller = new RegisterDelegateByCentreController(
                jobGroupsDataService,
                userService,
                promptsService,
                cryptoService,
                userDataService,
                registrationService,
                config
                )
                         .WithDefaultContext()
                         .WithMockTempData();
        }
        public void Setup()
        {
            promptsService   = A.Fake <PromptsService>();
            groupsService    = A.Fake <IGroupsService>();
            jobGroupsService = A.Fake <IJobGroupsService>();
            userService      = A.Fake <IUserService>();
            searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>();

            httpRequest  = A.Fake <HttpRequest>();
            httpResponse = A.Fake <HttpResponse>();
            const string cookieValue = "ActiveStatus|Active|false";

            groupDelegatesController = new GroupDelegatesController(
                jobGroupsService,
                userService,
                promptsService,
                groupsService,
                searchSortFilterPaginateService
                )
                                       .WithMockHttpContext(httpRequest, AddGroupDelegateFilterCookieName, cookieValue, httpResponse)
                                       .WithMockUser(true)
                                       .WithMockServices()
                                       .WithMockTempData();
        }
 public void Setup()
 {
     centreRegistrationPromptsService = A.Fake <ICentreRegistrationPromptsService>();
     promptsService = new PromptsService(centreRegistrationPromptsService);
 }