rename Entities.Signature as DocReceiverElement

This commit is contained in:
2026-06-09 22:52:41 +02:00
parent d59aa6157d
commit cb6dea319b
16 changed files with 40 additions and 40 deletions

View File

@@ -23,7 +23,7 @@ public class MappingProfile : Profile
{ {
// Entity to DTO mappings // Entity to DTO mappings
CreateMap<Config, ConfigDto>(); CreateMap<Config, ConfigDto>();
CreateMap<Signature, SignatureDto>(); CreateMap<DocReceiverElement, SignatureDto>();
CreateMap<DocumentStatus, DocumentStatusDto>(); CreateMap<DocumentStatus, DocumentStatusDto>();
CreateMap<EmailTemplate, EmailTemplateDto>(); CreateMap<EmailTemplate, EmailTemplateDto>();
CreateMap<Envelope, EnvelopeDto>(); CreateMap<Envelope, EnvelopeDto>();
@@ -39,7 +39,7 @@ public class MappingProfile : Profile
// DTO to Entity mappings // DTO to Entity mappings
CreateMap<ConfigDto, Config>(); CreateMap<ConfigDto, Config>();
CreateMap<SignatureDto, Signature>(); CreateMap<SignatureDto, DocReceiverElement>();
CreateMap<DocumentStatusDto, DocumentStatus>(); CreateMap<DocumentStatusDto, DocumentStatus>();
CreateMap<EmailTemplateDto, EmailTemplate>(); CreateMap<EmailTemplateDto, EmailTemplate>();
CreateMap<EnvelopeDto, Envelope>(); CreateMap<EnvelopeDto, Envelope>();

View File

@@ -6,6 +6,6 @@ namespace EnvelopeGenerator.Application.Common.Interfaces.Repositories;
/// ///
/// </summary> /// </summary>
[Obsolete("Use IRepository")] [Obsolete("Use IRepository")]
public interface IDocumentReceiverElementRepository : ICRUDRepository<Signature, int> public interface IDocumentReceiverElementRepository : ICRUDRepository<DocReceiverElement, int>
{ {
} }

View File

@@ -8,6 +8,6 @@ namespace EnvelopeGenerator.Application.Common.Interfaces.Services;
/// ///
/// </summary> /// </summary>
[Obsolete("Use MediatR")] [Obsolete("Use MediatR")]
public interface IDocumentReceiverElementService : IBasicCRUDService<SignatureDto, Signature, int> public interface IDocumentReceiverElementService : IBasicCRUDService<SignatureDto, DocReceiverElement, int>
{ {
} }

View File

@@ -11,7 +11,7 @@ namespace EnvelopeGenerator.Application.Services;
/// ///
/// </summary> /// </summary>
[Obsolete("Use MediatR")] [Obsolete("Use MediatR")]
public class DocumentReceiverElementService : BasicCRUDService<IDocumentReceiverElementRepository, SignatureDto, Signature, int>, IDocumentReceiverElementService public class DocumentReceiverElementService : BasicCRUDService<IDocumentReceiverElementRepository, SignatureDto, DocReceiverElement, int>, IDocumentReceiverElementService
{ {
/// <summary> /// <summary>
/// ///

View File

@@ -164,7 +164,7 @@ Public Class frmFinalizePDF
Return Return
End If End If
Dim sigRepo = scope.ServiceProvider.Repository(Of Signature)() Dim sigRepo = scope.ServiceProvider.Repository(Of DocReceiverElement)()
Dim elements = sigRepo _ Dim elements = sigRepo _
.Where(Function(sig) sig.Document.EnvelopeId = envelopeId) _ .Where(Function(sig) sig.Document.EnvelopeId = envelopeId) _
.Include(Function(sig) sig.Annotations) _ .Include(Function(sig) sig.Annotations) _

View File

@@ -46,7 +46,7 @@ Namespace Jobs.FinalizeDocument
Return pSourceBuffer Return pSourceBuffer
End If End If
Dim sigRepo = scope.ServiceProvider.Repository(Of Signature)() Dim sigRepo = scope.ServiceProvider.Repository(Of DocReceiverElement)()
Dim elements = sigRepo _ Dim elements = sigRepo _
.Where(Function(sig) sig.Document.EnvelopeId = envelopeId) _ .Where(Function(sig) sig.Document.EnvelopeId = envelopeId) _
.Include(Function(sig) sig.Annotations) _ .Include(Function(sig) sig.Annotations) _
@@ -58,7 +58,7 @@ Namespace Jobs.FinalizeDocument
End Using End Using
End Function End Function
Public Function BurnElementAnnotsToPDF(pSourceBuffer As Byte(), elements As List(Of Signature)) As Byte() Public Function BurnElementAnnotsToPDF(pSourceBuffer As Byte(), elements As List(Of DocReceiverElement)) As Byte()
' Add background ' Add background
Using doc As Pdf(Of MemoryStream, MemoryStream) = Pdf.FromMemory(pSourceBuffer) Using doc As Pdf(Of MemoryStream, MemoryStream) = Pdf.FromMemory(pSourceBuffer)
'TODO: take the length from the largest y 'TODO: take the length from the largest y

View File

@@ -10,8 +10,8 @@ Public Class ElementModel
MyBase.New(pState) MyBase.New(pState)
End Sub End Sub
Private Function ToElement(pRow As DataRow) As Signature Private Function ToElement(pRow As DataRow) As DocReceiverElement
Return New Signature() With { Return New DocReceiverElement() With {
.Id = pRow.ItemEx("GUID", 0), .Id = pRow.ItemEx("GUID", 0),
.DocumentId = pRow.ItemEx("DOCUMENT_ID", 0), .DocumentId = pRow.ItemEx("DOCUMENT_ID", 0),
.ReceiverId = pRow.ItemEx("RECEIVER_ID", 0), .ReceiverId = pRow.ItemEx("RECEIVER_ID", 0),
@@ -24,7 +24,7 @@ Public Class ElementModel
} }
End Function End Function
Private Function ToElements(pTable As DataTable) As List(Of Signature) Private Function ToElements(pTable As DataTable) As List(Of DocReceiverElement)
Return pTable?.Rows.Cast(Of DataRow). Return pTable?.Rows.Cast(Of DataRow).
Select(AddressOf ToElement). Select(AddressOf ToElement).
ToList() ToList()
@@ -80,7 +80,7 @@ Public Class ElementModel
End Try End Try
End Function End Function
Public Function List(pDocumentId As Integer) As List(Of Signature) Public Function List(pDocumentId As Integer) As List(Of DocReceiverElement)
Try Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] WHERE DOCUMENT_ID = {pDocumentId} ORDER BY PAGE ASC" Dim oSql = $"SELECT * FROM [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] WHERE DOCUMENT_ID = {pDocumentId} ORDER BY PAGE ASC"
Dim oTable = Database.GetDatatable(oSql) Dim oTable = Database.GetDatatable(oSql)
@@ -93,7 +93,7 @@ Public Class ElementModel
End Try End Try
End Function End Function
Public Function List(pDocumentId As Integer, pReceiverId As Integer) As List(Of Signature) Public Function List(pDocumentId As Integer, pReceiverId As Integer) As List(Of DocReceiverElement)
Try Try
Dim oReceiverConstraint = "" Dim oReceiverConstraint = ""
If pReceiverId > 0 Then If pReceiverId > 0 Then
@@ -111,7 +111,7 @@ Public Class ElementModel
End Try End Try
End Function End Function
Public Function Insert(pElement As Signature) As Boolean Public Function Insert(pElement As DocReceiverElement) As Boolean
Try Try
Dim oSql = "INSERT INTO [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] Dim oSql = "INSERT INTO [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT]
([DOCUMENT_ID] ([DOCUMENT_ID]
@@ -161,7 +161,7 @@ Public Class ElementModel
End Try End Try
End Function End Function
Public Function Update(pElement As Signature) As Boolean Public Function Update(pElement As DocReceiverElement) As Boolean
Try Try
Dim oSql = "UPDATE [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] Dim oSql = "UPDATE [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT]
SET [POSITION_X] = @POSITION_X SET [POSITION_X] = @POSITION_X
@@ -185,7 +185,7 @@ Public Class ElementModel
End Try End Try
End Function End Function
Private Function GetElementId(pElement As Signature) As Integer Private Function GetElementId(pElement As DocReceiverElement) As Integer
Try Try
Return Database.GetScalarValue($"SELECT MAX(GUID) FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT Return Database.GetScalarValue($"SELECT MAX(GUID) FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT
WHERE DOCUMENT_ID = {pElement.DocumentId} AND RECEIVER_ID = {pElement.ReceiverId}") WHERE DOCUMENT_ID = {pElement.DocumentId} AND RECEIVER_ID = {pElement.ReceiverId}")
@@ -196,7 +196,7 @@ Public Class ElementModel
End Try End Try
End Function End Function
Public Function DeleteElement(pElement As Signature) As Boolean Public Function DeleteElement(pElement As DocReceiverElement) As Boolean
Try Try
Dim oSql = $"DELETE FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT WHERE GUID = {pElement.Id}" Dim oSql = $"DELETE FROM TBSIG_DOCUMENT_RECEIVER_ELEMENT WHERE GUID = {pElement.Id}"
Return Database.ExecuteNonQuery(oSql) Return Database.ExecuteNonQuery(oSql)

View File

@@ -11,9 +11,9 @@ using System.Collections.Generic;
namespace EnvelopeGenerator.Domain.Entities namespace EnvelopeGenerator.Domain.Entities
{ {
[Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")] [Table("TBSIG_DOCUMENT_RECEIVER_ELEMENT", Schema = "dbo")]
public class Signature : ISignature, IHasReceiver, IHasAddedWhen, IUpdateAuditable public class DocReceiverElement : ISignature, IHasReceiver, IHasAddedWhen, IUpdateAuditable
{ {
public Signature() public DocReceiverElement()
{ {
// TODO: * Check the Form App and remove the default value // TODO: * Check the Form App and remove the default value
#if NETFRAMEWORK #if NETFRAMEWORK

View File

@@ -18,7 +18,7 @@ namespace EnvelopeGenerator.Domain.Entities
public Document() public Document()
{ {
#if NETFRAMEWORK #if NETFRAMEWORK
Elements = Enumerable.Empty<Signature>().ToList(); Elements = Enumerable.Empty<DocReceiverElement>().ToList();
#endif #endif
} }
@@ -60,7 +60,7 @@ namespace EnvelopeGenerator.Domain.Entities
FileNameOriginal { get; set; } FileNameOriginal { get; set; }
#endregion #endregion
public virtual List<Signature> public virtual List<DocReceiverElement>
#if nullable #if nullable
? ?
#endif #endif

View File

@@ -76,7 +76,7 @@ namespace EnvelopeGenerator.Domain.Entities
ChangedWho { get; set; } ChangedWho { get; set; }
[ForeignKey("ElementId")] [ForeignKey("ElementId")]
public virtual Signature public virtual DocReceiverElement
#if nullable #if nullable
? ?
#endif #endif

View File

@@ -8,7 +8,7 @@ Public Class FieldEditorController
Inherits BaseController Inherits BaseController
Private ReadOnly Document As Document Private ReadOnly Document As Document
Public Property Elements As New List(Of Signature) Public Property Elements As New List(Of DocReceiverElement)
Public Class ElementInfo Public Class ElementInfo
Public ReceiverId As Integer Public ReceiverId As Integer
@@ -36,7 +36,7 @@ Public Class FieldEditorController
} }
End Function End Function
Private Function GetElementByPosition(pAnnotation As AnnotationStickyNote, pPage As Integer, pReceiverId As Integer) As Signature Private Function GetElementByPosition(pAnnotation As AnnotationStickyNote, pPage As Integer, pReceiverId As Integer) As DocReceiverElement
Dim oElement = Elements. Dim oElement = Elements.
Where(Function(e) Where(Function(e)
Return e.Left = CSng(Math.Round(pAnnotation.Left, 5)) And Return e.Left = CSng(Math.Round(pAnnotation.Left, 5)) And
@@ -47,12 +47,12 @@ Public Class FieldEditorController
Return oElement Return oElement
End Function End Function
Private Function GetElementByGuid(pGuid As Integer) As Signature Private Function GetElementByGuid(pGuid As Integer) As DocReceiverElement
Dim oElement = Elements.Where(Function(e) pGuid = e.Id).SingleOrDefault() Dim oElement = Elements.Where(Function(e) pGuid = e.Id).SingleOrDefault()
Return oElement Return oElement
End Function End Function
Public Function GetElement(pAnnotation As AnnotationStickyNote) As Signature Public Function GetElement(pAnnotation As AnnotationStickyNote) As DocReceiverElement
Dim oInfo = GetElementInfo(pAnnotation.Tag) Dim oInfo = GetElementInfo(pAnnotation.Tag)
If oInfo.Guid = -1 Then If oInfo.Guid = -1 Then
@@ -85,7 +85,7 @@ Public Class FieldEditorController
Else Else
Dim oInfo = GetElementInfo(pAnnotation.Tag) Dim oInfo = GetElementInfo(pAnnotation.Tag)
Elements.Add(New Signature() With { Elements.Add(New DocReceiverElement() With {
.ElementType = Constants.ElementType.Signature, .ElementType = Constants.ElementType.Signature,
.Height = oAnnotationHeight, .Height = oAnnotationHeight,
.Width = oAnnotationWidth, .Width = oAnnotationWidth,
@@ -98,7 +98,7 @@ Public Class FieldEditorController
End If End If
End Sub End Sub
Public Function ClearElements(pPage As Integer, pReceiverId As Integer) As IEnumerable(Of Signature) Public Function ClearElements(pPage As Integer, pReceiverId As Integer) As IEnumerable(Of DocReceiverElement)
Return Elements. Return Elements.
Where(Function(e) e.Page <> pPage And e.ReceiverId <> pReceiverId). Where(Function(e) e.Page <> pPage And e.ReceiverId <> pReceiverId).
ToList() ToList()
@@ -120,7 +120,7 @@ Public Class FieldEditorController
All(Function(pResult) pResult = True) All(Function(pResult) pResult = True)
End Function End Function
Public Function SaveElement(pElement As Signature) As Boolean Public Function SaveElement(pElement As DocReceiverElement) As Boolean
Try Try
If pElement.Id > 0 Then If pElement.Id > 0 Then
Return ElementModel.Update(pElement) Return ElementModel.Update(pElement)
@@ -134,11 +134,11 @@ Public Class FieldEditorController
End Try End Try
End Function End Function
Public Function DeleteElement(pElement As Signature) As Boolean Public Function DeleteElement(pElement As DocReceiverElement) As Boolean
Try Try
' Element aus Datenbank löschen ' Element aus Datenbank löschen
If ElementModel.DeleteElement(pElement) Then If ElementModel.DeleteElement(pElement) Then
Dim oElement = New List(Of Signature)() From {pElement} Dim oElement = New List(Of DocReceiverElement)() From {pElement}
Elements = Elements.Except(oElement).ToList() Elements = Elements.Except(oElement).ToList()
Return True Return True
Else Else

View File

@@ -280,7 +280,7 @@ Partial Public Class frmFieldEditor
End If End If
End Sub End Sub
Private Sub LoadAnnotation(pElement As Signature, pReceiverId As Integer) Private Sub LoadAnnotation(pElement As DocReceiverElement, pReceiverId As Integer)
Dim oAnnotation As AnnotationStickyNote = Manager.AddStickyNoteAnnot(0, 0, 0, 0, "SIGNATUR") Dim oAnnotation As AnnotationStickyNote = Manager.AddStickyNoteAnnot(0, 0, 0, 0, "SIGNATUR")
Dim oPage = pElement.Page Dim oPage = pElement.Page
Dim oReceiver = Receivers.Where(Function(r) r.Id = pReceiverId).Single() Dim oReceiver = Receivers.Where(Function(r) r.Id = pReceiverId).Single()

View File

@@ -74,14 +74,14 @@ namespace EnvelopeGenerator.Infrastructure
services.AddSQLExecutor<Envelope>(); services.AddSQLExecutor<Envelope>();
services.AddSQLExecutor<Receiver>(); services.AddSQLExecutor<Receiver>();
services.AddSQLExecutor<Document>(); services.AddSQLExecutor<Document>();
services.AddSQLExecutor<Signature>(); services.AddSQLExecutor<DocReceiverElement>();
services.AddSQLExecutor<DocumentStatus>(); services.AddSQLExecutor<DocumentStatus>();
SetDapperTypeMap<Envelope>(); SetDapperTypeMap<Envelope>();
SetDapperTypeMap<User>(); SetDapperTypeMap<User>();
SetDapperTypeMap<Receiver>(); SetDapperTypeMap<Receiver>();
SetDapperTypeMap<Document>(); SetDapperTypeMap<Document>();
SetDapperTypeMap<Signature>(); SetDapperTypeMap<DocReceiverElement>();
SetDapperTypeMap<DocumentStatus>(); SetDapperTypeMap<DocumentStatus>();
services.AddScoped<IEnvelopeExecutor, EnvelopeExecutor>(); services.AddScoped<IEnvelopeExecutor, EnvelopeExecutor>();

View File

@@ -45,7 +45,7 @@ public abstract class EGDbContextBase : DbContext
public DbSet<Envelope> Envelopes { get; set; } public DbSet<Envelope> Envelopes { get; set; }
public DbSet<Signature> DocumentReceiverElements { get; set; } public DbSet<DocReceiverElement> DocumentReceiverElements { get; set; }
public DbSet<ElementAnnotation> DocumentReceiverElementAnnotations { get; set; } public DbSet<ElementAnnotation> DocumentReceiverElementAnnotations { get; set; }
@@ -154,7 +154,7 @@ public abstract class EGDbContextBase : DbContext
#endregion EnvelopeDocument #endregion EnvelopeDocument
#region DocumentReceiverElement #region DocumentReceiverElement
modelBuilder.Entity<Signature>() modelBuilder.Entity<DocReceiverElement>()
.HasOne(dre => dre.Document) .HasOne(dre => dre.Document)
.WithMany(ed => ed.Elements) .WithMany(ed => ed.Elements)
.HasForeignKey(dre => dre.DocumentId); .HasForeignKey(dre => dre.DocumentId);
@@ -196,7 +196,7 @@ public abstract class EGDbContextBase : DbContext
#endregion DocumentStatus #endregion DocumentStatus
#region Annotation #region Annotation
modelBuilder.Entity<Signature>() modelBuilder.Entity<DocReceiverElement>()
.HasMany(signature => signature.Annotations) .HasMany(signature => signature.Annotations)
.WithOne(annot => annot.Element) .WithOne(annot => annot.Element)
.HasForeignKey(annot => annot.ElementId); .HasForeignKey(annot => annot.ElementId);
@@ -217,7 +217,7 @@ public abstract class EGDbContextBase : DbContext
// TODO: call add trigger methods with attributes and reflection // TODO: call add trigger methods with attributes and reflection
AddTrigger<Config>(); AddTrigger<Config>();
AddTrigger<Signature>(); AddTrigger<DocReceiverElement>();
AddTrigger<DocumentStatus>(); AddTrigger<DocumentStatus>();
AddTrigger<EmailTemplate>(); AddTrigger<EmailTemplate>();
AddTrigger<Envelope>(); AddTrigger<Envelope>();

View File

@@ -6,7 +6,7 @@ using EnvelopeGenerator.Application.Common.Interfaces.Repositories;
namespace EnvelopeGenerator.Infrastructure.Repositories; namespace EnvelopeGenerator.Infrastructure.Repositories;
[Obsolete("Use IRepository")] [Obsolete("Use IRepository")]
public class DocumentReceiverElementRepository : CRUDRepository<Signature, int, EGDbContext>, IDocumentReceiverElementRepository public class DocumentReceiverElementRepository : CRUDRepository<DocReceiverElement, int, EGDbContext>, IDocumentReceiverElementRepository
{ {
public DocumentReceiverElementRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentReceiverElements) public DocumentReceiverElementRepository(EGDbContext dbContext) : base(dbContext, dbContext.DocumentReceiverElements)
{ {

View File

@@ -5,7 +5,7 @@ using EnvelopeGenerator.Application.Common.Interfaces.Services;
namespace EnvelopeGenerator.Web.Controllers.Test; namespace EnvelopeGenerator.Web.Controllers.Test;
[Obsolete("Use MediatR")] [Obsolete("Use MediatR")]
public class TestDocumentReceiverElementController : TestControllerBase<IDocumentReceiverElementService, SignatureDto, Signature, int> public class TestDocumentReceiverElementController : TestControllerBase<IDocumentReceiverElementService, SignatureDto, DocReceiverElement, int>
{ {
public TestDocumentReceiverElementController(ILogger<TestDocumentReceiverElementController> logger, IDocumentReceiverElementService service) : base(logger, service) public TestDocumentReceiverElementController(ILogger<TestDocumentReceiverElementController> logger, IDocumentReceiverElementService service) : base(logger, service)
{ {