Compare commits
4 Commits
3658326547
...
cf543e7ee9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf543e7ee9 | ||
|
|
942421e051 | ||
|
|
914a3464d7 | ||
|
|
55e484308c |
@@ -146,7 +146,12 @@ Public Class MSSQLServer
|
||||
End Function
|
||||
|
||||
Public Function Get_ConnectionStringforID(pConnectionId As Integer) As String
|
||||
Dim oConnectionString As String = ""
|
||||
Dim oConnectionString As String = String.Empty
|
||||
|
||||
If pConnectionId = 0 Then
|
||||
_Logger.Warn("ConnectionId was 0. Falling back to default connection.")
|
||||
Return String.Empty
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oTable As DataTable = GetDatatable($"SELECT * FROM TBDD_CONNECTION WHERE GUID = {pConnectionId}")
|
||||
@@ -174,17 +179,17 @@ Public Class MSSQLServer
|
||||
End If
|
||||
|
||||
Case Else
|
||||
_Logger.Warn("Provider {0} nicht unterstützt!", oProvider)
|
||||
_Logger.Warn("Provider [{0}] not supported!", oProvider)
|
||||
|
||||
End Select
|
||||
|
||||
Else
|
||||
_Logger.Info("No entry for Connection-ID: " & pConnectionId.ToString)
|
||||
_Logger.Warn("No entry for Connection-ID: [{0}] ", pConnectionId.ToString)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
_Logger.Info("Error in bei Get_ConnectionStringforID")
|
||||
_Logger.Warn("Error in Get_ConnectionStringforID")
|
||||
End Try
|
||||
|
||||
Return DecryptConnectionString(oConnectionString)
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Database")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: AssemblyTrademark("2.2.7.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.2.6.0")>
|
||||
<Assembly: AssemblyFileVersion("2.2.6.0")>
|
||||
<Assembly: AssemblyVersion("2.2.7.0")>
|
||||
<Assembly: AssemblyFileVersion("2.2.7.0")>
|
||||
|
||||
@@ -345,7 +345,11 @@ Public Class DatabaseWithFallback
|
||||
|
||||
Case Else
|
||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
||||
Return _DatabaseECM.GetDatatableWithConnection(pSQLCommand, oConnectionString)
|
||||
If oConnectionString = String.Empty Then
|
||||
Return _DatabaseECM.GetDatatable(pSQLCommand)
|
||||
Else
|
||||
Return _DatabaseECM.GetDatatableWithConnection(pSQLCommand, oConnectionString)
|
||||
End If
|
||||
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
@@ -401,8 +405,11 @@ Public Class DatabaseWithFallback
|
||||
|
||||
Case Else
|
||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
||||
Return _DatabaseECM.GetScalarValueWithConnection(pSQLCommand, oConnectionString)
|
||||
|
||||
If oConnectionString = String.Empty Then
|
||||
Return _DatabaseECM.GetScalarValue(pSQLCommand)
|
||||
Else
|
||||
Return _DatabaseECM.GetScalarValueWithConnection(pSQLCommand, oConnectionString)
|
||||
End If
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
@@ -456,7 +463,11 @@ Public Class DatabaseWithFallback
|
||||
|
||||
Case Else
|
||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
||||
Return _DatabaseECM.ExecuteNonQueryWithConnection(pSQLCommand, oConnectionString)
|
||||
If oConnectionString = String.Empty Then
|
||||
Return _DatabaseECM.ExecuteNonQuery(pSQLCommand)
|
||||
Else
|
||||
Return _DatabaseECM.ExecuteNonQueryWithConnection(pSQLCommand, oConnectionString)
|
||||
End If
|
||||
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("EDMIAPI")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2022")>
|
||||
<Assembly: AssemblyTrademark("1.5.3.0")>
|
||||
<Assembly: AssemblyTrademark("1.5.4.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.5.3.0")>
|
||||
<Assembly: AssemblyFileVersion("1.5.3.0")>
|
||||
<Assembly: AssemblyVersion("1.5.4.0")>
|
||||
<Assembly: AssemblyFileVersion("1.5.4.0")>
|
||||
|
||||
@@ -29,6 +29,10 @@
|
||||
''' there's no size limit.
|
||||
''' </summary>
|
||||
Public Property MaxAttachmentSizeInMegaBytes As Integer = -1
|
||||
|
||||
|
||||
Public Property RejectionTransferTimeUnit As String = "HOUR"
|
||||
Public Property RejectionTransferTimeValue As Integer = 12
|
||||
End Class
|
||||
|
||||
Public Class FirebirdConfig
|
||||
|
||||
@@ -142,12 +142,12 @@ Public Class ThreadRunner
|
||||
|
||||
Private Sub MaybeUpdateRejected()
|
||||
Try
|
||||
Dim oTimeUnit = "HOUR"
|
||||
Dim oTimeValue = 12
|
||||
Dim oTimeUnit = _config.Config.Custom.RejectionTransferTimeUnit
|
||||
Dim oTimeValue = _config.Config.Custom.RejectionTransferTimeValue
|
||||
|
||||
Dim oDifference As TimeSpan = Now - RejectedLastRun
|
||||
If oDifference.TotalMinutes < RejectedMaxDifferenceInMinutes Then
|
||||
_logger.Info("Updating rejected files: Waiting for next run.")
|
||||
_logger.Debug("Updating rejected files: Waiting for next run.")
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -156,20 +156,27 @@ Public Class ThreadRunner
|
||||
Dim oSQL = $"
|
||||
SELECT [EMAIL_MSGID]
|
||||
FROM TBEMLP_HISTORY
|
||||
WHERE (STATUS = 'REJECTED' OR CUST_REJECTED = 1)
|
||||
WHERE (STATUS = 'REJECTED' OR CUST_REJECTED = 1) AND FB_UPDATED = 0
|
||||
AND DATEDIFF({oTimeUnit}, CHANGED_WHEN, GETDATE()) <= {oTimeValue}
|
||||
ORDER BY GUID DESC"
|
||||
Dim oDT As DataTable = _mssql.GetDatatable(oSQL)
|
||||
If Not IsNothing(oDT) Then
|
||||
For Each oROW As DataRow In oDT.Rows
|
||||
Dim oTable As DataTable = _mssql.GetDatatable(oSQL)
|
||||
If Not IsNothing(oTable) Then
|
||||
For Each oROW As DataRow In oTable.Rows
|
||||
Dim oUpdate = $"UPDATE TBEDM_ZUGFERD_HISTORY_IN SET REJECTED = True WHERE MESSAGE_ID = '{oROW.Item(0)}' and REJECTED = false"
|
||||
_firebird.ExecuteNonQuery(oUpdate)
|
||||
If _firebird.ExecuteNonQuery(oUpdate) = True Then
|
||||
Dim oUpdateSQL = $"
|
||||
UPDATE TBEMLP_HISTORY
|
||||
SET FB_UPDATED = 1
|
||||
WHERE [EMAIL_MSGID] = '{oROW.Item(0)}' AND FB_UPDATED = 0"
|
||||
|
||||
_mssql.ExecuteNonQuery(oUpdateSQL)
|
||||
End If
|
||||
Next
|
||||
|
||||
RejectedLastRun = Now
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Error while Updating REJECTED State: " & ex.Message)
|
||||
Finally
|
||||
RejectedLastRun = Now
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user