Refactor: Remove CertificationType and ContractType
Removed `CertificationType` and `ContractType` properties and logic across the codebase as they were redundant. Updated `EnvelopeType` to include a validation extension method for improved data integrity. Refactored `CreateEnvelopeWizardPopup.razor` and other UI components to simplify handling of `EnvelopeType`. Conditionally included `CertificationType` and `ContractType` for `NETFRAMEWORK` targets using `#if NETFRAMEWORK` directives to ensure compatibility. Removed unused enums, imports, and methods. Updated `CreateEnvelopeCommandHandler` and related classes to reflect these changes.
This commit is contained in:
@@ -35,25 +35,11 @@ namespace EnvelopeGenerator.Domain.Interfaces
|
||||
return envelope.DocResult != null;
|
||||
}
|
||||
|
||||
public static EnvelopeType Type(this IEnvelope envelope)
|
||||
public static EnvelopeType? Type(this IEnvelope envelope)
|
||||
{
|
||||
if (!Enum.IsDefined(typeof(EnvelopeType), envelope.EnvelopeTypeId))
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
var values = Enum.GetValues(typeof(EnvelopeType)).Cast<EnvelopeType>();
|
||||
#else
|
||||
var values = Enum.GetValues<EnvelopeType>();
|
||||
#endif
|
||||
var validValues = string.Join(", ", values.Select(value => $"{(int)value} = {value}"));
|
||||
|
||||
throw new DataIntegrityException(
|
||||
$"Invalid EnvelopeTypeId '{envelope.EnvelopeTypeId}' for envelope. " +
|
||||
$"Valid {nameof(EnvelopeType)} values are: [{validValues}]. " +
|
||||
"This indicates a data integrity issue: the envelope may have been " +
|
||||
"created or updated with an invalid EnvelopeTypeId in the database.");
|
||||
}
|
||||
|
||||
return (EnvelopeType)Enum.ToObject(typeof(EnvelopeType), envelope.EnvelopeTypeId);
|
||||
if (envelope.EnvelopeTypeId is int envelopeTypeId)
|
||||
return envelopeTypeId.ToEnvelopeType();
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void SetType(this IEnvelope envelope, EnvelopeType type)
|
||||
|
||||
Reference in New Issue
Block a user