Refactor CertificationType to use enum

Changed CertificationType from int? to CertificationType? enum across multiple files, including EnvelopeDto, EnvelopeTypeDto, and CreateEnvelopeCommand, to improve type safety. Removed the NormalizeCertificationType method as it is no longer necessary. Updated components and records to use the enum directly, enhancing code clarity and reducing potential errors. Added necessary using directives for the enum.
This commit is contained in:
2026-10-26 16:59:49 +01:00
parent ae1ecbc15f
commit c2b7579717
10 changed files with 26 additions and 43 deletions

View File

@@ -652,7 +652,7 @@
string _language = "de-DE";
bool _useAccessCode;
bool _tfaEnabled;
int _certificationType = (int)CertificationType.AdvancedElectronicSignature;
CertificationType _certificationType = CertificationType.AdvancedElectronicSignature;
int _finalEmailToCreator = (int)FinalEmailType.No;
int _finalEmailToReceivers = (int)FinalEmailType.No;
bool _sendReminderEmails;
@@ -745,7 +745,7 @@
_language = string.IsNullOrWhiteSpace(payload.Language) ? "de-DE" : payload.Language;
_useAccessCode = payload.UseAccessCode;
_tfaEnabled = payload.TFAEnabled;
_certificationType = NormalizeCertificationType(payload.CertificationType);
_certificationType = payload.CertificationType;
_finalEmailToCreator = payload.FinalEmailToCreator;
_finalEmailToReceivers = payload.FinalEmailToReceivers;
_sendReminderEmails = payload.SendReminderEmails;
@@ -852,7 +852,7 @@
if (_tfaEnabled)
_useAccessCode = true;
_certificationType = NormalizeCertificationType(envelope.CertificationType ?? (int)CertificationType.AdvancedElectronicSignature);
_certificationType = envelope.CertificationType ?? CertificationType.AdvancedElectronicSignature;
_finalEmailToCreator = envelope.FinalEmailToCreator ?? (int)FinalEmailType.No;
_finalEmailToReceivers = envelope.FinalEmailToReceivers ?? (int)FinalEmailType.No;
@@ -1046,7 +1046,7 @@
_useAccessCode = true;
if (envelopeType.CertificationType.HasValue)
_certificationType = NormalizeCertificationType(envelopeType.CertificationType.Value);
_certificationType = envelopeType.CertificationType.Value;
if (envelopeType.FinalEmailToCreator.HasValue)
_finalEmailToCreator = envelopeType.FinalEmailToCreator.Value;
@@ -1433,7 +1433,6 @@
void NormalizeSettings()
{
_language = string.IsNullOrWhiteSpace(_language) ? "de-DE" : _language.Trim();
_certificationType = NormalizeCertificationType(_certificationType);
if (_tfaEnabled)
_useAccessCode = true;
@@ -1447,13 +1446,6 @@
_expiresWarningWhenDays = _expiresWhenDays;
}
static int NormalizeCertificationType(int value)
{
return value == 2
? 2
: (int)CertificationType.AdvancedElectronicSignature;
}
bool ValidateSettings(out string? message)
{
NormalizeSettings();