GetActiveCompetencyLearningResourcesByCompetencyIdAndReferenceId(int competencyId, int referenceId)
+ {
+ return competencyLearningResourcesDataService.GetActiveCompetencyLearningResourcesByCompetencyIdAndReferenceId(competencyId, referenceId);
+ }
}
}
diff --git a/DigitalLearningSolutions.Web/Services/DelegateDownloadFileService.cs b/DigitalLearningSolutions.Web/Services/DelegateDownloadFileService.cs
index 7274173d88..f0bba93403 100644
--- a/DigitalLearningSolutions.Web/Services/DelegateDownloadFileService.cs
+++ b/DigitalLearningSolutions.Web/Services/DelegateDownloadFileService.cs
@@ -39,6 +39,7 @@ public class DelegateDownloadFileService : IDelegateDownloadFileService
private const string ProfessionalRegistrationNumber = "Professional Registration Number";
private const string JobGroup = "Job group";
private const string RegisteredDate = "Registered";
+ private const string LastAccessed = "Last Accessed Date";
private const string RegistrationComplete = "Registration complete";
private const string Active = "Active";
private const string Approved = "Approved";
@@ -333,6 +334,7 @@ DataTable dataTable
new DataColumn(ProfessionalRegistrationNumber),
new DataColumn(JobGroup),
new DataColumn(RegisteredDate),
+ new DataColumn(LastAccessed),
}
);
@@ -374,7 +376,7 @@ CentreRegistrationPrompts registrationPrompts
);
row[JobGroup] = delegateRecord.JobGroupName;
row[RegisteredDate] = delegateRecord.DateRegistered?.Date;
-
+ row[LastAccessed] = delegateRecord.LastAccessed?.Date;
var delegateAnswers = delegateRecord.GetRegistrationFieldAnswers();
foreach (var prompt in registrationPrompts.CustomPrompts)
@@ -402,7 +404,7 @@ CentreRegistrationPrompts registrationPrompts
private static void FormatAllDelegateWorksheetColumns(IXLWorkbook workbook, DataTable dataTable)
{
ClosedXmlHelper.FormatWorksheetColumn(workbook, dataTable, RegisteredDate, XLDataType.DateTime);
-
+ ClosedXmlHelper.FormatWorksheetColumn(workbook, dataTable, LastAccessed, XLDataType.DateTime);
var boolColumns = new[] { RegistrationComplete, Active, Approved, IsAdmin };
foreach (var columnName in boolColumns)
{
diff --git a/DigitalLearningSolutions.Web/Services/FrameworkNotificationService.cs b/DigitalLearningSolutions.Web/Services/FrameworkNotificationService.cs
index 092f38c15d..d0cfdb0a0f 100644
--- a/DigitalLearningSolutions.Web/Services/FrameworkNotificationService.cs
+++ b/DigitalLearningSolutions.Web/Services/FrameworkNotificationService.cs
@@ -34,7 +34,7 @@ public class FrameworkNotificationService : IFrameworkNotificationService
private readonly IConfigDataService configDataService;
private readonly IEmailService emailService;
private readonly IFrameworkService frameworkService;
- private readonly IRoleProfileService roleProfileService;
+ private readonly ICompetencyAssessmentService competencyAssessmentService;
private readonly ISupervisorService supervisorService;
private readonly ISelfAssessmentDataService selfAssessmentDataService;
private readonly ICentresDataService centresDataService;
@@ -42,7 +42,7 @@ public FrameworkNotificationService(
IFrameworkService frameworkService,
IConfigDataService configDataService,
IEmailService emailService,
- IRoleProfileService roleProfileService,
+ ICompetencyAssessmentService competencyAssessmentService,
ISupervisorService supervisorService,
ISelfAssessmentDataService selfAssessmentDataService,
ICentresDataService centresDataService
@@ -51,7 +51,7 @@ ICentresDataService centresDataService
this.frameworkService = frameworkService;
this.configDataService = configDataService;
this.emailService = emailService;
- this.roleProfileService = roleProfileService;
+ this.competencyAssessmentService = competencyAssessmentService;
this.supervisorService = supervisorService;
this.selfAssessmentDataService = selfAssessmentDataService;
this.centresDataService = centresDataService;
@@ -221,8 +221,8 @@ public void SendSupervisorDelegateInvite(int supervisorDelegateId, int adminId,
builder.TextBody = $@"Dear colleague,
You have been invited to register to access the NHS England, Digital Learning Solutions platform as a supervised delegate by {supervisorDelegate.SupervisorName} ({supervisorDelegate.SupervisorEmail}) ({centreName}).
To register, visit {dlsUrlBuilder.Uri.ToString()}.
- Registering using this link will confirm your acceptance of the invite. Your supervisor will then be able to assign role profile assessments and view and validate your self assessment results.";
- builder.HtmlBody = $@"Dear colleague,
You have been invited to register to access the NHS England, Digital Learning Solutions platform as a supervised delegate by {supervisorDelegate.SupervisorName} ({centreName}).
Click here to register and confirm your acceptance of the invite.
Your supervisor will then be able to assign role profile assessments and view and validate your self assessment results.
";
+ Registering using this link will confirm your acceptance of the invite. Your supervisor will then be able to assign competency assessments and view and validate your self assessment results.";
+ builder.HtmlBody = $@"Dear colleague,
You have been invited to register to access the NHS England, Digital Learning Solutions platform as a supervised delegate by {supervisorDelegate.SupervisorName} ({centreName}).
Click here to register and confirm your acceptance of the invite.
Your supervisor will then be able to assign competency assessments and view and validate your self assessment results.
";
emailService.SendEmail(new Email(emailSubjectLine, builder, supervisorDelegate.DelegateEmail));
}
}
@@ -240,7 +240,7 @@ public void SendSupervisorDelegateConfirmed(int supervisorDelegateId, int adminI
You are already registered as a delegate at the supervisor's DLS centre so they can now assign competency self assessments and view and validate your self assessment results.
If this looks like a mistake, please contact {supervisorDelegate.SupervisorName} ({supervisorDelegate.SupervisorEmail}) ({centreName}) directly to correct.";
- builder.HtmlBody = $@"Dear {supervisorDelegate.FirstName}
{supervisorDelegate.SupervisorName} ({centreName}) has accepted your request to be your supervisor for profile asessment activities in the NHS England, Digital Learning Solutions platform.
Click here to access your role profile assessments.
";
+ builder.HtmlBody = $@"Dear {supervisorDelegate.FirstName}
{supervisorDelegate.SupervisorName} ({centreName}) has accepted your request to be your supervisor for profile asessment activities in the NHS England, Digital Learning Solutions platform.
Click here to access your competency assessments.
";
string toEmail = (@adminId == 0 ? supervisorDelegate.DelegateEmail : supervisorDelegate.SupervisorEmail);
emailService.SendEmail(new Email(emailSubjectLine, builder, toEmail));
}
@@ -410,8 +410,8 @@ public void SendSupervisorDelegateReminder(int supervisorDelegateId, int adminId
builder.TextBody = $@"Dear colleague,
This is a reminder to to register to access the NHS England, Digital Learning Solutions platform as a supervised delegate by {supervisorDelegate.SupervisorName} ({supervisorDelegate.SupervisorEmail}) ({centreName}).
To register, visit {dlsUrlBuilder.Uri.ToString()}.
- Your supervisor will then be able to assign role profile assessments and view and validate your self assessment results.";
- builder.HtmlBody = $@"Dear colleague,
This is a reminder to register to access the NHS England, Digital Learning Solutions platform as a supervised delegate by {supervisorDelegate.SupervisorName} ({centreName}).
Click here to register.
Your supervisor will then be able to assign role profile assessments and view and validate your self assessment results.
";
+ Your supervisor will then be able to assign competency assessments and view and validate your self assessment results.";
+ builder.HtmlBody = $@"Dear colleague,
This is a reminder to register to access the NHS England, Digital Learning Solutions platform as a supervised delegate by {supervisorDelegate.SupervisorName} ({centreName}).
Click here to register.
Your supervisor will then be able to assign competency assessments and view and validate your self assessment results.
";
emailService.SendEmail(new Email(emailSubjectLine, builder, supervisorDelegate.DelegateEmail));
}
}
diff --git a/DigitalLearningSolutions.Web/Services/FrameworkService.cs b/DigitalLearningSolutions.Web/Services/FrameworkService.cs
index b407be417f..6e2c1790e9 100644
--- a/DigitalLearningSolutions.Web/Services/FrameworkService.cs
+++ b/DigitalLearningSolutions.Web/Services/FrameworkService.cs
@@ -247,9 +247,9 @@ string direction
void RemoveCustomFlag(int flagId);
void RemoveCollaboratorFromFramework(int frameworkId, int id);
- void DeleteFrameworkCompetencyGroup(int frameworkCompetencyGroupId, int competencyGroupId, int adminId);
+ void DeleteFrameworkCompetencyGroup(int frameworkCompetencyGroupId, int competencyGroupId, int frameworkId, int adminId);
- void DeleteFrameworkCompetency(int frameworkCompetencyId, int adminId);
+ void DeleteFrameworkCompetency(int frameworkCompetencyId, int? frameworkCompetencyGroupId, int frameworkId, int adminId);
void DeleteFrameworkDefaultQuestion(
int frameworkId,
@@ -316,14 +316,14 @@ public void DeleteCompetencyLearningResource(int competencyLearningResourceId, i
frameworkDataService.DeleteCompetencyLearningResource(competencyLearningResourceId, adminId);
}
- public void DeleteFrameworkCompetency(int frameworkCompetencyId, int adminId)
+ public void DeleteFrameworkCompetency(int frameworkCompetencyId, int? frameworkCompetencyGroupId, int frameworkId, int adminId)
{
- frameworkDataService.DeleteFrameworkCompetency(frameworkCompetencyId, adminId);
+ frameworkDataService.DeleteFrameworkCompetency(frameworkCompetencyId, frameworkCompetencyGroupId, frameworkId, adminId);
}
- public void DeleteFrameworkCompetencyGroup(int frameworkCompetencyGroupId, int competencyGroupId, int adminId)
+ public void DeleteFrameworkCompetencyGroup(int frameworkCompetencyGroupId, int competencyGroupId, int frameworkId, int adminId)
{
- frameworkDataService.DeleteFrameworkCompetencyGroup(frameworkCompetencyGroupId, competencyGroupId, adminId);
+ frameworkDataService.DeleteFrameworkCompetencyGroup(frameworkCompetencyGroupId, competencyGroupId, frameworkId, adminId);
}
public void DeleteFrameworkDefaultQuestion(int frameworkId, int assessmentQuestionId, int adminId, bool deleteFromExisting)
diff --git a/DigitalLearningSolutions.Web/Services/ImportCompetenciesFromFileService.cs b/DigitalLearningSolutions.Web/Services/ImportCompetenciesFromFileService.cs
index dcb388f3ae..6d773ffd02 100644
--- a/DigitalLearningSolutions.Web/Services/ImportCompetenciesFromFileService.cs
+++ b/DigitalLearningSolutions.Web/Services/ImportCompetenciesFromFileService.cs
@@ -206,7 +206,6 @@ CompetencyTableRow competencyRow
else
{
frameworkCompetencyGroupId = frameworkService.GetFrameworkCompetencyGroupId(frameworkId, newCompetencyGroupId);
-
var isUpdated = frameworkService.UpdateFrameworkCompetencyGroup((int)frameworkCompetencyGroupId, newCompetencyGroupId, competencyRow.CompetencyGroup, competencyRow.GroupDescription, adminId);
competencyRow.RowStatus = RowStatus.CompetencyGroupUpdated;
}
@@ -262,7 +261,7 @@ CompetencyTableRow competencyRow
{
foreach (var frameworkFlag in frameworkFlags)
{
- if (frameworkFlag.FlagName == flag)
+ if (frameworkFlag.FlagName?.Trim().ToLower() == flag?.Trim().ToLower())
{
flagId = frameworkFlag.FlagId;
break;
@@ -271,7 +270,7 @@ CompetencyTableRow competencyRow
}
if (flagId == 0)
{
- flagId = frameworkService.AddCustomFlagToFramework(frameworkId, flag, "Flag", "nhsuk-tag--white");
+ flagId = frameworkService.AddCustomFlagToFramework(frameworkId, flag?.Trim(), "Flag", "nhsuk-tag--white");
}
flagIds.Add(flagId);
}
diff --git a/DigitalLearningSolutions.Web/Services/LoginService.cs b/DigitalLearningSolutions.Web/Services/LoginService.cs
index 35d8cc7a16..dc52aca0b5 100644
--- a/DigitalLearningSolutions.Web/Services/LoginService.cs
+++ b/DigitalLearningSolutions.Web/Services/LoginService.cs
@@ -5,10 +5,12 @@
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
+ using DigitalLearningSolutions.Data.DataServices;
using DigitalLearningSolutions.Data.Enums;
using DigitalLearningSolutions.Data.Helpers;
using DigitalLearningSolutions.Data.Models;
using DigitalLearningSolutions.Data.Models.User;
+ using DigitalLearningSolutions.Data.Utilities;
using DigitalLearningSolutions.Data.ViewModels;
using DigitalLearningSolutions.Web.Helpers;
using Microsoft.AspNetCore.Authentication;
@@ -28,6 +30,12 @@ List idsOfCentresWithUnverifiedEmails
bool CentreEmailIsVerified(int userId, int centreIdIfLoggingIntoSingleCentre);
+ void UpdateLastAccessedForUsersTable(int Id);
+
+ void UpdateLastAccessedForDelegatesAccountsTable(int Id);
+
+ void UpdateLastAccessedForAdminAccountsTable(int Id);
+
Task HandleLoginResult(
LoginResult loginResult,
TicketReceivedContext context,
@@ -41,11 +49,28 @@ public class LoginService : ILoginService
{
private readonly IUserService userService;
private readonly IUserVerificationService userVerificationService;
+ private readonly ILoginDataService loginDataService;
- public LoginService(IUserService userService, IUserVerificationService userVerificationService)
+ public LoginService(IUserService userService, IUserVerificationService userVerificationService, ILoginDataService loginDataService)
{
this.userService = userService;
this.userVerificationService = userVerificationService;
+ this.loginDataService = loginDataService;
+ }
+
+ public void UpdateLastAccessedForUsersTable(int Id)
+ {
+ loginDataService.UpdateLastAccessedForUsersTable(Id);
+ }
+
+ public void UpdateLastAccessedForDelegatesAccountsTable(int Id)
+ {
+ loginDataService.UpdateLastAccessedForDelegatesAccountsTable(Id);
+ }
+
+ public void UpdateLastAccessedForAdminAccountsTable(int Id)
+ {
+ loginDataService.UpdateLastAccessedForAdminAccountsTable(Id);
}
public LoginResult AttemptLogin(string username, string password)
diff --git a/DigitalLearningSolutions.Web/Services/RoleProfileService.cs b/DigitalLearningSolutions.Web/Services/RoleProfileService.cs
deleted file mode 100644
index 7983b2afa4..0000000000
--- a/DigitalLearningSolutions.Web/Services/RoleProfileService.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-using DigitalLearningSolutions.Data.DataServices;
-using DigitalLearningSolutions.Data.Models.RoleProfiles;
-using System.Collections.Generic;
-
-namespace DigitalLearningSolutions.Web.Services
-{
- public interface IRoleProfileService
- {
- //GET DATA
- IEnumerable GetAllRoleProfiles(int adminId);
-
- IEnumerable GetRoleProfilesForAdminId(int adminId);
-
- RoleProfileBase? GetRoleProfileBaseById(int roleProfileId, int adminId);
-
- RoleProfileBase? GetRoleProfileByName(string roleProfileName, int adminId);
-
- IEnumerable GetNRPProfessionalGroups();
-
- //UPDATE DATA
- bool UpdateRoleProfileName(int roleProfileId, int adminId, string roleProfileName);
-
- bool UpdateRoleProfileProfessionalGroup(int roleProfileId, int adminId, int? nrpProfessionalGroupID);
-
- }
- public class RoleProfileService : IRoleProfileService
- {
- private readonly IRoleProfileDataService roleProfileDataService;
- public RoleProfileService(IRoleProfileDataService roleProfileDataService)
- {
- this.roleProfileDataService = roleProfileDataService;
- }
- public IEnumerable GetAllRoleProfiles(int adminId)
- {
- return roleProfileDataService.GetAllRoleProfiles(adminId);
- }
-
- public IEnumerable GetNRPProfessionalGroups()
- {
- return roleProfileDataService.GetNRPProfessionalGroups();
- }
-
- public RoleProfileBase? GetRoleProfileBaseById(int roleProfileId, int adminId)
- {
- return roleProfileDataService.GetRoleProfileBaseById(roleProfileId, adminId);
- }
-
- public RoleProfileBase? GetRoleProfileByName(string roleProfileName, int adminId)
- {
- return roleProfileDataService.GetRoleProfileByName(roleProfileName, adminId);
- }
-
- public IEnumerable GetRoleProfilesForAdminId(int adminId)
- {
- return roleProfileDataService.GetRoleProfilesForAdminId(adminId);
- }
-
- public bool UpdateRoleProfileName(int roleProfileId, int adminId, string roleProfileName)
- {
- return roleProfileDataService.UpdateRoleProfileName(roleProfileId, adminId, roleProfileName);
- }
-
- public bool UpdateRoleProfileProfessionalGroup(int roleProfileId, int adminId, int? nrpProfessionalGroupID)
- {
- return roleProfileDataService.UpdateRoleProfileProfessionalGroup(roleProfileId, adminId, nrpProfessionalGroupID);
- }
- }
-}
diff --git a/DigitalLearningSolutions.Web/Services/SelfAssessmentReportService.cs b/DigitalLearningSolutions.Web/Services/SelfAssessmentReportService.cs
index 18b6c46cdc..33c7c71160 100644
--- a/DigitalLearningSolutions.Web/Services/SelfAssessmentReportService.cs
+++ b/DigitalLearningSolutions.Web/Services/SelfAssessmentReportService.cs
@@ -1,129 +1,261 @@
-namespace DigitalLearningSolutions.Data.Services
-{
- using ClosedXML.Excel;
- using DigitalLearningSolutions.Data.DataServices.SelfAssessmentDataService;
- using DigitalLearningSolutions.Data.Models.Email;
- using DigitalLearningSolutions.Data.Models.SelfAssessments;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
-
- public interface ISelfAssessmentReportService
- {
- byte[] GetSelfAssessmentExcelExportForCentre(int centreId, int selfAssessmentId);
- byte[] GetDigitalCapabilityExcelExportForCentre(int centreId);
- IEnumerable GetSelfAssessmentsForReportList(int centreId, int? categoryId);
- }
- public class SelfAssessmentReportService : ISelfAssessmentReportService
- {
- private readonly IDCSAReportDataService dcsaReportDataService;
- private readonly ISelfAssessmentReportDataService selfAssessmentReportDataService;
- public SelfAssessmentReportService(
- IDCSAReportDataService dcsaReportDataService,
- ISelfAssessmentReportDataService selfAssessmentReportDataService
- )
- {
- this.dcsaReportDataService = dcsaReportDataService;
- this.selfAssessmentReportDataService = selfAssessmentReportDataService;
- }
- private static void AddSheetToWorkbook(IXLWorkbook workbook, string sheetName, IEnumerable