Files
EnvelopeGenerator/EnvelopeGenerator.Domain/Interfaces/IEnvelope.cs
TekH 48b2fc0eca Refactor: Replace EnvelopeTypeId with EnvelopeType enum
Replaced all instances of `EnvelopeTypeId` (int/int?) with `Type`
(EnvelopeType/EnvelopeType?) across the codebase to improve type
safety and readability. Updated affected properties, methods, and
logic in DTOs, commands, handlers, and Razor components.

Introduced conditional compilation to handle differences between
.NET and .NET Framework where necessary. Removed obsolete helper
methods for `EnvelopeTypeId`. This refactor ensures consistent use
of the strongly-typed `EnvelopeType` enum, reducing the risk of
invalid values and aligning with best practices.
2026-11-13 11:46:56 +01:00

53 lines
1.1 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
{
#if NET
public EnvelopeType? Type { get; set; }
#elif NETFRAMEWORK
int EnvelopeTypeId { get; set; }
#endif
byte[]
#if nullable
?
#endif
DocResult { get; }
}
public static class EnvelopeExtensions
{
public static bool IsReadAndConfirm(this IEnvelope envelope)
{
#if NET
return envelope.Type == EnvelopeType.ReadAndConfirm;
#elif NETFRAMEWORK
return envelope.EnvelopeTypeId == (int)EnvelopeType.ReadAndConfirm;
#endif
}
public static bool IsReadAndSign(this IEnvelope envelope)
{
#if NET
return envelope.Type != EnvelopeType.ReadAndConfirm;
#elif NETFRAMEWORK
return envelope.EnvelopeTypeId != (int)EnvelopeType.ReadAndConfirm;
#endif
}
public static bool IsBurned(this IEnvelope envelope)
{
return envelope.DocResult != null;
}
}
}