CommunicationService
This commit is contained in:
parent
f418074011
commit
974d55c03c
@ -24,11 +24,16 @@ Public Class MyComService
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
myLogger = MyLoConfig.GetLogger()
|
myLogger = MyLoConfig.GetLogger()
|
||||||
|
If My.Settings.FB_ConnString <> String.Empty Then
|
||||||
_firebird = New Firebird(MyLoConfig, My.Settings.FB_ConnString, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW)
|
_firebird = New Firebird(MyLoConfig, My.Settings.FB_ConnString, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW)
|
||||||
|
End If
|
||||||
_Email = New Email(MyLoConfig)
|
_Email = New Email(MyLoConfig)
|
||||||
_EmailAlt = New clsEmail(MyLoConfig)
|
_EmailAlt = New clsEmail(MyLoConfig)
|
||||||
|
If My.Settings.SQLSERVER_CS <> String.Empty Then
|
||||||
_MSSQL = New MSSQLServer(MyLoConfig, My.Settings.SQLSERVER_CS)
|
_MSSQL = New MSSQLServer(MyLoConfig, My.Settings.SQLSERVER_CS)
|
||||||
If _firebird._DBInitialized = True Then
|
End If
|
||||||
|
|
||||||
|
If (_firebird._DBInitialized = True Or _MSSQL.DBInitialized = True) Then
|
||||||
MyComService.threadEmailQueue = New BackgroundWorker()
|
MyComService.threadEmailQueue = New BackgroundWorker()
|
||||||
MyComService.threadEmailQueue.WorkerReportsProgress = True
|
MyComService.threadEmailQueue.WorkerReportsProgress = True
|
||||||
MyComService.threadEmailQueue.WorkerSupportsCancellation = True
|
MyComService.threadEmailQueue.WorkerSupportsCancellation = True
|
||||||
@ -78,14 +83,22 @@ Public Class MyComService
|
|||||||
MyLoConfig.Debug = False
|
MyLoConfig.Debug = False
|
||||||
End If
|
End If
|
||||||
_Email = New Email(MyLoConfig)
|
_Email = New Email(MyLoConfig)
|
||||||
|
If My.Settings.FB_ConnString <> String.Empty Then
|
||||||
_firebird = New Firebird(MyLoConfig, My.Settings.FB_ConnString, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW)
|
_firebird = New Firebird(MyLoConfig, My.Settings.FB_ConnString, My.Settings.FB_DATABASE, My.Settings.FB_USER, My.Settings.FB_PW)
|
||||||
If _firebird._DBInitialized = False Then
|
If _firebird._DBInitialized = False Then
|
||||||
myLogger.Warn("Firebird-DB could not be intitialized!")
|
myLogger.Warn("Firebird-DB could not be intitialized!")
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
SEND_FROM_FBDB()
|
SEND_FROM_FBDB()
|
||||||
|
End If
|
||||||
|
If My.Settings.SQLSERVER_CS <> String.Empty Then
|
||||||
|
_MSSQL = New MSSQLServer(MyLoConfig, My.Settings.SQLSERVER_CS)
|
||||||
|
If _MSSQL.DBInitialized = False Then
|
||||||
|
myLogger.Warn("SQL-DB could not be intitialized!")
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
SEND_FROM_MSSQL()
|
SEND_FROM_MSSQL()
|
||||||
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
myLogger.Error(ex)
|
myLogger.Error(ex)
|
||||||
End Try
|
End Try
|
||||||
@ -269,9 +282,6 @@ Public Class MyComService
|
|||||||
myLogger.Debug($"oJOB_ID: {oJOB_ID}")
|
myLogger.Debug($"oJOB_ID: {oJOB_ID}")
|
||||||
oAttachment = oEmail_Row.Item("EMAIL_ATTMT1")
|
oAttachment = oEmail_Row.Item("EMAIL_ATTMT1")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Try
|
Try
|
||||||
myLogger.Debug($"Now checking the attachment")
|
myLogger.Debug($"Now checking the attachment")
|
||||||
If IsDBNull(oAttachment) Then
|
If IsDBNull(oAttachment) Then
|
||||||
@ -296,7 +306,6 @@ Public Class MyComService
|
|||||||
oSendResult = _EmailAlt.Email_Send_Independentsoft(oSubject, oBody, oEmailTo, oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType, oAttachment)
|
oSendResult = _EmailAlt.Email_Send_Independentsoft(oSubject, oBody, oEmailTo, oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType, oAttachment)
|
||||||
If oSendResult = False Then
|
If oSendResult = False Then
|
||||||
oSendResult = _Email.NewEmail(oEmailTo, oSubject, oBody, oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType, "DDEDMI_ComService", oAttachment.ToString)
|
oSendResult = _Email.NewEmail(oEmailTo, oSubject, oBody, oMailFrom, oMailSMTP, oMailport, oMailUser, oMailPW, oAuthType, "DDEDMI_ComService", oAttachment.ToString)
|
||||||
|
|
||||||
End If
|
End If
|
||||||
If oSendResult = True Then
|
If oSendResult = True Then
|
||||||
Dim oUpdCommand = "UPDATE TBEMLP_EMAIL_OUT SET EMAIL_SENT = GETDATE() WHERE GUID = " & oGUID
|
Dim oUpdCommand = "UPDATE TBEMLP_EMAIL_OUT SET EMAIL_SENT = GETDATE() WHERE GUID = " & oGUID
|
||||||
@ -309,7 +318,6 @@ Public Class MyComService
|
|||||||
ElseIf IsNothing(oDT_EMAIL_QUEUE) Then
|
ElseIf IsNothing(oDT_EMAIL_QUEUE) Then
|
||||||
myLogger.Warn($"DT_EMAIL_QUEUE is nothing: {oSQL}")
|
myLogger.Warn($"DT_EMAIL_QUEUE is nothing: {oSQL}")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
myLogger.Error(ex)
|
myLogger.Error(ex)
|
||||||
|
|||||||
@ -67,7 +67,7 @@ Public Class MSSQLServer
|
|||||||
End Using
|
End Using
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
_Logger.Debug("sqlcommand: " & sqlcommand)
|
_Logger.Warn("sqlcommand: " & sqlcommand)
|
||||||
Return Nothing
|
Return Nothing
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -99,7 +99,7 @@ Public Class MSSQLServer
|
|||||||
End Using
|
End Using
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
_Logger.Debug("executeStatement: " & SQLCommand)
|
_Logger.Warn("executeStatement: " & SQLCommand)
|
||||||
Return False
|
Return False
|
||||||
End Try
|
End Try
|
||||||
End Function
|
End Function
|
||||||
@ -159,7 +159,7 @@ Public Class MSSQLServer
|
|||||||
End Using
|
End Using
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
_Logger.Error(ex)
|
_Logger.Error(ex)
|
||||||
_Logger.Debug("executeStatement: " & executeStatement)
|
_Logger.Warn("executeStatement: " & executeStatement)
|
||||||
End Try
|
End Try
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user