Esempio n. 1
0
 private void SetJobGroupOptions(LearnerInformationViewModel model)
 {
     model.JobGroupOptions = SelectListHelper.MapOptionsToSelectListItems(
         jobGroupsDataService.GetJobGroupsAlphabetical(),
         model.JobGroup
         );
 }
Esempio n. 2
0
        public IActionResult LearnerInformation(LearnerInformationViewModel model)
        {
            var data = TempData.Peek <DelegateRegistrationByCentreData>() !;

            var centreId = data.Centre !.Value;

            centreCustomPromptHelper.ValidateCustomPrompts(
                centreId,
                model.Answer1,
                model.Answer2,
                model.Answer3,
                model.Answer4,
                model.Answer5,
                model.Answer6,
                ModelState
                );

            if (!ModelState.IsValid)
            {
                PopulateLearnerInformationExtraFields(model, data);
                return(View(model));
            }

            data.SetLearnerInformation(model);
            TempData.Set(data);

            return(RedirectToAction("WelcomeEmail"));
        }
        public void SetLearnerInformation_sets_data_correctly()
        {
            // Given
            var model = new LearnerInformationViewModel
            {
                JobGroup = JobGroupId,
                Answer1  = Answer1,
                Answer2  = Answer2,
                Answer3  = Answer3,
                Answer4  = Answer4,
                Answer5  = Answer5,
                Answer6  = Answer6
            };
            var data = new DelegateRegistrationData();

            // When
            data.SetLearnerInformation(model);

            // Then
            data.JobGroup.Should().Be(JobGroupId);
            data.Answer1.Should().Be(Answer1);
            data.Answer2.Should().Be(Answer2);
            data.Answer3.Should().Be(Answer3);
            data.Answer4.Should().Be(Answer4);
            data.Answer5.Should().Be(Answer5);
            data.Answer6.Should().Be(Answer6);
        }
Esempio n. 4
0
        public IActionResult LearnerInformation()
        {
            var data = TempData.Peek <RegistrationData>() !;

            var model = new LearnerInformationViewModel(data);

            SetJobGroupOptions(model);

            return(View(model));
        }
Esempio n. 5
0
 public override void SetLearnerInformation(LearnerInformationViewModel model)
 {
     JobGroup = model.JobGroup;
     Answer1  = model.Answer1;
     Answer2  = model.Answer2;
     Answer3  = model.Answer3;
     Answer4  = model.Answer4;
     Answer5  = model.Answer5;
     Answer6  = model.Answer6;
 }
Esempio n. 6
0
        public IActionResult LearnerInformation()
        {
            var data = TempData.Peek <DelegateRegistrationByCentreData>() !;

            var model = new LearnerInformationViewModel(data);

            PopulateLearnerInformationExtraFields(model, data);

            return(View(model));
        }
Esempio n. 7
0
 private void PopulateLearnerInformationExtraFields(
     LearnerInformationViewModel model,
     RegistrationData data
     )
 {
     model.CustomFields    = GetEditCustomFieldsFromModel(model, data.Centre !.Value);
     model.JobGroupOptions = SelectListHelper.MapOptionsToSelectListItems(
         jobGroupsDataService.GetJobGroupsAlphabetical(),
         model.JobGroup
         );
 }
Esempio n. 8
0
        public void LearnerInformation_constructor_using_data_populates_viewmodel_correctly()
        {
            // Given
            var data = RegistrationDataHelper.SampleRegistrationData();

            // When
            var result = new LearnerInformationViewModel(data);

            // Then
            result.JobGroup.Should().Be(data.JobGroup);
        }
 public override void SetLearnerInformation(LearnerInformationViewModel model)
 {
     JobGroup = model.JobGroup;
     ProfessionalRegistrationNumber    = model.HasProfessionalRegistrationNumber == true ? model.ProfessionalRegistrationNumber : null;
     HasProfessionalRegistrationNumber = model.HasProfessionalRegistrationNumber;
     Answer1 = model.Answer1;
     Answer2 = model.Answer2;
     Answer3 = model.Answer3;
     Answer4 = model.Answer4;
     Answer5 = model.Answer5;
     Answer6 = model.Answer6;
 }
Esempio n. 10
0
        public IActionResult LearnerInformation()
        {
            var data = TempData.Peek <DelegateRegistrationData>() !;

            if (data.Centre == null)
            {
                return(RedirectToAction("Index"));
            }

            var model = new LearnerInformationViewModel(data);

            PopulateLearnerInformationExtraFields(model, data);
            return(View(model));
        }
        public void LearnerInformation_constructor_using_delegate_data_populates_viewmodel_correctly()
        {
            // Given
            var data = RegistrationDataHelper.SampleDelegateRegistrationData();

            // When
            var result = new LearnerInformationViewModel(data, false);

            // Then
            result.JobGroup.Should().Be(data.JobGroup);
            result.Answer1.Should().Be(data.Answer1);
            result.Answer2.Should().Be(data.Answer2);
            result.Answer3.Should().Be(data.Answer3);
        }
