refactor(Envelope): Standardwerte in der Envelope-Entity in den Konstruktor verschoben

This commit is contained in:
2025-08-19 14:06:17 +02:00
parent 242e66cd8d
commit d43877db62

View File

@@ -8,39 +8,55 @@ using System.Linq;
#endif #endif
namespace EnvelopeGenerator.Domain.Entities namespace EnvelopeGenerator.Domain.Entities
#if NET
;
#elif NETFRAMEWORK
{ {
#endif
[Table("TBSIG_ENVELOPE", Schema = "dbo")] [Table("TBSIG_ENVELOPE", Schema = "dbo")]
public class Envelope public class Envelope
{
public Envelope()
{ {
// TODO: * Check the Form App and remove the default value // TODO: * Check the Form App and remove the default value
#if NETFRAMEWORK
Id = 0;
Status = (int)Constants.EnvelopeStatus.EnvelopeCreated;
Uuid = Guid.NewGuid().ToString();
Message = My.Resources.Envelope.Please_read_and_sign_this_document;
Title= string.Empty;
Comment = string.Empty;
Language = "de-DE";
SendReminderEmails = false;
FirstReminderDays = 0;
ReminderIntervalDays = 0;
CertificationType = (int)Constants.CertificationType.AdvancedElectronicSignature;
UseAccessCode = false;
Documents = Enumerable.Empty<EnvelopeDocument>().ToList();
History = Enumerable.Empty<EnvelopeHistory>().ToList();
#endif
}
[Key] [Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")] [Column("GUID")]
public int Id { get; set; } = 0; public int Id { get; set; }
[Required] [Required]
[Column("USER_ID")] [Column("USER_ID")]
public int UserId { get; set; } public int UserId { get; set; }
// TODO: * Check the Form App and remove the default value
[Required] [Required]
[Column("STATUS")] [Column("STATUS")]
public int Status { get; set; } = (int)Constants.EnvelopeStatus.EnvelopeCreated; public int Status { get; set; }
[NotMapped]
public string StatusName => ((Constants.EnvelopeStatus)Status).ToString();
// TODO: The default value is set to 0. Check the Form App to remove this
[Required] [Required]
[Column("ENVELOPE_UUID", TypeName = "nvarchar(36)")] [Column("ENVELOPE_UUID", TypeName = "nvarchar(36)")]
public string Uuid { get; set; } = Guid.NewGuid().ToString(); public string Uuid { get; set; }
// TODO: * Check the Form App and remove the default value
[Column("MESSAGE", TypeName = "nvarchar(max)")] [Column("MESSAGE", TypeName = "nvarchar(max)")]
public string Message { get; set; } public string Message { get; set; }
#if NETFRAMEWORK
= My.Resources.Envelope.Please_read_and_sign_this_document;
#endif
[Column("EXPIRES_WHEN", TypeName = "datetime")] [Column("EXPIRES_WHEN", TypeName = "datetime")]
public DateTime? ExpiresWhen { get; set; } public DateTime? ExpiresWhen { get; set; }
@@ -55,55 +71,44 @@ namespace EnvelopeGenerator.Domain.Entities
[Column("CHANGED_WHEN", TypeName = "datetime")] [Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; } public DateTime? ChangedWhen { get; set; }
// TODO: * Check the Form App and remove the default value
[Column("TITLE", TypeName = "nvarchar(128)")] [Column("TITLE", TypeName = "nvarchar(128)")]
public string public string
#if NET #if NET
? ?
#endif #endif
Title { get; set; } Title { get; set; }
#if NETFRAMEWORK
= string.Empty;
#endif
[Column("COMMENT", TypeName = "nvarchar(128)")] [Column("COMMENT", TypeName = "nvarchar(128)")]
public string Comment { get; set; } = string.Empty; public string Comment { get; set; }
[Column("CONTRACT_TYPE")] [Column("CONTRACT_TYPE")]
public int? ContractType { get; set; } public int? ContractType { get; set; }
// TODO: * Check the Form App and remove the default value
#if NETFRAMEWORK #if NETFRAMEWORK
[NotMapped] [NotMapped]
public string ContractTypeTranslated => My.Resources.Model.ResourceManager.GetString(ContractType.ToString()); public string ContractTypeTranslated => My.Resources.Model.ResourceManager.GetString(ContractType.ToString());
#endif #endif
// TODO: * Check the Form App and remove the default value
[Column("LANGUAGE", TypeName = "nvarchar(5)")] [Column("LANGUAGE", TypeName = "nvarchar(5)")]
public string Language { get; set; } = "de-DE"; public string Language { get; set; }
// TODO: * Check the Form App and remove the default value
[Column("SEND_REMINDER_EMAILS")] [Column("SEND_REMINDER_EMAILS")]
public bool SendReminderEmails { get; set; } = false; public bool SendReminderEmails { get; set; }
// TODO: * Check the Form App and remove the default value
[Column("FIRST_REMINDER_DAYS")] [Column("FIRST_REMINDER_DAYS")]
public int? FirstReminderDays { get; set; } = 0; public int? FirstReminderDays { get; set; }
// TODO: * Check the Form App and remove the default value
[Column("REMINDER_INTERVAL_DAYS")] [Column("REMINDER_INTERVAL_DAYS")]
public int? ReminderIntervalDays { get; set; } = 0; public int? ReminderIntervalDays { get; set; }
[Column("ENVELOPE_TYPE")] [Column("ENVELOPE_TYPE")]
public int? EnvelopeTypeId { get; set; } public int? EnvelopeTypeId { get; set; }
// TODO: * Check the Form App and remove the default value
[Column("CERTIFICATION_TYPE")] [Column("CERTIFICATION_TYPE")]
public int? CertificationType { get; set; } = (int)Constants.CertificationType.AdvancedElectronicSignature; public int? CertificationType { get; set; }
// TODO: * Check the Form App and remove the default value
[Column("USE_ACCESS_CODE")] [Column("USE_ACCESS_CODE")]
public bool UseAccessCode { get; set; } = false; public bool UseAccessCode { get; set; }
[Column("FINAL_EMAIL_TO_CREATOR")] [Column("FINAL_EMAIL_TO_CREATOR")]
public int? FinalEmailToCreator { get; set; } public int? FinalEmailToCreator { get; set; }
@@ -117,50 +122,35 @@ namespace EnvelopeGenerator.Domain.Entities
[Column("EXPIRES_WARNING_WHEN_DAYS")] [Column("EXPIRES_WARNING_WHEN_DAYS")]
public int? ExpiresWarningWhenDays { get; set; } public int? ExpiresWarningWhenDays { get; set; }
// TODO: * Check the Form App and remove the default value
[Column("TFA_ENABLED", TypeName = "bit")]
public bool TFAEnabled { get; set; } = false;
[Column("DOC_RESULT", TypeName = "varbinary(max)")]
public byte[] DocResult { get; set; }
[NotMapped]
public string CURRENT_WORK_APP { get; set; } = "signFLOW GUI";
// TODO: * Check the Form App and remove the default value
[ForeignKey("UserId")] [ForeignKey("UserId")]
public User User { get; set; } public User User { get; set; }
[ForeignKey("EnvelopeTypeId")] [ForeignKey("EnvelopeTypeId")]
public EnvelopeType EnvelopeType { get; set; } public EnvelopeType EnvelopeType { get; set; }
#if NETFRAMEWORK
[NotMapped] [NotMapped]
public string EnvelopeTypeTitle => EnvelopeType?.Title; public string CURRENT_WORK_APP { get; set; } = "signFLOW GUI";
[NotMapped] [NotMapped]
public bool IsAlreadySent => Status > (int)Constants.EnvelopeStatus.EnvelopeSaved; public bool IsAlreadySent => Status > (int)Constants.EnvelopeStatus.EnvelopeSaved;
#if NETFRAMEWORK
[NotMapped]
public string StatusTranslated => My.Resources.Model.ResourceManager.GetString(((Constants.EnvelopeStatus)Status).ToString());
#endif
[NotMapped] [NotMapped]
public bool TFA_Enabled { get; set; } = false; public bool TFA_Enabled { get; set; } = false;
[NotMapped] [NotMapped]
public byte[] DOC_RESULT { get; set; } public byte[] DOC_RESULT { get; set; }
#endif
// TODO: * Check the Form App and remove the default value public List<EnvelopeDocument> Documents { get; set; }
public List<EnvelopeDocument> Documents { get; set; } = new List<EnvelopeDocument>();
// TODO: * Check the Form App and remove the default value public List<EnvelopeHistory> History { get; set; }
public List<EnvelopeHistory> History { get; set; } = new List<EnvelopeHistory>();
// TODO: * Check the Form App and remove the default value // TODO: * Check the Form App and remove the default value
[NotMapped] [NotMapped]
public List<Receiver> Receivers { get; set; } = new List<Receiver>(); public List<Receiver> Receivers { get; set; } = Enumerable.Empty<Receiver>().ToList();
#if NETFRAMEWORK
/// <summary> /// <summary>
/// Validates whether the receiver and document data are complete. /// Validates whether the receiver and document data are complete.
/// </summary> /// </summary>
@@ -179,5 +169,9 @@ namespace EnvelopeGenerator.Domain.Entities
return errors; return errors;
} }
#endif
} }
#if NETFRAMEWORK
} }
#endif