Zooflow: Onboarding, check for ECM and IDB Database connections, Service Connection

This commit is contained in:
Jonathan Jenne
2021-11-03 11:59:29 +01:00
parent 7064978ecb
commit 85ddf68794
9 changed files with 555 additions and 63 deletions

View File

@@ -11,6 +11,21 @@ Public Class DatabaseWithFallback
Private ReadOnly _DatabaseEDM As MSSQLServer
Private ReadOnly _DatabaseIDB As MSSQLServer
Public Enum TableType
TBIDB_ATTRIBUTE
End Enum
Public Class Table
Public TableName As String
Public SQLCommand As String
Public DatabaseType As Constants.DatabaseType
End Class
Public Property Tables As New List(Of Table) From {
New Table With {.DatabaseType = DatabaseType.IDB, .TableName = "TBIDB_ATTRIBUTE", .SQLCommand = "SELECT * FROM TBIDB_ATTRIBUTE"}
}
Public Sub New(LogConfig As LogConfig, Client As Client, DatabaseECM As MSSQLServer, DatabaseIDB As MSSQLServer)
_Logger = LogConfig.GetLogger()
_Client = Client
@@ -18,6 +33,20 @@ Public Class DatabaseWithFallback
_DatabaseIDB = DatabaseIDB
End Sub
''' <summary>
''' Attempt at making loading big tables less annoying
''' </summary>
''' <returns></returns>
Public Function GetDatatable(pTable As TableType, Optional FilterExpression As String = "", Optional SortByColumn As String = "", Optional ForceFallback As Boolean = False)
Dim oTable = Tables.Where(Function(t) t.DatabaseType = pTable).SingleOrDefault()
If oTable Is Nothing Then
Return Nothing
Else
Return GetDatatable(oTable.TableName, oTable.SQLCommand, oTable.DatabaseType, FilterExpression, SortByColumn, ForceFallback)
End If
End Function
Public Function GetDatatable(DataTable As String, FallbackSQL As String, FallbackType As Constants.DatabaseType, Optional FilterExpression As String = "", Optional SortByColumn As String = "", Optional ForceFallback As Boolean = False) As DataTable
Try
Dim oResult As DataTable = Nothing