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.
This commit is contained in:
@@ -5,22 +5,16 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using EnvelopeGenerator.Domain.Constants;
|
using EnvelopeGenerator.Domain.Constants;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Domain.Entities
|
namespace EnvelopeGenerator.Domain.Entities
|
||||||
#if NET
|
|
||||||
;
|
|
||||||
#elif NETFRAMEWORK
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[Table("TBSIG_ENVELOPE", Schema = "dbo")]
|
|
||||||
public class Envelope : IHasAddedWhen, IHasChangedWhen
|
|
||||||
{
|
{
|
||||||
|
[Table("TBSIG_ENVELOPE", Schema = "dbo")]
|
||||||
|
public class Envelope : IHasAddedWhen, IHasChangedWhen
|
||||||
|
{
|
||||||
public Envelope()
|
public Envelope()
|
||||||
{
|
{
|
||||||
// TODO: * Check the Form App and remove the default value
|
// TODO: * Check the Form App and remove the default value
|
||||||
@@ -29,7 +23,7 @@ public class Envelope : IHasAddedWhen, IHasChangedWhen
|
|||||||
Status = EnvelopeStatus.EnvelopeCreated;
|
Status = EnvelopeStatus.EnvelopeCreated;
|
||||||
Uuid = Guid.NewGuid().ToString();
|
Uuid = Guid.NewGuid().ToString();
|
||||||
Message = My.Resources.Envelope.Please_read_and_sign_this_document;
|
Message = My.Resources.Envelope.Please_read_and_sign_this_document;
|
||||||
Title= string.Empty;
|
Title = string.Empty;
|
||||||
Comment = string.Empty;
|
Comment = string.Empty;
|
||||||
Language = "de-DE";
|
Language = "de-DE";
|
||||||
SendReminderEmails = false;
|
SendReminderEmails = false;
|
||||||
@@ -81,7 +75,8 @@ public class Envelope : IHasAddedWhen, IHasChangedWhen
|
|||||||
#if nullable
|
#if nullable
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
Title { get; set; }
|
Title
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
[Column("COMMENT", TypeName = "nvarchar(128)")]
|
[Column("COMMENT", TypeName = "nvarchar(128)")]
|
||||||
public string Comment { get; set; }
|
public string Comment { get; set; }
|
||||||
@@ -146,14 +141,16 @@ public class Envelope : IHasAddedWhen, IHasChangedWhen
|
|||||||
#if nullable
|
#if nullable
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
DocResult { get; set; }
|
DocResult
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
[ForeignKey("EnvelopeTypeId")]
|
[ForeignKey("EnvelopeTypeId")]
|
||||||
public virtual EnvelopeType
|
public virtual EnvelopeType
|
||||||
#if nullable
|
#if nullable
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
Type { get; set; }
|
Type
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
@@ -167,21 +164,24 @@ public class Envelope : IHasAddedWhen, IHasChangedWhen
|
|||||||
#if nullable
|
#if nullable
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
Documents { get; set; }
|
Documents
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
public List<History>
|
public List<History>
|
||||||
#if nullable
|
#if nullable
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
Histories { get; set; }
|
Histories
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
public List<EnvelopeReceiver>
|
public List<EnvelopeReceiver>
|
||||||
#if nullable
|
#if nullable
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
EnvelopeReceivers { get; set; }
|
EnvelopeReceivers
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
//#if NETFRAMEWORK
|
//#if NETFRAMEWORK
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Validates whether the receiver and document data are complete.
|
/// Validates whether the receiver and document data are complete.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -200,9 +200,6 @@ public class Envelope : IHasAddedWhen, IHasChangedWhen
|
|||||||
|
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
//#endif
|
//#endif
|
||||||
}
|
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
@@ -1,22 +1,16 @@
|
|||||||
using System;
|
using EnvelopeGenerator.Domain.Interfaces;
|
||||||
using EnvelopeGenerator.Domain.Interfaces;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Drawing;
|
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Domain.Entities
|
namespace EnvelopeGenerator.Domain.Entities
|
||||||
#if NET
|
|
||||||
;
|
|
||||||
#elif NETFRAMEWORK
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[Table("TBSIG_RECEIVER", Schema = "dbo")]
|
|
||||||
public class Receiver : IHasAddedWhen
|
|
||||||
{
|
{
|
||||||
|
[Table("TBSIG_RECEIVER", Schema = "dbo")]
|
||||||
|
public class Receiver : IHasAddedWhen
|
||||||
|
{
|
||||||
[Key]
|
[Key]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||||
[Column("GUID")]
|
[Column("GUID")]
|
||||||
@@ -44,8 +38,5 @@ public class Receiver : IHasAddedWhen
|
|||||||
public List<EnvelopeReceiver> EnvelopeReceivers { get; set; }
|
public List<EnvelopeReceiver> EnvelopeReceivers { get; set; }
|
||||||
|
|
||||||
public string GetSignature() => EmailAddress.ToUpperInvariant().GetChecksum();
|
public string GetSignature() => EmailAddress.ToUpperInvariant().GetChecksum();
|
||||||
}
|
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
@@ -8,15 +8,10 @@ using System.Collections.Generic;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Domain.Entities
|
namespace EnvelopeGenerator.Domain.Entities
|
||||||
#if NET
|
|
||||||
;
|
|
||||||
#elif NETFRAMEWORK
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")]
|
|
||||||
public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhen, IHasChangedWho
|
|
||||||
{
|
{
|
||||||
|
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")]
|
||||||
|
public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhen, IHasChangedWho
|
||||||
|
{
|
||||||
public Signature()
|
public Signature()
|
||||||
{
|
{
|
||||||
// TODO: * Check the Form App and remove the default value
|
// TODO: * Check the Form App and remove the default value
|
||||||
@@ -102,7 +97,8 @@ public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhe
|
|||||||
#if nullable
|
#if nullable
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
ChangedWho { get; set; }
|
ChangedWho
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
[ForeignKey("DocumentId")]
|
[ForeignKey("DocumentId")]
|
||||||
public virtual Document Document { get; set; }
|
public virtual Document Document { get; set; }
|
||||||
@@ -112,13 +108,15 @@ public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhe
|
|||||||
#if nullable
|
#if nullable
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
Receiver { get; set; }
|
Receiver
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
public virtual IEnumerable<ElementAnnotation>
|
public virtual IEnumerable<ElementAnnotation>
|
||||||
#if nullable
|
#if nullable
|
||||||
?
|
?
|
||||||
#endif
|
#endif
|
||||||
Annotations { get; set; }
|
Annotations
|
||||||
|
{ get; set; }
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
@@ -127,8 +125,5 @@ public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IHasChangedWhe
|
|||||||
[NotMapped]
|
[NotMapped]
|
||||||
public double Left => Math.Round(X, 5);
|
public double Left => Math.Round(X, 5);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
#if NETFRAMEWORK
|
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
@@ -1,7 +1,3 @@
|
|||||||
#if NETFRAMEWORK
|
|
||||||
using System;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Domain.Interfaces
|
namespace EnvelopeGenerator.Domain.Interfaces
|
||||||
{
|
{
|
||||||
public interface IHasAddedWho
|
public interface IHasAddedWho
|
||||||
|
|||||||
Reference in New Issue
Block a user