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.
56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
using EnvelopeGenerator.Domain.Constants;
|
|
using EnvelopeGenerator.Domain.Exceptions;
|
|
#if NETFRAMEWORK
|
|
using System;
|
|
using System.Linq;
|
|
#endif
|
|
|
|
namespace EnvelopeGenerator.Domain.Interfaces
|
|
{
|
|
public interface IEnvelope
|
|
{
|
|
int? EnvelopeTypeId { get; set; }
|
|
|
|
byte[]
|
|
#if nullable
|
|
?
|
|
#endif
|
|
DocResult { get; }
|
|
}
|
|
|
|
public static class EnvelopeExtensions
|
|
{
|
|
public static bool IsReadAndConfirm(this IEnvelope envelope)
|
|
{
|
|
return envelope.EnvelopeTypeId == 2;
|
|
}
|
|
|
|
public static bool IsReadAndSign(this IEnvelope envelope)
|
|
{
|
|
return envelope.EnvelopeTypeId != 2;
|
|
}
|
|
|
|
public static bool IsBurned(this IEnvelope envelope)
|
|
{
|
|
return envelope.DocResult != null;
|
|
}
|
|
|
|
public static EnvelopeType? Type(this IEnvelope envelope)
|
|
{
|
|
if (envelope.EnvelopeTypeId is int envelopeTypeId)
|
|
return envelopeTypeId.ToEnvelopeType();
|
|
return null;
|
|
}
|
|
|
|
public static void SetType(this IEnvelope envelope, EnvelopeType type)
|
|
{
|
|
envelope.EnvelopeTypeId = (int)type;
|
|
}
|
|
|
|
public static TEnvelope WithType<TEnvelope>(this TEnvelope envelope, EnvelopeType type) where TEnvelope : IEnvelope
|
|
{
|
|
envelope.SetType(type);
|
|
return envelope;
|
|
}
|
|
}
|
|
} |