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:
2026-11-13 11:06:12 +01:00
parent 67e435c3fa
commit 13784cd595
17 changed files with 79 additions and 131 deletions

View File

@@ -1,4 +1,5 @@
namespace EnvelopeGenerator.Domain.Constants
#if NETFRAMEWORK
namespace EnvelopeGenerator.Domain.Constants
{
public enum CertificationType
{
@@ -6,3 +7,4 @@
ElectronicSignature = 2
}
}
#endif

View File

@@ -1,8 +1,10 @@
namespace EnvelopeGenerator.Domain.Constants
#if NETFRAMEWORK
namespace EnvelopeGenerator.Domain.Constants
{
public enum ContractType
{
Contract = 1,
ReadAndSign = 2
}
}
}
#endif

View File

@@ -1,4 +1,11 @@
namespace EnvelopeGenerator.Domain.Constants
#if NETFRAMEWORK
using System;
using System.Linq;
#endif
using EnvelopeGenerator.Domain.Exceptions;
namespace EnvelopeGenerator.Domain.Constants
{
public enum EnvelopeType
{
@@ -6,4 +13,28 @@
ReadAndConfirm = 2,
AdvancedSignature = 3
}
public static class EnvelopeTypeExtensions
{
public static EnvelopeType ToEnvelopeType(this int envelopeTypeId)
{
if (!Enum.IsDefined(typeof(EnvelopeType), 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 '{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), envelopeTypeId);
}
}
}