private static void SetUpCommonDataTableColumns( CentreRegistrationPrompts registrationRegistrationPrompts, DataTable dataTable ) { dataTable.Columns.AddRange( new[] { new DataColumn(CourseName), new DataColumn(LastName), new DataColumn(FirstName), new DataColumn(Email) } ); foreach (var prompt in registrationRegistrationPrompts.CustomPrompts) { dataTable.Columns.Add( !dataTable.Columns.Contains(prompt.PromptText) ? prompt.PromptText : $"{prompt.PromptText} (Prompt {prompt.RegistrationField.Id})" ); } dataTable.Columns.AddRange( new[] { new DataColumn(DelegateId), new DataColumn(Enrolled), new DataColumn(LastAccessed), new DataColumn(CompleteBy), new DataColumn(CompletedDate), new DataColumn(Logins), new DataColumn(TimeMinutes), new DataColumn(DiagnosticScore), new DataColumn(AssessmentsPassed), new DataColumn(PassRate), new DataColumn(Active), new DataColumn(RemovedDate), new DataColumn(Locked), } ); }
private static void AddDelegateToDataTable( DataTable dataTable, CourseDelegateForExport courseDelegate, CentreRegistrationPrompts registrationRegistrationPrompts, CourseAdminFields adminFields ) { var row = dataTable.NewRow(); SetCommonRowValues(dataTable, courseDelegate, registrationRegistrationPrompts, row); foreach (var prompt in adminFields.AdminFields) { if (dataTable.Columns.Contains($"{prompt.PromptText} (Prompt {prompt.PromptNumber})")) { row[$"{prompt.PromptText} (Prompt {prompt.PromptNumber})"] = courseDelegate.DelegateCourseAdminFields[prompt.PromptNumber - 1]; } else { row[prompt.PromptText] = courseDelegate.DelegateCourseAdminFields[prompt.PromptNumber - 1]; } } dataTable.Rows.Add(row); }
public MyStaffListViewModel( AdminUser adminUser, SearchSortFilterPaginationResult <SupervisorDelegateDetailViewModel> result, CentreRegistrationPrompts centreRegistrationPrompts ) : base(result, false, searchLabel: "Search administrators") { AdminUser = adminUser; CentreRegistrationPrompts = centreRegistrationPrompts; SuperviseDelegateDetailViewModels = result.ItemsToDisplay; }
private static void AddDelegateToDataTableForExportAll( DataTable dataTable, CourseDelegateForExport courseDelegate, CentreRegistrationPrompts registrationRegistrationPrompts ) { var row = dataTable.NewRow(); SetCommonRowValues(dataTable, courseDelegate, registrationRegistrationPrompts, row); row[AdminFieldOne] = courseDelegate.Answer1; row[AdminFieldTwo] = courseDelegate.Answer2; row[AdminFieldThree] = courseDelegate.Answer3; dataTable.Rows.Add(row); }
private static void SetUpDataTableColumnsForExportAll( CentreRegistrationPrompts registrationRegistrationPrompts, DataTable dataTable ) { SetUpCommonDataTableColumns(registrationRegistrationPrompts, dataTable); dataTable.Columns.AddRange( new[] { new DataColumn(AdminFieldOne), new DataColumn(AdminFieldTwo), new DataColumn(AdminFieldThree), } ); }
private static void SetUpDataTableColumns( CentreRegistrationPrompts registrationRegistrationPrompts, CourseAdminFields adminFields, DataTable dataTable ) { SetUpCommonDataTableColumns(registrationRegistrationPrompts, dataTable); foreach (var prompt in adminFields.AdminFields) { dataTable.Columns.Add( !dataTable.Columns.Contains(prompt.PromptText) ? prompt.PromptText : $"{prompt.PromptText} (Prompt {prompt.PromptNumber})" ); } }
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 AllStaffListViewModel( IEnumerable <SupervisorDelegateDetail> supervisorDelegates, CentreRegistrationPrompts centreRegistrationPrompts, bool isSupervisor ) { SupervisorDelegateDetailViewModels = supervisorDelegates.Select( supervisor => new SupervisorDelegateDetailViewModel( supervisor, new ReturnPageQuery( 1, $"{supervisor.ID}-card", PaginationOptions.DefaultItemsPerPage ), isSupervisor ) ); CentreRegistrationPrompts = centreRegistrationPrompts; }
private static void SetCommonRowValues( DataTable dataTable, CourseDelegateForExport courseDelegate, CentreRegistrationPrompts registrationRegistrationPrompts, DataRow row ) { row[CourseName] = courseDelegate.CourseName; row[LastName] = courseDelegate.DelegateLastName; row[FirstName] = courseDelegate.DelegateFirstName; row[Email] = courseDelegate.DelegateEmail; foreach (var prompt in registrationRegistrationPrompts.CustomPrompts) { if (dataTable.Columns.Contains($"{prompt.PromptText} (Prompt {prompt.RegistrationField.Id})")) { row[$"{prompt.PromptText} (Prompt {prompt.RegistrationField.Id})"] = courseDelegate.DelegateRegistrationPrompts[prompt.RegistrationField.Id - 1]; } else { row[prompt.PromptText] = courseDelegate.DelegateRegistrationPrompts[prompt.RegistrationField.Id - 1]; } } row[DelegateId] = courseDelegate.CandidateNumber; row[Enrolled] = courseDelegate.Enrolled.Date; row[LastAccessed] = courseDelegate.LastUpdated.Date; row[CompleteBy] = courseDelegate.CompleteBy?.Date; row[CompletedDate] = courseDelegate.Completed?.Date; row[Logins] = courseDelegate.LoginCount; row[TimeMinutes] = courseDelegate.Duration; row[DiagnosticScore] = courseDelegate.DiagnosticScore; row[AssessmentsPassed] = courseDelegate.AttemptsPassed; row[PassRate] = courseDelegate.PassRate; row[Active] = courseDelegate.IsDelegateActive; row[RemovedDate] = courseDelegate.RemovedDate?.Date; row[Locked] = courseDelegate.IsProgressLocked; }
private static void SetUpDataTableColumnsForAllDelegates( CentreRegistrationPrompts registrationPrompts, DataTable dataTable ) { dataTable.Columns.AddRange( new[] { new DataColumn(LastName), new DataColumn(FirstName), new DataColumn(DelegateId), new DataColumn(Email), new DataColumn(ProfessionalRegistrationNumber), new DataColumn(Alias), new DataColumn(JobGroup), new DataColumn(RegisteredDate), } ); foreach (var prompt in registrationPrompts.CustomPrompts) { dataTable.Columns.Add( !dataTable.Columns.Contains(prompt.PromptText) ? prompt.PromptText : $"{prompt.PromptText} (Prompt {prompt.RegistrationField.Id})" ); } dataTable.Columns.AddRange( new[] { new DataColumn(PasswordSet), new DataColumn(Active), new DataColumn(Approved), new DataColumn(IsAdmin), } ); }
private void AddCourseToSheet( IXLWorksheet sheet, int centreId, Course course, CentreRegistrationPrompts customRegistrationPrompts ) { var courseNameCell = sheet.Cell(GetNextEmptyRowNumber(sheet), 1); courseNameCell.Value = course.CourseName; courseNameCell.Style.Font.Bold = true; var sortedCourseDelegates = GenericSortingHelper.SortAllItems( courseDataService.GetDelegatesOnCourseForExport(course.CustomisationId, centreId) .AsQueryable(), nameof(CourseDelegateForExport.FullNameForSearchingSorting), GenericSortingHelper.Ascending ); var dataTable = new DataTable(); SetUpDataTableColumnsForExportAll(customRegistrationPrompts, dataTable); foreach (var courseDelegate in sortedCourseDelegates) { AddDelegateToDataTableForExportAll(dataTable, courseDelegate, customRegistrationPrompts); } var insertedDataRange = sheet.Cell(GetNextEmptyRowNumber(sheet), 1).InsertData(dataTable.Rows); if (dataTable.Rows.Count > 0) { sheet.Rows(insertedDataRange.FirstRow().RowNumber(), insertedDataRange.LastRow().RowNumber()) .Group(true); } }