45 lines
1.8 KiB
VB.net
45 lines
1.8 KiB
VB.net
Imports DigitalData.Modules.Logging
|
|
Imports DigitalData.Modules.Database
|
|
Imports DigitalData.Modules.Config
|
|
Imports DigitalData.Modules.Base
|
|
Imports EnvelopeGenerator.Common
|
|
|
|
Public Class frmReportViewer
|
|
Private LogConfig As LogConfig
|
|
Private Logger As Logger
|
|
Private ConfigManager As ConfigManager(Of Config)
|
|
Private Database As MSSQLServer
|
|
|
|
Private Async Sub frmReportViewer_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
LogConfig = New LogConfig(LogConfig.PathType.CustomPath, Application.StartupPath, CompanyName:="Digital Data", ProductName:="EnvelopeGenerator")
|
|
Logger = LogConfig.GetLogger()
|
|
ConfigManager = New ConfigManager(Of Config)(LogConfig, "C:\Users\JenneJ\AppData\Roaming\Digital Data\Envelope Generator\1.0.0.0")
|
|
|
|
Database = New MSSQLServer(LogConfig, MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString))
|
|
|
|
Dim oTable As DataTable = Database.GetDatatable("SELECT * FROM VWSIG_ENVELOPE_REPORT")
|
|
Dim oItems = GetReportSource(oTable)
|
|
|
|
Dim oBuffer = Await ReportCreator.CreateReport(oItems)
|
|
|
|
Using oStream As New IO.MemoryStream(oBuffer)
|
|
PdfViewer1.LoadDocument(oStream)
|
|
End Using
|
|
End Sub
|
|
|
|
Private Function GetReportSource(pDataTable As DataTable) As List(Of ReportItem)
|
|
Return pDataTable.Rows.
|
|
Cast(Of DataRow).
|
|
Select(AddressOf ToReportItem).
|
|
OrderByDescending(Function(r) r.ItemDate).
|
|
ToList()
|
|
End Function
|
|
|
|
Private Function ToReportItem(pRow As DataRow) As ReportItem
|
|
Return New ReportItem() With {
|
|
.ItemDate = pRow.ItemEx(Of Date)("POS_WHEN", Nothing),
|
|
.ItemStatus = pRow.ItemEx("POS_STATUS", 0),
|
|
.ItemUserReference = pRow.ItemEx("POS_WHO", "")
|
|
}
|
|
End Function
|
|
End Class |