refactor: Plattform-spezifische Anpassungen an der Receiver-Klasse

- `NotMapped` Properties nur für NETFRAMEWORK verfügbar gemacht
- Klasse und Namespaces für NET- und NETFRAMEWORK-Bedingungen angepasst
- Redundant in NET definierten Code entfernt
This commit is contained in:
2025-08-19 14:14:10 +02:00
parent d43877db62
commit 50a541c5bf

View File

@@ -7,84 +7,94 @@ using System.Collections.Generic;
#endif #endif
namespace EnvelopeGenerator.Domain.Entities namespace EnvelopeGenerator.Domain.Entities
{ #if NET
[Table("TBSIG_RECEIVER", Schema = "dbo")] ;
public class Receiver #elif NETFRAMEWORK
{ {
[Key] #endif
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Required, EmailAddress] [Table("TBSIG_RECEIVER", Schema = "dbo")]
[Column("EMAIL_ADDRESS", TypeName = "nvarchar(250)")] public class Receiver
[StringLength(250)] {
public string EmailAddress { get; set; } [Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Required] [Required, EmailAddress]
[Column("SIGNATURE", TypeName = "nvarchar(64)")] [Column("EMAIL_ADDRESS", TypeName = "nvarchar(250)")]
public string Signature { get; set; } [StringLength(250)]
public string EmailAddress { get; set; }
[Required] [Required]
[Column("ADDED_WHEN", TypeName = "datetime")] [Column("SIGNATURE", TypeName = "nvarchar(64)")]
public DateTime AddedWhen { get; set; } public string Signature { get; set; }
[Column("TOTP_SECRET_KEY", TypeName = "nvarchar(MAX)")] [Required]
public string TotpSecretkey { get; set; } [Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("TFA_REG_DEADLINE", TypeName = "datetime")] [Column("TOTP_SECRET_KEY", TypeName = "nvarchar(MAX)")]
public DateTime? TfaRegDeadline { get; set; } public string TotpSecretkey { get; set; }
public List<EnvelopeReceiver> EnvelopeReceivers { get; set; } [Column("TFA_REG_DEADLINE", TypeName = "datetime")]
public DateTime? TfaRegDeadline { get; set; }
[NotMapped] public List<EnvelopeReceiver> EnvelopeReceivers { get; set; }
public string Name { get; set; }
[NotMapped] #if NETFRAMEWORK
public string Company { get; set; } = string.Empty; [NotMapped]
public string Name { get; set; }
[NotMapped] [NotMapped]
public string JobTitle { get; set; } = string.Empty; public string Company { get; set; } = string.Empty;
[NotMapped] [NotMapped]
public string PhoneNumber { get; set; } = string.Empty; public string JobTitle { get; set; } = string.Empty;
[NotMapped] [NotMapped]
public string AccessCode { get; set; } = string.Empty; public string PhoneNumber { get; set; } = string.Empty;
[NotMapped] [NotMapped]
public string PrivateMessage { get; set; } = string.Empty; public string AccessCode { get; set; } = string.Empty;
[NotMapped] [NotMapped]
public int Sequence { get; set; } = 0; public string PrivateMessage { get; set; } = string.Empty;
[NotMapped] [NotMapped]
public DateTime SignedDate { get; set; } = DateTime.MinValue; public int Sequence { get; set; } = 0;
[NotMapped] [NotMapped]
public Constants.ReceiverStatus Status { get; set; } public DateTime SignedDate { get; set; } = DateTime.MinValue;
[NotMapped] [NotMapped]
public Constants.ColorType ColorType { get; set; } public Constants.ReceiverStatus Status { get; set; }
[NotMapped] [NotMapped]
public bool HasId => Id > 0; public Constants.ColorType ColorType { get; set; }
[NotMapped] [NotMapped]
public bool HasEmailAndName => public bool HasId => Id > 0;
!string.IsNullOrWhiteSpace(EmailAddress) &&
!string.IsNullOrWhiteSpace(Name);
[NotMapped] [NotMapped]
public string SignedDateDisplayValue => public bool HasEmailAndName =>
SignedDate == DateTime.MinValue ? "-" : SignedDate.ToString("G"); !string.IsNullOrWhiteSpace(EmailAddress) &&
!string.IsNullOrWhiteSpace(Name);
[NotMapped] [NotMapped]
public Color Color => ColorType.ToColor(); public string SignedDateDisplayValue =>
SignedDate == DateTime.MinValue ? "-" : SignedDate.ToString("G");
public string GetSignature() [NotMapped]
{ public Color Color => ColorType.ToColor();
return EmailAddress.ToUpperInvariant().GetChecksum();
} public string GetSignature()
{
return EmailAddress.ToUpperInvariant().GetChecksum();
} }
} #endif
}
#if NETFRAMEWORK
}
#endif