Imports System.Data Imports DigitalData.Modules.Base Public Class DocumentModel Inherits BaseModel Public Sub New(pState As State) MyBase.New(pState) End Sub Private Function ToDocument(pRow As DataRow) As EnvelopeDocument Return New EnvelopeDocument() With { .Id = pRow.ItemEx("GUID", 0), .EnvelopeId = pRow.ItemEx("ENVELOPE_ID", 0), .FileInfo = New IO.FileInfo(pRow.ItemEx("FILEPATH", "")), .IsTempFile = False } 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}" Dim oTable = Database.GetDatatable(oSql) Return oTable?.Rows.Cast(Of DataRow). Select(AddressOf ToDocument). ToList() Catch ex As Exception Logger.Error(ex) Return Nothing End Try End Function End Class