-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added CRM related tests Added UI tests Fixed file corruption caused by rebase Fixed PR issues Fixed PR issues Tweaked filter requiring a personId Tweaks based on updated designs Added support for dfeta_trsdeletedevent field in CRM dfeta_qualification table Regenerated CRM code
- Loading branch information
Showing
41 changed files
with
2,581 additions
and
16 deletions.
There are no files selected for viewing
570 changes: 570 additions & 0 deletions
570
TeachingRecordSystem/src/TeachingRecordSystem.Core/Dqt/Models/GeneratedCode.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...cordSystem/src/TeachingRecordSystem.Core/Dqt/Queries/CreateMandatoryQualificationQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
public record CreateMandatoryQualificationQuery : ICrmQuery<Guid> | ||
{ | ||
public required Guid ContactId { get; init; } | ||
public required Guid MqEstablishmentId { get; init; } | ||
public required Guid SpecialismId { get; init; } | ||
public required DateOnly StartDate { get; init; } | ||
public required dfeta_qualification_dfeta_MQ_Status Result { get; init; } | ||
public required DateOnly? EndDate { get; init; } | ||
} |
3 changes: 3 additions & 0 deletions
3
...hingRecordSystem/src/TeachingRecordSystem.Core/Dqt/Queries/GetAllMqEstablishmentsQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
public record GetAllMqEstablishmentsQuery : ICrmQuery<dfeta_mqestablishment[]>; |
3 changes: 3 additions & 0 deletions
3
TeachingRecordSystem/src/TeachingRecordSystem.Core/Dqt/Queries/GetAllSpecialismsQuery.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
namespace TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
public record GetAllSpecialismsQuery : ICrmQuery<dfeta_specialism[]>; |
26 changes: 26 additions & 0 deletions
26
...em/src/TeachingRecordSystem.Core/Dqt/QueryHandlers/CreateMandatoryQualificationHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using Microsoft.PowerPlatform.Dataverse.Client; | ||
using TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
namespace TeachingRecordSystem.Core.Dqt.QueryHandlers; | ||
|
||
public class CreateMandatoryQualificationHandler : ICrmQueryHandler<CreateMandatoryQualificationQuery, Guid> | ||
{ | ||
public async Task<Guid> Execute(CreateMandatoryQualificationQuery query, IOrganizationServiceAsync organizationService) | ||
{ | ||
var qualification = new dfeta_qualification() | ||
{ | ||
Id = Guid.NewGuid(), | ||
dfeta_Type = dfeta_qualification_dfeta_Type.MandatoryQualification, | ||
dfeta_name = "Mandatory Qualification", | ||
dfeta_PersonId = query.ContactId.ToEntityReference(Contact.EntityLogicalName), | ||
dfeta_MQ_MQEstablishmentId = query.MqEstablishmentId.ToEntityReference(dfeta_mqestablishment.EntityLogicalName), | ||
dfeta_MQ_SpecialismId = query.SpecialismId.ToEntityReference(dfeta_specialism.EntityLogicalName), | ||
dfeta_MQStartDate = query.StartDate.FromDateOnlyWithDqtBstFix(isLocalTime: true), | ||
dfeta_MQ_Status = query.Result, | ||
dfeta_MQ_Date = query.EndDate?.FromDateOnlyWithDqtBstFix(isLocalTime: true), | ||
}; | ||
|
||
var qualificationId = await organizationService.CreateAsync(qualification); | ||
return qualificationId; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...rdSystem/src/TeachingRecordSystem.Core/Dqt/QueryHandlers/GetAllMqEstablishmentsHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Microsoft.PowerPlatform.Dataverse.Client; | ||
using Microsoft.Xrm.Sdk.Messages; | ||
using Microsoft.Xrm.Sdk.Query; | ||
using TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
namespace TeachingRecordSystem.Core.Dqt.QueryHandlers; | ||
|
||
public class GetAllMqEstablishmentsHandler : ICrmQueryHandler<GetAllMqEstablishmentsQuery, dfeta_mqestablishment[]> | ||
{ | ||
public async Task<dfeta_mqestablishment[]> Execute(GetAllMqEstablishmentsQuery query, IOrganizationServiceAsync organizationService) | ||
{ | ||
var filter = new FilterExpression(LogicalOperator.And); | ||
filter.AddCondition(dfeta_mqestablishment.Fields.StateCode, ConditionOperator.Equal, (int)dfeta_mqestablishmentState.Active); | ||
|
||
var queryExpression = new QueryExpression | ||
{ | ||
EntityName = dfeta_mqestablishment.EntityLogicalName, | ||
ColumnSet = new ColumnSet( | ||
dfeta_mqestablishment.PrimaryIdAttribute, | ||
dfeta_mqestablishment.Fields.dfeta_name, | ||
dfeta_mqestablishment.Fields.dfeta_Value), | ||
Criteria = filter, | ||
}; | ||
|
||
var request = new RetrieveMultipleRequest | ||
{ | ||
Query = queryExpression | ||
}; | ||
|
||
var response = await organizationService.RetrieveMultipleAsync(queryExpression); | ||
return response.Entities.Select(x => x.ToEntity<dfeta_mqestablishment>()).ToArray(); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...gRecordSystem/src/TeachingRecordSystem.Core/Dqt/QueryHandlers/GetAllSpecialismsHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Microsoft.PowerPlatform.Dataverse.Client; | ||
using Microsoft.Xrm.Sdk.Messages; | ||
using Microsoft.Xrm.Sdk.Query; | ||
using TeachingRecordSystem.Core.Dqt.Queries; | ||
|
||
namespace TeachingRecordSystem.Core.Dqt.QueryHandlers; | ||
|
||
public class GetAllSpecialismsHandler : ICrmQueryHandler<GetAllSpecialismsQuery, dfeta_specialism[]> | ||
{ | ||
public async Task<dfeta_specialism[]> Execute(GetAllSpecialismsQuery query, IOrganizationServiceAsync organizationService) | ||
{ | ||
var filter = new FilterExpression(LogicalOperator.And); | ||
filter.AddCondition(dfeta_specialism.Fields.StateCode, ConditionOperator.Equal, (int)dfeta_specialismState.Active); | ||
filter.AddCondition(dfeta_specialism.Fields.dfeta_Value, ConditionOperator.In, "Hearing", "Multi-Sensory", "Visual"); | ||
|
||
var queryExpression = new QueryExpression | ||
{ | ||
EntityName = dfeta_specialism.EntityLogicalName, | ||
ColumnSet = new ColumnSet( | ||
dfeta_specialism.PrimaryIdAttribute, | ||
dfeta_specialism.Fields.dfeta_name, | ||
dfeta_specialism.Fields.dfeta_Value), | ||
Criteria = filter, | ||
}; | ||
|
||
var request = new RetrieveMultipleRequest | ||
{ | ||
Query = queryExpression | ||
}; | ||
|
||
var response = await organizationService.RetrieveMultipleAsync(queryExpression); | ||
return response.Entities.Select(x => x.ToEntity<dfeta_specialism>()).ToArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/AddMqState.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Diagnostics.CodeAnalysis; | ||
using System.Text.Json.Serialization; | ||
using TeachingRecordSystem.Core.Dqt.Models; | ||
|
||
namespace TeachingRecordSystem.SupportUi.Pages.Mqs.AddMq; | ||
|
||
public class AddMqState | ||
{ | ||
public string? MqEstablishmentValue { get; set; } | ||
|
||
public string? SpecialismValue { get; set; } | ||
|
||
public DateOnly? StartDate { get; set; } | ||
|
||
public dfeta_qualification_dfeta_MQ_Status? Result { get; set; } | ||
|
||
public DateOnly? EndDate { get; set; } | ||
|
||
[JsonIgnore] | ||
[MemberNotNullWhen(true, nameof(MqEstablishmentValue), nameof(SpecialismValue), nameof(StartDate), nameof(Result))] | ||
public bool IsComplete => !string.IsNullOrWhiteSpace(MqEstablishmentValue) && | ||
!string.IsNullOrEmpty(SpecialismValue) && | ||
StartDate.HasValue && | ||
Result.HasValue && | ||
(Result!.Value != dfeta_qualification_dfeta_MQ_Status.Passed || (Result.Value == dfeta_qualification_dfeta_MQ_Status.Passed && EndDate.HasValue)); | ||
} |
62 changes: 62 additions & 0 deletions
62
TeachingRecordSystem/src/TeachingRecordSystem.SupportUi/Pages/Mqs/AddMq/CheckAnswers.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
@page "/mqs/add/check-answers/{handler?}" | ||
@using TeachingRecordSystem.Core.Dqt.Models; | ||
@model TeachingRecordSystem.SupportUi.Pages.Mqs.AddMq.CheckAnswersModel | ||
@{ | ||
ViewBag.Title = "Check details and confirm mandatory qualification"; | ||
} | ||
|
||
@section BeforeContent { | ||
<govuk-back-link href="@LinkGenerator.MqAddResult(Model.PersonId, Model.JourneyInstance!.InstanceId)" /> | ||
} | ||
|
||
<span class="govuk-caption-l">Add a mandatory qualification - @Model.PersonName</span> | ||
<h1 class="govuk-heading-l" data-testid="title">@ViewBag.Title</h1> | ||
|
||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-full-from-desktop"> | ||
<form action="@LinkGenerator.MqAddCheckAnswers(Model.PersonId, Model.JourneyInstance!.InstanceId)" method="post"> | ||
<govuk-summary-list> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>Training provider</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="provider">@Model.MqEstablishment!.dfeta_name</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="@LinkGenerator.MqAddProvider(Model.PersonId, Model.JourneyInstance!.InstanceId)">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>Specialism</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="specialism">@Model.Specialism!.dfeta_name</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="@LinkGenerator.MqAddSpecialism(Model.PersonId, Model.JourneyInstance!.InstanceId)">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>Start date</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="start-date">@Model.StartDate!.Value.ToString("d MMMM yyyy")</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="@LinkGenerator.MqAddStartDate(Model.PersonId, Model.JourneyInstance!.InstanceId)">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>Result</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="result">@Model.Result</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="@LinkGenerator.MqAddResult(Model.PersonId, Model.JourneyInstance!.InstanceId)">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
<govuk-summary-list-row> | ||
<govuk-summary-list-row-key>End date</govuk-summary-list-row-key> | ||
<govuk-summary-list-row-value data-testid="end-date">@(Model.EndDate.HasValue ? Model.EndDate.Value.ToString("d MMMM yyyy") : "None")</govuk-summary-list-row-value> | ||
<govuk-summary-list-row-actions> | ||
<govuk-summary-list-row-action href="@LinkGenerator.MqAddResult(Model.PersonId, Model.JourneyInstance!.InstanceId)">Change</govuk-summary-list-row-action> | ||
</govuk-summary-list-row-actions> | ||
</govuk-summary-list-row> | ||
</govuk-summary-list> | ||
|
||
<div class="govuk-button-group"> | ||
<govuk-button type="submit">Confirm mandatory qualification</govuk-button> | ||
<govuk-button formaction="@LinkGenerator.MqAddCheckAnswersCancel(Model.PersonId, Model.JourneyInstance!.InstanceId)" class="govuk-button--secondary" type="submit">Cancel and return to record</govuk-button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> |
Oops, something went wrong.