Files
EnvelopeGenerator/EnvelopeGenerator.Domain/Entities/EnvelopeReceiver.cs
TekH 910a870ddf Refactor entities: remove preprocessor directives, unify style
Large-scale cleanup of entity and interface classes:
- Removed obsolete #if NET/NETFRAMEWORK preprocessor blocks
- Unified class/property formatting and indentation
- Standardized use of data annotations
- Improved nullable reference type handling
- Simplified interfaces (IHasEnvelope, IHasReceiver)
- Removed redundant and dead code
- No changes to business logic or data model

These changes modernize and standardize the codebase for easier maintenance and .NET compatibility.
2026-02-09 15:32:41 +01:00

91 lines
2.5 KiB
C#

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using DigitalData.Core.Abstractions.Interfaces;
using EnvelopeGenerator.Domain.Interfaces;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE_RECEIVER", Schema = "dbo")]
public class EnvelopeReceiver : IHasEnvelope, IHasReceiver, IEntity, IHasAddedWhen, IHasChangedWhen
{
public EnvelopeReceiver()
{
#if NETFRAMEWORK
CompanyName = string.Empty;
#endif
}
[Column("ENVELOPE_ID")]
public int EnvelopeId { get; set; }
[Column("RECEIVER_ID")]
public int ReceiverId { get; set; }
[Required]
[Column("SEQUENCE")]
public int Sequence { get; set; }
[Column("NAME", TypeName = "nvarchar(128)")]
public string Name { get; set; }
[Column("JOB_TITLE", TypeName = "nvarchar(128)")]
public string JobTitle { get; set; }
[Column("COMPANY_NAME", TypeName = "nvarchar(128)")]
public string
#if nullable
?
#endif
CompanyName { get; set; }
[Column("PRIVATE_MESSAGE", TypeName = "nvarchar(max)")]
public string PrivateMessage { get; set; }
[Column("ACCESS_CODE", TypeName = "nvarchar(64)")]
public string AccessCode { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
[Column("PHONE_NUMBER")]
[StringLength(20)]
[RegularExpression(@"^\+[0-9]+$", ErrorMessage = "Phone number must start with '+' followed by digits.")]
public string PhoneNumber { get; set; }
[NotMapped]
public Tuple<int, int> Id => Tuple.Create(EnvelopeId, ReceiverId);
[NotMapped]
public bool HasPhoneNumber => !string.IsNullOrWhiteSpace(PhoneNumber);
[ForeignKey("EnvelopeId")]
public Envelope
#if nullable
?
#endif
Envelope { get; set; }
[ForeignKey("ReceiverId")]
public Receiver
#if nullable
?
#endif
Receiver { get; set; }
#region Model of old serice
[NotMapped]
public Constants.ReceiverStatus Status { get; set; }
[NotMapped]
public bool HasId => Id.Item1 > 0 && Id.Item2 > 0;
[NotMapped]
public bool HasEmailAndName =>
#endregion
}
}