Add MSSQL Functions to ZUGFeRD Service

This commit is contained in:
Jonathan Jenne
2019-04-05 15:51:42 +02:00
parent caad7eda42
commit 720618f29b
10 changed files with 122 additions and 43 deletions

View File

@@ -7,6 +7,7 @@ Public Class ZUGFeRDService
Private _logConfig As LogConfig
Private _logger As Logger
Private _firebird As Firebird
Private _mssql As MSSQLServer = Nothing
Private _threadRunner As ThreadRunner
@@ -21,14 +22,22 @@ Public Class ZUGFeRDService
Dim oUser As String = My.Settings.DB_USER
Dim oPassword As String = My.Settings.DB_PASSWORD
Dim oJobInterval As Integer = My.Settings.JOB_INTERVAL
_logger.Debug("Datasource: {0}", oDataSource)
_logger.Debug("Database: {0}", oDatabase)
Dim oMSSQLConnectionString As String = My.Settings.MSSQL_CONNECTIONSTRING
Dim oMSSQLEnabled As Boolean = My.Settings.MSSQL_ENABLED
_firebird = New Firebird(_logConfig, oDataSource, oDatabase, oUser, oPassword)
If oMSSQLEnabled = True Then
_mssql = New MSSQLServer(_logConfig, oMSSQLConnectionString)
If _mssql.DBInitialized = False Then
_logger.Warn("MSSQL Connection could not be initialized. Disabling MSSQL.")
_mssql = Nothing
End If
End If
Try
_threadRunner = New ThreadRunner(_logConfig, _firebird)
_threadRunner = New ThreadRunner(_logConfig, _firebird, _mssql)
_threadRunner.Start(oJobInterval)
Catch ex As Exception
_logger.Error(ex)