Developer 02 1a69478f48 Refactor entity classes for non-nullable properties
Removed nullable types and `init` properties, replacing them with standard getters and setters in various entity classes. Updated properties like `DocumentPath`, `SendingProfile`, and `SignatureHost` to be non-nullable and added required attributes.

Modified the project file to include `net462` as a target framework and added a reference for `System.ComponentModel.Annotations`. Removed the `IUnique<int>` interface from several classes to simplify uniqueness management.

These changes improve data integrity and usability across the entity classes.
2025-05-14 09:16:02 +02:00

110 lines
3.3 KiB
C#

using EnvelopeGenerator.Common;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_ENVELOPE", Schema = "dbo")]
public class Envelope
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Required]
[Column("USER_ID")]
public int UserId { get; set; }
[Required]
[Column("STATUS")]
public int Status { get; set; }
[NotMapped]
public string StatusName => ((Constants.EnvelopeStatus)Status).ToString();
[Required]
[Column("ENVELOPE_UUID", TypeName = "nvarchar(36)")]
public string Uuid { get; set; }
[Column("MESSAGE", TypeName = "nvarchar(max)")]
public string Message { get; set; }
[Column("EXPIRES_WHEN", TypeName = "datetime")]
public DateTime ExpiresWhen { get; set; }
[Column("EXPIRES_WARNING_WHEN", TypeName = "datetime")]
public DateTime ExpiresWarningWhen { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime ChangedWhen { get; set; }
[Column("TITLE", TypeName = "nvarchar(128)")]
public string Title { get; set; }
[Column("CONTRACT_TYPE")]
public int ContractType { get; set; }
[Column("LANGUAGE", TypeName = "nvarchar(5)")]
public string Language { get; set; }
[Column("SEND_REMINDER_EMAILS")]
public bool SendReminderEmails { get; set; }
[Column("FIRST_REMINDER_DAYS")]
public int FirstReminderDays { get; set; }
[Column("REMINDER_INTERVAL_DAYS")]
public int ReminderIntervalDays { get; set; }
[Column("ENVELOPE_TYPE")]
public int EnvelopeTypeId { get; set; }
[Column("CERTIFICATION_TYPE")]
public int CertificationType { get; set; }
[Column("USE_ACCESS_CODE")]
public bool UseAccessCode { get; set; }
[Column("FINAL_EMAIL_TO_CREATOR")]
public int FinalEmailToCreator { get; set; }
[Column("FINAL_EMAIL_TO_RECEIVERS")]
public int FinalEmailToReceivers { get; set; }
[Column("EXPIRES_WHEN_DAYS")]
public int ExpiresWhenDays { get; set; }
[Column("EXPIRES_WARNING_WHEN_DAYS")]
public int ExpiresWarningWhenDays { get; set; }
[Column("TFA_ENABLED", TypeName = "bit")]
public bool TFAEnabled { get; set; }
[Column("DOC_RESULT", TypeName = "varbinary(max)")]
public byte[] DocResult { get; set; }
/// <summary>
/// The sender of envelope
/// </summary>
[ForeignKey("UserId")]
public DigitalData.UserManager.Domain.Entities.User User { get; set; }
[ForeignKey("EnvelopeTypeId")]
public EnvelopeType EnvelopeType { get; set; }
[NotMapped]
public string EnvelopeTypeTitle => EnvelopeType.Title;
[NotMapped]
public bool IsAlreadySent => Status > (int) Constants.EnvelopeStatus.EnvelopeSaved;
public IEnumerable<EnvelopeDocument> Documents { get; set; }
public IEnumerable<EnvelopeHistory> History { get; set; }
}
}