25-08-2023

This commit is contained in:
Jonathan Jenne
2023-08-28 12:15:22 +02:00
parent 3ecd9ecb27
commit 48d44562f3
423 changed files with 10649 additions and 39 deletions

View File

@@ -7,19 +7,39 @@ Imports EnvelopeGenerator.Common.My.Resources
Public Class DocumentModel
Inherits BaseModel
Private ElementModel As ElementModel
Public Sub New(pState As State)
MyBase.New(pState)
ElementModel = New ElementModel(pState)
End Sub
Private Function ToDocument(pRow As DataRow) As EnvelopeDocument
Dim oDocumentId = pRow.ItemEx("GUID", 0)
Return New EnvelopeDocument() With {
.Id = pRow.ItemEx("GUID", 0),
.Id = oDocumentId,
.EnvelopeId = pRow.ItemEx("ENVELOPE_ID", 0),
.FileInfo = New IO.FileInfo(pRow.ItemEx("FILEPATH", "")),
.IsTempFile = False
.IsTempFile = False,
.Elements = ElementModel.List(oDocumentId)
}
End Function
Public Function GetById(pDocumentId As Integer) As EnvelopeDocument
Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE GUID = {pDocumentId}"
Dim oTable = Database.GetDatatable(oSql)
Return oTable?.Rows.Cast(Of DataRow).
Select(AddressOf ToDocument).
Single()
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
Public Function List(pEnvelopeId As Integer) As IEnumerable(Of EnvelopeDocument)
Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_ENVELOPE_DOCUMENT] WHERE ENVELOPE_ID = {pEnvelopeId}"