jj appserv

This commit is contained in:
Jonathan Jenne
2020-12-08 14:40:43 +01:00
parent cafa8cdbf3
commit 4c9abf3b1f
10 changed files with 209 additions and 49 deletions

View File

@@ -1,6 +1,7 @@
Imports DigitalData.Modules.Database
Imports DigitalData.Modules.Logging
Imports DigitalData.Modules.Filesystem
Imports DigitalData.Modules.language
Imports DigitalData.Modules
Imports System.IO
Imports System.ServiceModel
@@ -66,20 +67,41 @@ Public Class EDMIService
#End Region
#Region "Database"
Public Function ReturnDatatableFromCache(Name As String) As TableResult Implements IEDMIService.ReturnDatatableFromCache
Public Function ReturnDatatableFromCache(Name As String, FilterExpression As String, SortByColumn As String) As TableResult Implements IEDMIService.ReturnDatatableFromCache
Try
Dim oSql = ""
_logger.Info($"ReturnDatatableFromCache, SQL: {oSql}")
_logger.Info($"ReturnDatatableFromCache, Datatable: {Name}")
Dim oDataset As DataSet = Scheduler.DataSet
Dim oDataTable As DataTable = Nothing
_logger.Debug("DataSet contains [{0}] datatables", oDataset.Tables.Count)
If oDataset.Tables.Contains(Name) Then
oDataTable = oDataset.Tables.Item(Name)
oDataTable = oDataset.Tables.Item(Name).Copy()
' Apply filter and sorting to data
Dim oFilterExpression As String = Utils.NotNull(FilterExpression, String.Empty)
Dim oSortByColumn As String = Utils.NotNull(SortByColumn, String.Empty)
Dim oFilteredTable = oDataTable.
Select(oFilterExpression, oSortByColumn).
CopyToDataTable()
_logger.Debug("Datatable Stats for [{0}]:", Name)
_logger.Debug("Unfiltered: [{0}] rows", oDataTable.Rows.Count)
_logger.Debug("Filtered: [{0}] rows", oFilteredTable.Rows.Count)
Return New TableResult(oFilteredTable)
Else
Throw New ApplicationException($"DataTable {Name} does not exist")
End If
Return New TableResult(oDataTable)
'If oDataset.Tables.Contains(Name) Then
' oDataTable = oDataset.Tables.Item(Name).Clone()
' Return New TableResult(oDataTable)
'Else
' Throw New ApplicationException($"DataTable {Name} does not exist")
'End If
Catch ex As Exception
_logger.Error(ex)
Return New TableResult(ex.Message)