Esempio n. 12
0
        public IActionResult LearnerInformation(LearnerInformationViewModel model)
        {
            var data = TempData.Peek <RegistrationData>() !;

            if (!ModelState.IsValid)
            {
                SetJobGroupOptions(model);
                return(View(model));
            }

            data.SetLearnerInformation(model);
            TempData.Set(data);

            return(RedirectToAction("Password"));
        }
 private IEnumerable <EditDelegateRegistrationPromptViewModel> GetEditDelegateRegistrationPromptViewModelsFromModel(
     LearnerInformationViewModel model,
     int centreId
     )
 {
     return(promptsService.GetEditDelegateRegistrationPromptViewModelsForCentre(
                centreId,
                model.Answer1,
                model.Answer2,
                model.Answer3,
                model.Answer4,
                model.Answer5,
                model.Answer6
                ));
 }
        public void SetLearnerInformation_sets_data_correctly()
        {
            // Given
            var model = new LearnerInformationViewModel
            {
                JobGroup = JobGroupId
            };
            var data = new RegistrationData();

            // When
            data.SetLearnerInformation(model);

            // Then
            data.JobGroup.Should().Be(JobGroupId);
        }
Esempio n. 15
0
 private IEnumerable <EditCustomFieldViewModel> GetEditCustomFieldsFromModel(
     LearnerInformationViewModel model,
     int centreId
     )
 {
     return(centreCustomPromptHelper.GetEditCustomFieldViewModelsForCentre(
                centreId,
                model.Answer1,
                model.Answer2,
                model.Answer3,
                model.Answer4,
                model.Answer5,
                model.Answer6
                ));
 }
        public void LearnerInformationPost_updates_tempdata_correctly()
        {
            // Given
            const int    jobGroupId = 3;
            const string answer1    = "answer1";
            const string answer2    = "answer2";
            const string answer3    = "answer3";
            const string answer4    = "answer4";
            const string answer5    = "answer5";
            const string answer6    = "answer6";
            const string professionalRegistrationNumber = "PRN1234";

            controller.TempData.Set(new DelegateRegistrationByCentreData {
                Centre = 1
            });
            var model = new LearnerInformationViewModel
            {
                JobGroup = jobGroupId,
                Answer1  = answer1,
                Answer2  = answer2,
                Answer3  = answer3,
                Answer4  = answer4,
                Answer5  = answer5,
                Answer6  = answer6,
                HasProfessionalRegistrationNumber = true,
                ProfessionalRegistrationNumber    = professionalRegistrationNumber,
            };

            // When
            controller.LearnerInformation(model);

            // Then
            var data = controller.TempData.Peek <DelegateRegistrationByCentreData>() !;

            data.JobGroup.Should().Be(jobGroupId);
            data.Answer1.Should().Be(answer1);
            data.Answer2.Should().Be(answer2);
            data.Answer3.Should().Be(answer3);
            data.Answer4.Should().Be(answer4);
            data.Answer5.Should().Be(answer5);
            data.Answer6.Should().Be(answer6);
            data.HasProfessionalRegistrationNumber.Should().BeTrue();
            data.ProfessionalRegistrationNumber.Should().Be(professionalRegistrationNumber);
        }
Esempio n. 17
0
        public IActionResult LearnerInformation(LearnerInformationViewModel model)
        {
            var data = TempData.Peek <RegistrationData>() !;

            ProfessionalRegistrationNumberHelper.ValidateProfessionalRegistrationNumber(
                ModelState,
                model.HasProfessionalRegistrationNumber,
                model.ProfessionalRegistrationNumber
                );

            if (!ModelState.IsValid)
            {
                SetJobGroupOptions(model);
                return(View(model));
            }

            data.SetLearnerInformation(model);
            TempData.Set(data);

            return(RedirectToAction("Password"));
        }
        public IActionResult LearnerInformation(LearnerInformationViewModel model)
        {
            var data = TempData.Peek <DelegateRegistrationData>() !;

            if (data.Centre == null)
            {
                return(RedirectToAction("Index"));
            }

            var centreId = data.Centre.Value;

            promptsService.ValidateCentreRegistrationPrompts(
                centreId,
                model.Answer1,
                model.Answer2,
                model.Answer3,
                model.Answer4,
                model.Answer5,
                model.Answer6,
                ModelState
                );

            ProfessionalRegistrationNumberHelper.ValidateProfessionalRegistrationNumber(
                ModelState,
                model.HasProfessionalRegistrationNumber,
                model.ProfessionalRegistrationNumber
                );

            if (!ModelState.IsValid)
            {
                PopulateLearnerInformationExtraFields(model, data);
                return(View(model));
            }

            data.SetLearnerInformation(model);
            TempData.Set(data);

            return(RedirectToAction("Password"));
        }
Esempio n. 19
0
 public virtual void SetLearnerInformation(LearnerInformationViewModel model)
 {
     JobGroup = model.JobGroup;
 }
 public virtual void SetLearnerInformation(LearnerInformationViewModel model)
 {
     JobGroup = model.JobGroup;
     ProfessionalRegistrationNumber    = model.HasProfessionalRegistrationNumber == true ? model.ProfessionalRegistrationNumber : null;
     HasProfessionalRegistrationNumber = model.HasProfessionalRegistrationNumber;
 }