generated from nhs-england-tools/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/DTOSS-6549-move-ampls-to-hub
- Loading branch information
Showing
32 changed files
with
1,227 additions
and
240 deletions.
There are no files selected for viewing
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
8 changes: 8 additions & 0 deletions
8
...anager/src/Functions/CaasIntegration/receiveCaasFile/ProcessFileClasses/IValidateDates.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,8 @@ | ||
namespace NHS.Screening.ReceiveCaasFile; | ||
|
||
using Model; | ||
|
||
public interface IValidateDates | ||
{ | ||
public bool ValidateAllDates(Participant participant); | ||
} |
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
70 changes: 70 additions & 0 deletions
70
...Manager/src/Functions/CaasIntegration/receiveCaasFile/ProcessFileClasses/ValidateDates.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,70 @@ | ||
namespace NHS.Screening.ReceiveCaasFile; | ||
|
||
using Microsoft.Extensions.Logging; | ||
using Model; | ||
|
||
public class ValidateDates : IValidateDates | ||
{ | ||
|
||
private readonly ILogger<ValidateDates> _logger; | ||
|
||
public ValidateDates(ILogger<ValidateDates> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
public bool ValidateAllDates(Participant participant) | ||
{ | ||
if (!IsValidDate(participant.CurrentPostingEffectiveFromDate)) | ||
{ | ||
_logger.LogWarning("Invalid {datename} found in participant data", nameof(participant.CurrentPostingEffectiveFromDate)); | ||
return false; | ||
} | ||
if (!IsValidDate(participant.EmailAddressEffectiveFromDate)) | ||
{ | ||
_logger.LogWarning("Invalid {datename} found in participant data", nameof(participant.EmailAddressEffectiveFromDate)); | ||
return false; | ||
} | ||
if (!IsValidDate(participant.MobileNumberEffectiveFromDate)) | ||
{ | ||
_logger.LogWarning("Invalid {datename} found in participant data", nameof(participant.MobileNumberEffectiveFromDate)); | ||
return false; | ||
} | ||
if (!IsValidDate(participant.UsualAddressEffectiveFromDate)) | ||
{ | ||
_logger.LogWarning("Invalid {datename} found in participant data", nameof(participant.UsualAddressEffectiveFromDate)); | ||
return false; | ||
} | ||
if (!IsValidDate(participant.TelephoneNumberEffectiveFromDate)) | ||
{ | ||
_logger.LogWarning("Invalid {datename} found in participant data", nameof(participant.TelephoneNumberEffectiveFromDate)); | ||
return false; | ||
} | ||
if (!IsValidDate(participant.PrimaryCareProviderEffectiveFromDate)) | ||
{ | ||
_logger.LogWarning("Invalid {datename} found in participant data", nameof(participant.PrimaryCareProviderEffectiveFromDate)); | ||
return false; | ||
} | ||
if (!IsValidDate(participant.CurrentPostingEffectiveFromDate)) | ||
{ | ||
_logger.LogWarning("Invalid {datename} found in participant data", nameof(participant.CurrentPostingEffectiveFromDate)); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
|
||
private bool IsValidDate(string? date) | ||
{ | ||
if (date == null) | ||
{ | ||
return true; | ||
} | ||
if (date.Length > 8) | ||
{ | ||
return false; | ||
} | ||
return true; | ||
|
||
} | ||
} |
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
Oops, something went wrong.