Jonathan Jenne 13cf091d8e 31.07.2023
2023-07-31 11:51:33 +02:00

40 lines
1.3 KiB
VB.net

Imports DigitalData.Modules.Base
Public Class ElementModel
Inherits BaseModel
Public Sub New(pState As State)
MyBase.New(pState)
End Sub
Private Function ToElement(pRow As DataRow) As EnvelopeDocumentElement
Return New EnvelopeDocumentElement() With {
.Id = pRow.ItemEx("GUID", 0),
.DocumentId = pRow.ItemEx("DOCUMENT_ID", 0),
.ReceiverId = pRow.ItemEx("RECEIVER_ID", 0),
.ElementType = [Enum].Parse(GetType(Constants.ElementType), pRow.ItemEx("ELEMENT_TYPE", Constants.ElementType.Signature.ToString)),
.X = pRow.ItemEx("POSITION_X", 0.0),
.Y = pRow.ItemEx("POSITION_Y", 0.0),
.Width = pRow.ItemEx("WIDTH", 0.0),
.Height = pRow.ItemEx("HEIGHT", 0.0),
.Page = pRow.ItemEx("PAGE", 0)
}
End Function
Public Function List(pDocumentId As Integer) As List(Of EnvelopeDocumentElement)
Try
Dim oSql = $"SELECT * FROM [dbo].[TBSIG_DOCUMENT_RECEIVER_ELEMENT] WHERE DOCUMENT_ID = {pDocumentId}"
Dim oTable = Database.GetDatatable(oSql)
Return oTable?.Rows.Cast(Of DataRow).
Select(AddressOf ToElement).
ToList()
Catch ex As Exception
Logger.Error(ex)
Return Nothing
End Try
End Function
End Class