Files
EnvelopeGenerator/EnvelopeGenerator.Domain/Entities/Signature.cs
TekH c674a450d8 Refactor entities: remove preprocessor blocks, unify style
Refactored Envelope, Receiver, and Signature entity classes to eliminate preprocessor directives around class and property definitions. Applied attributes directly and reformatted properties for clarity. Constructors are now always present, with default initializations still conditional where needed. Removed obsolete directives from IHasAddedWho. These changes improve code readability, maintainability, and cross-platform compatibility.
2026-02-09 15:37:00 +01:00

129 lines
3.1 KiB
C#

using System;
using EnvelopeGenerator.Domain.Interfaces;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#if NETFRAMEWORK
using System.Collections.Generic;
#endif
namespace EnvelopeGenerator.Domain.Entities
{
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")]
public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhen, IHasChangedWho
{
public Signature()
{
// TODO: * Check the Form App and remove the default value
#if NETFRAMEWORK
Id = -1;
Required = false;
ReadOnly = false;
AnnotationIndex = 0;
#endif
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Column("GUID")]
public int Id { get; set; }
[Required]
[Column("DOCUMENT_ID")]
public int DocumentId { get; set; }
[Required]
[Column("RECEIVER_ID")]
public int ReceiverId { get; set; }
[Required]
[Column("ELEMENT_TYPE")]
[DefaultValue(0)]
public int ElementType { get; set; }
[Required]
[Column("POSITION_X")]
[DefaultValue(0)]
public double X { get; set; }
[Required]
[Column("POSITION_Y")]
[DefaultValue(0)]
public double Y { get; set; }
[Required]
[Column("WIDTH")]
[DefaultValue(0)]
public double Width { get; set; }
[Required]
[Column("HEIGHT")]
[DefaultValue(0)]
public double Height { get; set; }
[Required]
[Column("PAGE")]
[DefaultValue(1)]
public int Page { get; set; }
[Required]
[Column("REQUIRED")]
[DefaultValue(false)]
public bool Required { get; set; }
[Column("TOOLTIP")]
public string Tooltip { get; set; }
[Required]
[Column("READ_ONLY")]
[DefaultValue(false)]
public bool ReadOnly { get; set; }
[Required]
[Column("ANNOTATION_INDEX")]
[DefaultValue(0)]
public int AnnotationIndex { get; set; }
[Required]
[Column("ADDED_WHEN", TypeName = "datetime")]
[DefaultValue("GETDATE()")]
public DateTime AddedWhen { get; set; }
[Column("CHANGED_WHEN", TypeName = "datetime")]
public DateTime? ChangedWhen { get; set; }
[Column("CHANGED_WHO", TypeName = "nvarchar(100)")]
public string
#if nullable
?
#endif
ChangedWho
{ get; set; }
[ForeignKey("DocumentId")]
public virtual Document Document { get; set; }
[ForeignKey("ReceiverId")]
public virtual Receiver
#if nullable
?
#endif
Receiver
{ get; set; }
public virtual IEnumerable<ElementAnnotation>
#if nullable
?
#endif
Annotations
{ get; set; }
#if NETFRAMEWORK
[NotMapped]
public double Top => Math.Round(Y, 5);
[NotMapped]
public double Left => Math.Round(X, 5);
#endif
}
}