public DelegateInfoViewModel( DelegateUserCard delegateUser, IEnumerable <DelegateRegistrationPrompt> delegateRegistrationPrompts ) { Id = delegateUser.Id; TitleName = delegateUser.SearchableName; Name = DisplayStringHelper.GetNonSortableFullNameForDisplayOnly( delegateUser.FirstName, delegateUser.LastName ); CandidateNumber = delegateUser.CandidateNumber; IsActive = delegateUser.Active; IsAdmin = delegateUser.IsAdmin; IsPasswordSet = delegateUser.IsPasswordSet; RegistrationType = delegateUser.RegistrationType; Email = delegateUser.EmailAddress; JobGroupId = delegateUser.JobGroupId; JobGroup = delegateUser.JobGroupName; ProfessionalRegistrationNumber = PrnStringHelper.GetPrnDisplayString( delegateUser.HasBeenPromptedForPrn, delegateUser.ProfessionalRegistrationNumber ); if (delegateUser.DateRegistered.HasValue) { RegistrationDate = delegateUser.DateRegistered.Value.ToString(DateHelper.StandardDateFormat); } AliasId = delegateUser.AliasId; DelegateRegistrationPrompts = delegateRegistrationPrompts; }
public ViewDelegateViewModel( DelegateUserCard delegateUser, IEnumerable <CustomFieldViewModel> customFields, IEnumerable <DelegateCourseDetails> delegateCourses ) { DelegateInfo = new DelegateInfoViewModel(delegateUser, customFields); DelegateCourses = delegateCourses.Select(x => new DelegateCourseInfoViewModel(x)).ToList(); Tags = FilterableTagHelper.GetCurrentTagsForDelegateUser(delegateUser); }
public void DelegateUserCard_gets_registration_type_correctly_self_registered_external() { // When var result = new DelegateUserCard() { SelfReg = true, ExternalReg = true }; // Then result.RegistrationType.Should().Be(RegistrationType.SelfRegisteredExternal); }
public SearchableDelegateViewModel( DelegateUserCard delegateUser, IEnumerable <CustomFieldViewModel> customFields, IEnumerable <CustomPrompt> promptsWithOptions ) { DelegateInfo = new DelegateInfoViewModel(delegateUser, customFields); Tags = FilterableTagHelper.GetCurrentTagsForDelegateUser(delegateUser); CustomPromptFilters = DelegatesViewModelFilters.GetCustomPromptFilters( DelegateInfo.CustomFields, promptsWithOptions ); }
public void DelegateInfoViewModel_sets_reg_date_string_correctly() { // Given var date = new DateTime(2021, 05, 13); var user = new DelegateUserCard { DateRegistered = date }; // When var model = new DelegateInfoViewModel(user, new List <DelegateRegistrationPrompt>()); // Then model.RegistrationDate.Should().Be("13/05/2021"); }
public SearchableDelegateViewModel( DelegateUserCard delegateUser, IEnumerable <DelegateRegistrationPrompt> delegateRegistrationPrompts, IEnumerable <CentreRegistrationPrompt> promptsWithOptions, ReturnPageQuery?returnPageQuery ) { DelegateInfo = new DelegateInfoViewModel(delegateUser, delegateRegistrationPrompts); Tags = FilterableTagHelper.GetCurrentTagsForDelegateUser(delegateUser); RegistrationPromptFilters = DelegatesViewModelFilters.GetRegistrationPromptFilters( DelegateInfo.DelegateRegistrationPrompts, promptsWithOptions ); ReturnPageQuery = returnPageQuery; }
public ViewDelegateViewModel( DelegateUserCard delegateUser, IEnumerable <DelegateRegistrationPrompt> customFields, IEnumerable <DelegateCourseInfo> delegateCourses ) { DelegateInfo = new DelegateInfoViewModel(delegateUser, customFields); DelegateCourses = delegateCourses .Select( x => new DelegateCourseInfoViewModel( x, DelegateAccessRoute.ViewDelegate ) ).ToList(); Tags = FilterableTagHelper.GetCurrentTagsForDelegateUser(delegateUser); }
public void DelegateUserCard_gets_registration_type_correctly_registered_by_centre() { // When var result1 = new DelegateUserCard() { SelfReg = false, ExternalReg = false }; var result2 = new DelegateUserCard() { SelfReg = false, ExternalReg = true }; // Then result1.RegistrationType.Should().Be(RegistrationType.RegisteredByCentre); result2.RegistrationType.Should().Be(RegistrationType.RegisteredByCentre); }
private static void SetDelegateRowValues( DataTable dataTable, DelegateUserCard delegateRecord, CentreRegistrationPrompts registrationPrompts ) { var row = dataTable.NewRow(); row[LastName] = delegateRecord.LastName; row[FirstName] = delegateRecord.FirstName; row[DelegateId] = delegateRecord.CandidateNumber; row[Email] = delegateRecord.EmailAddress; row[ProfessionalRegistrationNumber] = PrnStringHelper.GetPrnDisplayString( delegateRecord.HasBeenPromptedForPrn, delegateRecord.ProfessionalRegistrationNumber ); row[Alias] = delegateRecord.AliasId; row[JobGroup] = delegateRecord.JobGroupName; row[RegisteredDate] = delegateRecord.DateRegistered?.Date; var delegateAnswers = delegateRecord.GetCentreAnswersData(); foreach (var prompt in registrationPrompts.CustomPrompts) { if (dataTable.Columns.Contains($"{prompt.PromptText} (Prompt {prompt.RegistrationField.Id})")) { row[$"{prompt.PromptText} (Prompt {prompt.RegistrationField.Id})"] = delegateAnswers.GetAnswerForRegistrationPromptNumber(prompt.RegistrationField); } else { row[prompt.PromptText] = delegateAnswers.GetAnswerForRegistrationPromptNumber(prompt.RegistrationField); } } row[PasswordSet] = delegateRecord.IsPasswordSet; row[Active] = delegateRecord.Active; row[Approved] = delegateRecord.Approved; row[IsAdmin] = delegateRecord.IsAdmin; dataTable.Rows.Add(row); }
public static IEnumerable <SearchableTagViewModel> GetCurrentTagsForDelegateUser( DelegateUserCard delegateUser ) { return(new List <SearchableTagViewModel> { delegateUser.Active ? new SearchableTagViewModel(DelegateActiveStatusFilterOptions.IsActive) : new SearchableTagViewModel(DelegateActiveStatusFilterOptions.IsNotActive), delegateUser.IsPasswordSet ? new SearchableTagViewModel(DelegatePasswordStatusFilterOptions.PasswordSet) : new SearchableTagViewModel(DelegatePasswordStatusFilterOptions.PasswordNotSet), delegateUser.IsAdmin ? new SearchableTagViewModel(DelegateAdminStatusFilterOptions.IsAdmin) : new SearchableTagViewModel(DelegateAdminStatusFilterOptions.IsNotAdmin, true), new SearchableTagViewModel( DelegateRegistrationTypeFilterOptions.FromRegistrationType(delegateUser.RegistrationType) ) }); }
public void GetCurrentTagsForDelegateUser_negative_tags_should_return_correct_tags() { // Given var delegateUser = new DelegateUserCard(); var expectedTags = new List <SearchableTagViewModel> { new SearchableTagViewModel(DelegateActiveStatusFilterOptions.IsNotActive), new SearchableTagViewModel(DelegateAdminStatusFilterOptions.IsNotAdmin, true), new SearchableTagViewModel(DelegatePasswordStatusFilterOptions.PasswordNotSet), new SearchableTagViewModel(DelegateRegistrationTypeFilterOptions.RegisteredByCentre) }; // When var result = FilterableTagHelper.GetCurrentTagsForDelegateUser(delegateUser).ToList(); // Then using (new AssertionScope()) { result.Should().BeEquivalentTo(expectedTags); } }
public DelegateInfoViewModel(DelegateUserCard delegateUser, IEnumerable <CustomFieldViewModel> customFields) { Id = delegateUser.Id; Name = delegateUser.SearchableName; CandidateNumber = delegateUser.CandidateNumber; IsActive = delegateUser.Active; IsAdmin = delegateUser.IsAdmin; IsPasswordSet = delegateUser.IsPasswordSet; RegistrationType = delegateUser.RegistrationType; Email = delegateUser.EmailAddress; JobGroupId = delegateUser.JobGroupId; JobGroup = delegateUser.JobGroupName; if (delegateUser.DateRegistered.HasValue) { RegistrationDate = delegateUser.DateRegistered.Value.ToString(DateHelper.StandardDateFormat); } AliasId = delegateUser.AliasId; CustomFields = customFields; }
public void GetCurrentTagsForDelegateUser_should_return_correct_tags() { // Given var delegateUser = new DelegateUserCard { Active = true, AdminId = 1, Password = "******", SelfReg = true }; var expectedTags = new List <SearchableTagViewModel> { new SearchableTagViewModel(DelegateActiveStatusFilterOptions.IsActive), new SearchableTagViewModel(DelegateAdminStatusFilterOptions.IsAdmin), new SearchableTagViewModel(DelegatePasswordStatusFilterOptions.PasswordSet), new SearchableTagViewModel(DelegateRegistrationTypeFilterOptions.SelfRegistered) }; // When var result = FilterableTagHelper.GetCurrentTagsForDelegateUser(delegateUser).ToList(); // Then using (new AssertionScope()) { result.Should().BeEquivalentTo(expectedTags); } }
public WelcomeEmailSentViewModel(DelegateUserCard delegateUser) { Id = delegateUser.Id; Name = delegateUser.SearchableName; CandidateNumber = delegateUser.CandidateNumber; }
public WelcomeEmailSentViewModel(DelegateUserCard delegateUser) { Id = delegateUser.Id; Name = DisplayStringHelper.GetNonSortableFullNameForDisplayOnly(delegateUser.FirstName, delegateUser.LastName); CandidateNumber = delegateUser.CandidateNumber; }