refactor(EnvelopeDocument): Aktualisiert zur Aufnahme von Common.Entities.EnvelopeDocument

This commit is contained in:
Developer 02 2025-05-26 09:31:38 +02:00
parent 8e4266fcf6
commit dd6bc55fd6
11 changed files with 33 additions and 32 deletions

View File

@ -2,7 +2,7 @@
using DigitalData.Core.DTO;
using EnvelopeGenerator.Application.DTOs;
using EnvelopeGenerator.Domain.Entities;
using static EnvelopeGenerator.Common.Constants;
using static EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Application.Contracts.Services;

View File

@ -1,20 +0,0 @@
Imports System.Drawing
Imports System.IO
Public Class EnvelopeDocument
Public Property Id As Integer
Public Property FileNameOriginal As String
Public Property IsTempFile As Boolean = True
Public Property EnvelopeId As Integer = 0
Public Property Elements As New List(Of EnvelopeDocumentElement)
Public Property Filename As String
Public Property Filepath As String
Public Property ByteData As Byte()
End Class

View File

@ -280,7 +280,6 @@
<Compile Include="Jobs\APIBackendJobs\APIEnvelopeJob.vb" />
<Compile Include="Jobs\FinalizeDocument\PDFBurnerParams.vb" />
<Compile Include="Services\TemplateService.vb" />
<Compile Include="Entities\EnvelopeDocument.vb" />
<Compile Include="Entities\EnvelopeDocumentElement.vb" />
<Compile Include="Entities\EnvelopeHistoryEntry.vb" />
<Compile Include="Entities\EnvelopeReceiver.vb" />

View File

@ -140,7 +140,7 @@ namespace EnvelopeGenerator.Domain.Entities
public IEnumerable<EnvelopeHistory> History { get; set; } = new List<EnvelopeHistory>();
// TODO: * Check the Form App and remove the default value
public IEnumerable<Receiver> Receivers { get; set; } = new List<Receiver>();
public ICollection<Receiver> Receivers { get; set; } = new List<Receiver>();
/// <summary>
/// Validates whether the receiver and document data are complete.

View File

@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Drawing;
#if NETFRAMEWORK
using System;
using System.Collections.Generic;
@ -27,7 +28,7 @@ namespace EnvelopeGenerator.Domain.Entities
public byte[] ByteData { get; set; }
// TODO: * Check the Form App and remove the default value
public IEnumerable<DocumentReceiverElement> Elements { get; set; } = new List<DocumentReceiverElement>();
public List<DocumentReceiverElement> Elements { get; set; } = new List<DocumentReceiverElement>();
[NotMapped]
public string FileNameOriginal { get; set; }
@ -38,6 +39,13 @@ namespace EnvelopeGenerator.Domain.Entities
[NotMapped]
public string Filename { get; set; }
[NotMapped]
public string Filepath { get; set; }
[NotMapped]
public Bitmap Thumbnail { get; set; }
[NotMapped]
public int PageCount { get; set; }
}
}

View File

@ -16,6 +16,19 @@
<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
<PackageReference Include="System.Drawing.Common" Version="4.7.3" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="System.Drawing.Common" Version="8.0.16" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
<PackageReference Include="System.Drawing.Common" Version="9.0.5" />
</ItemGroup>
<ItemGroup>

View File

@ -1,5 +1,5 @@
using System.Text;
using static EnvelopeGenerator.Common.Constants;
using static EnvelopeGenerator.Domain.Constants;
namespace EnvelopeGenerator.Extensions
{

View File

@ -183,7 +183,7 @@ Public Class EnvelopeEditorController
.FileNameOriginal = oFileInfo.Name,
.Thumbnail = Thumbnail.GetThumbnailFromPDFFile(oTempFilePath),
.PageCount = Thumbnail.GetPageCount(oTempFilePath),
.Byte_Data = ReadFile(oFixedPath)
.ByteData = ReadFile(oFixedPath)
}
Return oDocument

View File

@ -2,6 +2,7 @@
Imports EnvelopeGenerator.Common
Imports GdPicture14.Annotations
Imports EnvelopeGenerator.Domain
Imports EnvelopeGenerator.Domain.Entities
Public Class FieldEditorController
Inherits BaseController

View File

@ -123,7 +123,7 @@ Partial Public Class frmEnvelopeEditor
File.Delete(oTempFilename)
End If
WriteBytetoPath(oTempFilename, docItem.Byte_Data)
WriteBytetoPath(oTempFilename, docItem.ByteData)
docItem.Filepath = oTempFilename
GridDocuments.Tag = docItem.Filepath
End If
@ -215,11 +215,11 @@ Partial Public Class frmEnvelopeEditor
If ViewDocuments.GetSelectedRows().Count > 0 Then
Dim oDocument As EnvelopeDocument = DirectCast(ViewDocuments.GetFocusedRow(), EnvelopeDocument)
Dim oEnvelope = Controller.Envelope
If Not IsNothing(oDocument.Byte_Data) Then
If Not IsNothing(oDocument.ByteData) Then
Dim oTempFolder = TempFiles._TempPath
Dim oTempFilename = String.Concat(oTempFolder, "\", $"ViewEnvDoc_{oEnvelope.Id}.pdf")
If Not File.Exists(oTempFilename) Then
WriteBytetoPath(oTempFilename, oDocument.Byte_Data)
WriteBytetoPath(oTempFilename, oDocument.ByteData)
oDocument.Filepath = oTempFilename
End If

View File

@ -12,7 +12,7 @@ Imports EnvelopeGenerator.Common
Imports EnvelopeGenerator.Common.My
Imports System.ComponentModel
Imports DevExpress.XtraPrinting
Imports DigitalData.Domain
Imports EnvelopeGenerator.Domain.Entities
Public Class frmMain
Private ReadOnly LogConfig As LogConfig
@ -405,7 +405,7 @@ Public Class frmMain
Me.Cursor = Cursors.Default
Exit Sub
Else
If Not IsNothing(oDocument.Byte_Data) Then
If Not IsNothing(oDocument.ByteData) Then
Dim oTempFolder = TempFiles._TempPath
Dim oTempFilename = String.Concat(oTempFolder, "\", $"ViewEnvDoc_{oEnvelope.Id}.pdf")
If File.Exists(oTempFilename) Then
@ -420,7 +420,7 @@ Public Class frmMain
File.Delete(oTempFilename)
End If
downloadFile(oTempFilename, oDocument.Byte_Data)
downloadFile(oTempFilename, oDocument.ByteData)
End If
End If
Catch ex As Exception