Compare commits
36 Commits
20097e2d24
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| a159516c6b | |||
| 462600d1b3 | |||
|
|
a6ae874873 | ||
|
|
24417da48c | ||
|
|
fb6d27e53b | ||
| 1806e3c696 | |||
| 9bd970c339 | |||
| 432689aa84 | |||
| a42dfd02bd | |||
|
|
3eb6314ba8 | ||
|
|
aad2f01490 | ||
|
|
de918b1e88 | ||
|
|
298a398067 | ||
|
|
6aebeaa446 | ||
|
|
ed655879f9 | ||
| e598b6faf5 | |||
| 1ad055d958 | |||
| 953cc10416 | |||
| 1615727352 | |||
|
|
857e1366fe | ||
|
|
d3ebc13eae | ||
| 18e8610edc | |||
| d98e903160 | |||
|
|
3c1b51f519 | ||
|
|
e56be8a6fe | ||
| 1871cca2a6 | |||
| 676b43bbe1 | |||
| 4dc454403b | |||
| 5b83e5d265 | |||
| 1e49d6d955 | |||
|
|
7650fb9455 | ||
|
|
0e13c67887 | ||
| c129b35862 | |||
| 5b0807d4b5 | |||
|
|
0e31f5c8e3 | ||
|
|
36c3a055e3 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -337,4 +337,5 @@ ASALocalRun/
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
healthchecksdb
|
||||
/EDMIAPI/ErrorLog.txt
|
||||
|
||||
@@ -235,13 +235,11 @@ Public Class ConfigManager(Of T)
|
||||
Try
|
||||
Dim oAppConfig = ReadFromFile(_AppConfigPath)
|
||||
CopyValues(oAppConfig, Config)
|
||||
|
||||
_Logger.Info("AppConfig exists and will be used. [{0}]", _AppConfigPath)
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
_Logger.Warn("ApplicationConfig could not be loaded!")
|
||||
_Logger.Warn("ApplicationConfig could not be loaded! Path: [{0}] Reason: {1}", _AppConfigPath, ex.Message)
|
||||
End Try
|
||||
|
||||
_WriteAllValuesToUserConfig = False
|
||||
Else
|
||||
_Logger.Debug("ApplicationConfig does not exist.")
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data GmbH, Heuchelheim")>
|
||||
<Assembly: AssemblyProduct("Modules.Config")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2026")>
|
||||
<Assembly: AssemblyTrademark("1.4.0.0")>
|
||||
<Assembly: AssemblyTrademark("1.5.0.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.4.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.4.0.0")>
|
||||
<Assembly: AssemblyVersion("1.5.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.5.0.0")>
|
||||
|
||||
@@ -178,7 +178,7 @@ Public Class MSSQLServer
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oTable As DataTable = GetDatatable($"SELECT * FROM TBDD_CONNECTION WHERE GUID = {pConnectionId}")
|
||||
Dim oTable As DataTable = GetDatatable($"SELECT * FROM TBDD_CONNECTION WITH (NOLOCK) WHERE GUID = {pConnectionId}")
|
||||
If oTable.Rows.Count = 1 Then
|
||||
Dim oRow As DataRow = oTable.Rows(0)
|
||||
Dim oProvider = oRow.Item("SQL_PROVIDER").ToString.ToUpper
|
||||
@@ -255,6 +255,7 @@ Public Class MSSQLServer
|
||||
|
||||
Return pConnection
|
||||
Catch ex As Exception
|
||||
|
||||
Logger.Error("Error while opening Connection!")
|
||||
Logger.Error(ex)
|
||||
|
||||
@@ -493,14 +494,30 @@ Public Class MSSQLServer
|
||||
pSqlCommandObject.Connection = pSqlConnection
|
||||
pSqlCommandObject.Transaction = oTransaction
|
||||
pSqlCommandObject.CommandTimeout = pTimeout
|
||||
|
||||
' Sicherstellen, dass Nothing-Werte als DBNull übergeben werden
|
||||
For Each oParam As SqlParameter In pSqlCommandObject.Parameters
|
||||
If oParam.Value Is Nothing Then
|
||||
Logger.Warn("ExecuteNonQueryWithConnectionObject: Parameter [{0}] was Nothing - converting to DBNull.Value", oParam.ParameterName)
|
||||
oParam.Value = DBNull.Value
|
||||
End If
|
||||
Next
|
||||
|
||||
pSqlCommandObject.ExecuteNonQuery()
|
||||
|
||||
Return True
|
||||
Catch ex As SqlException
|
||||
Logger.Warn("ExecuteNonQueryWithConnectionObject: SQL Error while executing command: [{0}]", pSqlCommandObject.CommandText)
|
||||
Logger.Warn("Parameters: [{0}]", GetParameterListAsString(pSqlCommandObject))
|
||||
For Each sqlError As SqlError In ex.Errors
|
||||
Logger.Error("SQL Error #{0} (Severity {1}, State {2}, Line {3}): {4}",
|
||||
sqlError.Number, sqlError.Class, sqlError.State, sqlError.LineNumber, sqlError.Message)
|
||||
Next
|
||||
Return False
|
||||
Catch ex As Exception
|
||||
Dim omsg = $"Unexpected Error in ExecuteNonQueryWithConnectionObject while executing command: [{pSqlCommandObject.CommandText}]"
|
||||
Logger.Warn(omsg)
|
||||
Logger.Warn("Unexpected Error in ExecuteNonQueryWithConnectionObject while executing command: [{0}]", pSqlCommandObject.CommandText)
|
||||
Logger.Warn("Parameters: [{0}]", GetParameterListAsString(pSqlCommandObject))
|
||||
Logger.Error(ex)
|
||||
|
||||
Return False
|
||||
Finally
|
||||
MaybeCommitTransaction(oTransaction, pTransactionMode)
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Database")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("2.3.7.0")>
|
||||
<Assembly: AssemblyTrademark("2.5.0.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.3.7.0")>
|
||||
<Assembly: AssemblyFileVersion("2.3.7.0")>
|
||||
<Assembly: AssemblyVersion("2.5.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.4.0.0")>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
||||
Imports System.ServiceModel
|
||||
Imports System.Threading
|
||||
Imports System.Xml
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
@@ -7,16 +8,35 @@ Imports DigitalData.Modules.Logging
|
||||
Public Class Channel
|
||||
Inherits BaseClass
|
||||
|
||||
Private Shared ReadOnly _FactoryLock As New Object()
|
||||
Private Shared _SharedFactory As ChannelFactory(Of IEDMIServiceChannel) = Nothing
|
||||
Private Shared _SharedFactoryEndpoint As String = String.Empty
|
||||
|
||||
Private ReadOnly ChannelFactory As ChannelFactory(Of IEDMIServiceChannel)
|
||||
|
||||
Public Event Reconnect As EventHandler
|
||||
|
||||
Private Shared _ActiveConnections As Integer = 0
|
||||
Public Shared ReadOnly Property ActiveConnections As Integer
|
||||
Get
|
||||
Return _ActiveConnections
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Public Shared Function GetBinding(Optional AuthenticationMode As TcpClientCredentialType = TcpClientCredentialType.Windows) As NetTcpBinding
|
||||
Dim oMaxConnections = Math.Max(500, Environment.ProcessorCount * 50)
|
||||
|
||||
Return New NetTcpBinding() With {
|
||||
.MaxReceivedMessageSize = Constants.ChannelSettings.MAX_RECEIVED_MESSAGE_SIZE,
|
||||
.MaxBufferSize = Constants.ChannelSettings.MAX_BUFFER_SIZE,
|
||||
.MaxBufferPoolSize = Constants.ChannelSettings.MAX_BUFFER_POOL_SIZE,
|
||||
.ListenBacklog = oMaxConnections,
|
||||
.MaxConnections = oMaxConnections,
|
||||
.TransferMode = TransferMode.Streamed,
|
||||
.SendTimeout = TimeSpan.FromSeconds(60),
|
||||
.ReceiveTimeout = TimeSpan.FromMinutes(10),
|
||||
.OpenTimeout = TimeSpan.FromSeconds(60),
|
||||
.CloseTimeout = TimeSpan.FromSeconds(30),
|
||||
.Security = New NetTcpSecurity() With {
|
||||
.Mode = SecurityMode.Transport,
|
||||
.Transport = New TcpTransportSecurity() With {
|
||||
@@ -32,33 +52,107 @@ Public Class Channel
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pServerAddress As ServerAddressStruct)
|
||||
MyBase.New(pLogConfig)
|
||||
ChannelFactory = GetChannelFactory(pServerAddress)
|
||||
ChannelFactory = GetOrCreateSharedFactory(pLogConfig, pServerAddress)
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Gibt eine gemeinsame ChannelFactory zurück.
|
||||
''' Ein Connection-Pool für alle Client-Instanzen desselben Endpoints.
|
||||
''' </summary>
|
||||
Private Shared Function GetOrCreateSharedFactory(pLogConfig As LogConfig, pServerAddress As ServerAddressStruct) As ChannelFactory(Of IEDMIServiceChannel)
|
||||
Dim oEndpoint = $"net.tcp://{pServerAddress.Host}:{pServerAddress.Port}/DigitalData/Services/Main"
|
||||
|
||||
' ← Volatile.Read: garantiert aktuellen Wert auch ohne Lock
|
||||
Dim oCurrentFactory = Volatile.Read(_SharedFactory)
|
||||
If oCurrentFactory IsNot Nothing AndAlso
|
||||
_SharedFactoryEndpoint = oEndpoint AndAlso
|
||||
(oCurrentFactory.State = CommunicationState.Opened OrElse
|
||||
oCurrentFactory.State = CommunicationState.Created) Then
|
||||
Return oCurrentFactory
|
||||
End If
|
||||
|
||||
SyncLock _FactoryLock
|
||||
' Double-check nach Lock
|
||||
If _SharedFactory IsNot Nothing AndAlso
|
||||
_SharedFactoryEndpoint = oEndpoint AndAlso
|
||||
(_SharedFactory.State = CommunicationState.Opened OrElse
|
||||
_SharedFactory.State = CommunicationState.Created) Then
|
||||
Return _SharedFactory
|
||||
End If
|
||||
|
||||
If _SharedFactory IsNot Nothing Then
|
||||
If _SharedFactory.State = CommunicationState.Faulted OrElse
|
||||
_SharedFactory.State = CommunicationState.Closing Then
|
||||
Try
|
||||
_SharedFactory.Abort()
|
||||
Catch
|
||||
End Try
|
||||
End If
|
||||
_SharedFactory = Nothing
|
||||
End If
|
||||
|
||||
Dim oLogger = pLogConfig.GetLogger()
|
||||
Dim oBinding = GetBinding()
|
||||
Dim oAddress = New EndpointAddress(oEndpoint)
|
||||
|
||||
oLogger.Debug("Creating shared ChannelFactory | Endpoint=[{0}] | MaxConnections=[{1}] | SendTimeout=[{2}] | OpenTimeout=[{3}]",
|
||||
oEndpoint, oBinding.MaxConnections, oBinding.SendTimeout, oBinding.OpenTimeout)
|
||||
|
||||
_SharedFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
|
||||
_SharedFactoryEndpoint = oEndpoint
|
||||
Return _SharedFactory
|
||||
End SyncLock
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Closes a channel gracefully, falls back to Abort on error
|
||||
''' </summary>
|
||||
Public Shared Sub CloseChannel(pChannel As IEDMIServiceChannel)
|
||||
If pChannel Is Nothing Then Return
|
||||
Try
|
||||
If pChannel.State = CommunicationState.Opened Then
|
||||
pChannel.Close()
|
||||
ElseIf pChannel.State = CommunicationState.Faulted OrElse
|
||||
pChannel.State = CommunicationState.Closing Then
|
||||
pChannel.Abort()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Try
|
||||
pChannel.Abort()
|
||||
Catch
|
||||
End Try
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Creates a channel and adds a Faulted-Handler
|
||||
''' </summary>
|
||||
''' <returns>A channel object</returns>
|
||||
Public Function GetChannel() As IEDMIServiceChannel
|
||||
Try
|
||||
Logger.Debug("Creating channel.")
|
||||
Logger.Debug("Creating channel from shared factory.")
|
||||
Dim oChannel = ChannelFactory.CreateChannel()
|
||||
|
||||
AddHandler oChannel.Faulted, Sub() RaiseEvent Reconnect(Me, Nothing)
|
||||
AddHandler oChannel.Opened, Sub()
|
||||
Dim oCount = Interlocked.Increment(_ActiveConnections)
|
||||
Logger.Debug("Channel opened. Active connections: [{0}]", oCount)
|
||||
End Sub
|
||||
|
||||
AddHandler oChannel.Closed, Sub()
|
||||
Dim oCount = Interlocked.Decrement(_ActiveConnections)
|
||||
Logger.Debug("Channel closed. Active connections: [{0}]", oCount)
|
||||
End Sub
|
||||
|
||||
AddHandler oChannel.Faulted, Sub()
|
||||
Dim oCount = Interlocked.Decrement(_ActiveConnections)
|
||||
Logger.Warn("⚠ Channel faulted. Active connections: [{0}]", oCount)
|
||||
RaiseEvent Reconnect(Me, Nothing)
|
||||
End Sub
|
||||
|
||||
Logger.Debug("Channel created. State=[{0}]", oChannel.State)
|
||||
Return oChannel
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
Throw
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetChannelFactory(pServerAddress As ServerAddressStruct) As ChannelFactory(Of IEDMIServiceChannel)
|
||||
Dim oBinding = GetBinding()
|
||||
Dim oAddress = New EndpointAddress($"net.tcp://{pServerAddress.Host}:{pServerAddress.Port}/DigitalData/Services/Main")
|
||||
Dim oFactory = New ChannelFactory(Of IEDMIServiceChannel)(oBinding, oAddress)
|
||||
Return oFactory
|
||||
End Function
|
||||
End Class
|
||||
|
||||
|
||||
End Class
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="1b516c6d-d2d0-4dfc-9557-3dd0593fa624" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
|
||||
<ReferenceGroup xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="1b516c6d-d2d0-4dfc-9557-3dd0593fa624" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
|
||||
<ClientOptions>
|
||||
<GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
|
||||
<GenerateTaskBasedAsynchronousMethod>true</GenerateTaskBasedAsynchronousMethod>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
|
||||
<configurationSnapshot xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
|
||||
<behaviors />
|
||||
<bindings>
|
||||
<binding digest="System.ServiceModel.Configuration.NetTcpBindingElement, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="NetTcpBinding_IEDMIService" transferMode="Streamed"><security><transport sslProtocols="None" /></security></Data>" bindingType="netTcpBinding" name="NetTcpBinding_IEDMIService" />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<SavedWcfConfigurationInformation xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="9.1" CheckSum="LUfq4Z7qL259JRuSf1xmDS/kLlBkZTtgk2vJyQH0Jvo=">
|
||||
<SavedWcfConfigurationInformation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="9.1" CheckSum="4uBt9Y5m0Ue4fIPG6eooT5TT5MJ97hiEcthL6+tUJHw=">
|
||||
<bindingConfigurations>
|
||||
<bindingConfiguration bindingType="netTcpBinding" name="NetTcpBinding_IEDMIService">
|
||||
<properties>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports System.Collections.Concurrent
|
||||
Imports System.Data.SqlClient
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
Imports DigitalData.Modules.EDMI.API.Constants
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
@@ -10,7 +12,70 @@ Public Class DatabaseWithFallback
|
||||
Private ReadOnly _ClientConfig As GlobalStateClientConfiguration
|
||||
Private ReadOnly _DatabaseECM As MSSQLServer
|
||||
Private _DatabaseIDB As MSSQLServer
|
||||
''' <summary>
|
||||
''' Lokaler Override-Cache für ExecuteAppServiceWrite-Änderungen.
|
||||
''' Schlüssel: "TABELLENNAME|FILTERAUSDRUCK" → geänderter DataTable-Snapshot.
|
||||
''' Wird beim nächsten Server-Refresh (Client.UpdateTimer) automatisch obsolet.
|
||||
''' </summary>
|
||||
Private ReadOnly _localOverrideCache As New ConcurrentDictionary(Of String, DataTable)()
|
||||
''' <summary>Erstellt den Cache-Key aus Tabellenname und Filter.</summary>
|
||||
Private Shared Function GetOverrideCacheKey(pTable As String, pFilter As String) As String
|
||||
Return $"{pTable.ToUpper}|{pFilter}"
|
||||
End Function
|
||||
|
||||
''' <summary>Leert den lokalen Override-Cache (z.B. nach manuellem Refresh).</summary>
|
||||
Public Sub InvalidateLocalOverrideCache()
|
||||
_localOverrideCache.Clear()
|
||||
_Logger.Debug("InvalidateLocalOverrideCache: Lokaler Override-Cache geleert.")
|
||||
End Sub
|
||||
|
||||
''' <summary>Leert den Override-Cache für eine bestimmte Tabelle.</summary>
|
||||
Public Sub InvalidateLocalOverrideCache(pTableName As String)
|
||||
Dim oKeysToRemove = _localOverrideCache.Keys.
|
||||
Where(Function(k) k.StartsWith(pTableName.ToUpper & "|")).ToList()
|
||||
For Each oKey In oKeysToRemove
|
||||
Dim oRemoved As DataTable = Nothing
|
||||
_localOverrideCache.TryRemove(oKey, oRemoved)
|
||||
Next
|
||||
_Logger.Debug("InvalidateLocalOverrideCache: Override-Cache für Tabelle [{0}] geleert.", pTableName)
|
||||
End Sub
|
||||
''' <summary>
|
||||
''' Thread-sicherer Cache für Connection Strings, indexiert nach Connection-ID.
|
||||
''' Verhindert wiederholte DB-Roundtrips für SELECT * FROM TBDD_CONNECTION.
|
||||
''' </summary>
|
||||
Private ReadOnly _connectionStringCache As New ConcurrentDictionary(Of Integer, String)
|
||||
|
||||
''' <summary>
|
||||
''' Liefert den Connection String für eine bekannte Connection-ID.
|
||||
''' Beim ersten Aufruf wird der Wert aus der DB geladen und gecacht.
|
||||
''' Hinweis: Bei parallelen Erstabrufen derselben ID kann die Factory mehrfach
|
||||
''' aufgerufen werden – da der Wert idempotent ist, ist dies funktional korrekt.
|
||||
''' </summary>
|
||||
Private Function GetCachedConnectionString(pConnectionId As Integer) As String
|
||||
Return _connectionStringCache.GetOrAdd(pConnectionId,
|
||||
Function(id)
|
||||
_Logger.Debug("GetCachedConnectionString: Cache miss für ConnectionId [{0}] - lade aus DB", id)
|
||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(id)
|
||||
_Logger.Debug("GetCachedConnectionString: ConnectionId [{0}] gecacht", id)
|
||||
Return oConnectionString
|
||||
End Function)
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Leert den Connection-String-Cache, z.B. nach Konfigurationsänderungen.
|
||||
''' </summary>
|
||||
Public Sub InvalidateConnectionCache()
|
||||
_connectionStringCache.Clear()
|
||||
_Logger.Debug("InvalidateConnectionCache: Connection-String-Cache geleert")
|
||||
End Sub
|
||||
''' <summary>
|
||||
''' Leert den Cache für eine bestimmte Connection-ID.
|
||||
''' </summary>
|
||||
Public Sub InvalidateConnectionCache(pConnectionId As Integer)
|
||||
Dim removed As String = Nothing
|
||||
If _connectionStringCache.TryRemove(pConnectionId, removed) Then
|
||||
_Logger.Debug("InvalidateConnectionCache: ConnectionId [{0}] aus Cache entfernt", pConnectionId)
|
||||
End If
|
||||
End Sub
|
||||
''' <summary>
|
||||
''' Options for GetDatatable
|
||||
''' </summary>
|
||||
@@ -34,7 +99,105 @@ Public Class DatabaseWithFallback
|
||||
''' Connection Id to use, references TBDD_CONNECTION
|
||||
''' </summary>
|
||||
Public Property ConnectionId As Integer = 0
|
||||
''' <summary>
|
||||
''' Erkennt URI-Cache-Syntax: "TABELLENNAME?FILTERAUSDRUCK"
|
||||
''' Beispiel: "TBDD_USER?USER_ID=4524"
|
||||
''' </summary>
|
||||
Public ReadOnly Property IsCacheQuery As Boolean
|
||||
Get
|
||||
If String.IsNullOrWhiteSpace(FallbackSQL) Then Return False
|
||||
Dim oTrimmed As String = FallbackSQL.TrimStart()
|
||||
' Nur wenn kein SQL-Schlüsselwort vorhanden → Cache-Routing-Syntax
|
||||
Return FallbackSQL.Contains("?") AndAlso
|
||||
Not oTrimmed.StartsWith("SELECT", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("INSERT", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("UPDATE", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("DELETE", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.Contains("DECLARE") AndAlso
|
||||
Not oTrimmed.StartsWith("EXEC", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("DECLARE", StringComparison.OrdinalIgnoreCase)
|
||||
End Get
|
||||
End Property
|
||||
Public ReadOnly Property IsCacheWriteQuery As Boolean
|
||||
Get
|
||||
If String.IsNullOrWhiteSpace(FallbackSQL) Then Return False
|
||||
Dim oTrimmed As String = FallbackSQL.TrimStart()
|
||||
Return FallbackSQL.Contains("?") AndAlso
|
||||
FallbackSQL.Contains("!") AndAlso
|
||||
Not oTrimmed.StartsWith("SELECT", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("INSERT", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("UPDATE", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("DELETE", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("EXEC", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("DECLARE", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("--", StringComparison.OrdinalIgnoreCase) AndAlso
|
||||
Not oTrimmed.StartsWith("/*", StringComparison.OrdinalIgnoreCase)
|
||||
End Get
|
||||
End Property
|
||||
''' <summary>"TBDD_USER?USER_ID=4524" → "TBDD_USER"</summary>
|
||||
Public ReadOnly Property CacheQueryTable As String
|
||||
Get
|
||||
If Not IsCacheQuery Then Return String.Empty
|
||||
Return FallbackSQL.Substring(0, FallbackSQL.IndexOf("?")).Trim()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>"TBDD_USER?USER_ID=4524" → "USER_ID=4524"</summary>
|
||||
Public ReadOnly Property CacheQueryFilter As String
|
||||
Get
|
||||
If Not IsCacheQuery Then Return String.Empty
|
||||
Return FallbackSQL.Substring(FallbackSQL.IndexOf("?") + 1).Trim()
|
||||
End Get
|
||||
End Property
|
||||
''' <summary>"TBDD_USER?USER_ID=4524!STATUS=1" → "TBDD_USER"</summary>
|
||||
Public ReadOnly Property CacheWriteTable As String
|
||||
Get
|
||||
If Not IsCacheWriteQuery Then Return String.Empty
|
||||
Return FallbackSQL.Substring(0, FallbackSQL.IndexOf("?")).Trim()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>"TBDD_USER?USER_ID=4524!STATUS=1" → "USER_ID=4524"</summary>
|
||||
Public ReadOnly Property CacheWriteFilter As String
|
||||
Get
|
||||
If Not IsCacheWriteQuery Then Return String.Empty
|
||||
Dim oStart As Integer = FallbackSQL.IndexOf("?") + 1
|
||||
Dim oLength As Integer = FallbackSQL.IndexOf("!") - oStart
|
||||
Return FallbackSQL.Substring(oStart, oLength).Trim()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>"TBDD_USER?USER_ID=4524!STATUS=1" → "STATUS=1" | "DELETE"</summary>
|
||||
Public ReadOnly Property CacheWriteAction As String
|
||||
Get
|
||||
If Not IsCacheWriteQuery Then Return String.Empty
|
||||
Return FallbackSQL.Substring(FallbackSQL.IndexOf("!") + 1).Trim()
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>True wenn die Aktion ein DELETE ist</summary>
|
||||
Public ReadOnly Property CacheWriteIsDelete As Boolean
|
||||
Get
|
||||
Return IsCacheWriteQuery AndAlso
|
||||
CacheWriteAction.Equals("DELETE", StringComparison.OrdinalIgnoreCase)
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Generiert das SQL aus der URI-Write-Syntax.
|
||||
''' UPDATE: "TBDD_USER?USER_ID=4524!STATUS=1" → "UPDATE TBDD_USER SET STATUS=1 WHERE USER_ID=4524"
|
||||
''' DELETE: "TBDD_USER?USER_ID=4524!DELETE" → "DELETE FROM TBDD_USER WHERE USER_ID=4524"
|
||||
''' </summary>
|
||||
Public ReadOnly Property CacheWriteToSql As String
|
||||
Get
|
||||
If Not IsCacheWriteQuery Then Return String.Empty
|
||||
If CacheWriteIsDelete Then
|
||||
Return $"DELETE FROM {CacheWriteTable} WHERE {CacheWriteFilter}"
|
||||
Else
|
||||
Return $"UPDATE {CacheWriteTable} SET {CacheWriteAction} WHERE {CacheWriteFilter}"
|
||||
End If
|
||||
End Get
|
||||
End Property
|
||||
''' <summary>
|
||||
''' Creates a new options object for GetDatatable options
|
||||
''' </summary>
|
||||
@@ -44,8 +207,19 @@ Public Class DatabaseWithFallback
|
||||
FallbackSQL = pFallbackSQL
|
||||
FallbackType = pFallbackType
|
||||
End Sub
|
||||
''' <summary>
|
||||
''' Creates a new options object using URI-Syntax (Cache-Query or URI-Write-Query).
|
||||
''' FallbackType defaults to ECM – only relevant if URI detection fails and falls back to SQL.
|
||||
''' Beispiel Read: "TBDD_USER?USER_ID=4524"
|
||||
''' Beispiel Write: "TBDD_USER?USER_ID=4524!STATUS=1"
|
||||
''' Beispiel Write: "TBDD_USER?USER_ID=4524!DELETE"
|
||||
''' </summary>
|
||||
''' <param name="pURISyntax">URI-Syntax string</param>
|
||||
Public Sub New(pURISyntax As String)
|
||||
FallbackSQL = pURISyntax
|
||||
FallbackType = Constants.DatabaseType.ECM
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Sub New(LogConfig As LogConfig, Client As Client, DatabaseECM As MSSQLServer, DatabaseIDB As MSSQLServer)
|
||||
_Logger = LogConfig.GetLogger()
|
||||
_Client = Client
|
||||
@@ -72,29 +246,37 @@ Public Class DatabaseWithFallback
|
||||
Return _DatabaseECM.GetConnectionStringForId(pConnectionId)
|
||||
End Function
|
||||
|
||||
|
||||
#Region "GetDatatable"
|
||||
''' <summary>URI-Cache-Syntax wird über GetDatatable(pOptions) ausgewertet.</summary>
|
||||
Public Function GetDatatableECM(pSQL As String) As DataTable
|
||||
Return GetDatatable(New GetDatatableOptions(pSQL, Constants.DatabaseType.ECM))
|
||||
End Function
|
||||
|
||||
Public Async Function GetDatatableECMAsync(pSQL As String) As Task(Of DataTable)
|
||||
Return Await Task.Run(Function() GetDatatableECM(pSQL))
|
||||
Return Await GetDatatableFromServiceAsync(pSQL, Constants.DatabaseType.ECM, 0)
|
||||
End Function
|
||||
|
||||
''' <summary>URI-Cache-Syntax wird über GetDatatable(pOptions) ausgewertet.</summary>
|
||||
Public Function GetDatatableIDB(pSQL As String) As DataTable
|
||||
Return GetDatatable(New GetDatatableOptions(pSQL, Constants.DatabaseType.IDB))
|
||||
End Function
|
||||
|
||||
Public Async Function GetDatatableIDBAsync(pSQL As String) As Task(Of DataTable)
|
||||
Return Await Task.Run(Function() GetDatatableIDB(pSQL))
|
||||
Return Await GetDatatableFromServiceAsync(pSQL, Constants.DatabaseType.IDB, 0)
|
||||
End Function
|
||||
|
||||
Public Function GetDatatableWithConnection(pSQL As String, pConnectionId As Integer) As DataTable
|
||||
Return GetDatatable(New GetDatatableOptions(pSQL, Constants.DatabaseType.None) With {.ConnectionId = pConnectionId})
|
||||
' ===== URI-CACHE-SYNTAX: "TABELLENNAME?FILTERAUSDRUCK" =====
|
||||
Dim oOptions As New GetDatatableOptions(pSQL, Constants.DatabaseType.None) With {.ConnectionId = pConnectionId}
|
||||
If oOptions.IsCacheQuery Then
|
||||
Return GetDatatable(oOptions.CacheQueryTable, oOptions)
|
||||
End If
|
||||
Return GetDatatable(oOptions)
|
||||
End Function
|
||||
|
||||
Public Async Function GetDatatableWithConnectionAsync(pSQL As String, pConnectionId As Integer) As Task(Of DataTable)
|
||||
Return Await Task.Run(Function() GetDatatableWithConnection(pSQL, pConnectionId))
|
||||
Return Await GetDatatableFromServiceAsync(pSQL, Constants.DatabaseType.None, pConnectionId)
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
@@ -104,7 +286,7 @@ Public Class DatabaseWithFallback
|
||||
End Function
|
||||
|
||||
Public Async Function GetScalarValueECMAsync(pSQL As String) As Task(Of Object)
|
||||
Return Await Task.Run(Function() GetScalarValueECM(pSQL))
|
||||
Return Await GetScalarValueFromServiceAsync(pSQL, Constants.DatabaseType.ECM, 0)
|
||||
End Function
|
||||
|
||||
Public Function GetScalarValueIDB(pSQL As String) As Object
|
||||
@@ -112,7 +294,7 @@ Public Class DatabaseWithFallback
|
||||
End Function
|
||||
|
||||
Public Async Function GetScalarValueIDBAsync(pSQL As String) As Task(Of Object)
|
||||
Return Await Task.Run(Function() GetScalarValueIDB(pSQL))
|
||||
Return Await GetScalarValueFromServiceAsync(pSQL, Constants.DatabaseType.IDB, 0)
|
||||
End Function
|
||||
|
||||
Public Function GetScalarValueWithConnection(pSQL As String, pConnectionId As Integer) As Object
|
||||
@@ -120,17 +302,20 @@ Public Class DatabaseWithFallback
|
||||
End Function
|
||||
|
||||
Public Async Function GetScalarValueWithConnectionAsync(pSQL As String, pConnectionId As Integer) As Task(Of Object)
|
||||
Return Await Task.Run(Function() GetScalarValueWithConnection(pSQL, pConnectionId))
|
||||
Return Await GetScalarValueFromServiceAsync(pSQL, Constants.DatabaseType.None, pConnectionId)
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "ExecuteNonQuery"
|
||||
' URI-Cache-Syntax ("TABELLE?FILTER") ist hier nicht anwendbar:
|
||||
' ExecuteNonQuery führt schreibende Operationen aus (INSERT/UPDATE/DELETE)
|
||||
' und liefert kein Ergebnis, das aus dem AppServer-Cache gelesen werden könnte.
|
||||
Public Function ExecuteNonQueryECM(pSQL As String) As Boolean
|
||||
Return ExecuteNonQuery(pSQL, Constants.DatabaseType.ECM)
|
||||
End Function
|
||||
|
||||
Public Async Function ExecuteNonQueryECMAsync(pSQL As String) As Task(Of Boolean)
|
||||
Return Await Task.Run(Function() ExecuteNonQueryECM(pSQL))
|
||||
Return Await ExecuteNonQueryFromServiceAsync(pSQL, Constants.DatabaseType.ECM, 0)
|
||||
End Function
|
||||
|
||||
Public Function ExecuteNonQueryIDB(pSQL As String) As Boolean
|
||||
@@ -138,7 +323,7 @@ Public Class DatabaseWithFallback
|
||||
End Function
|
||||
|
||||
Public Async Function ExecuteNonQueryIDBAsync(pSQL As String) As Task(Of Boolean)
|
||||
Return Await Task.Run(Function() ExecuteNonQueryIDB(pSQL))
|
||||
Return Await ExecuteNonQueryFromServiceAsync(pSQL, Constants.DatabaseType.IDB, 0)
|
||||
End Function
|
||||
|
||||
Public Function ExecuteNonQueryWithConnection(pSQL As String, pConnectionId As Integer) As Boolean
|
||||
@@ -146,7 +331,7 @@ Public Class DatabaseWithFallback
|
||||
End Function
|
||||
|
||||
Public Async Function ExecuteNonQueryWithConnectionAsync(pSQL As String, pConnectionId As Integer) As Task(Of Boolean)
|
||||
Return Await Task.Run(Function() ExecuteNonQueryWithConnection(pSQL, pConnectionId))
|
||||
Return Await ExecuteNonQueryFromServiceAsync(pSQL, Constants.DatabaseType.None, pConnectionId)
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
@@ -157,18 +342,61 @@ Public Class DatabaseWithFallback
|
||||
''' <param name="pDataTableName">Name of the Cached Datatable</param>
|
||||
''' <param name="pOptions">Options object</param>
|
||||
Public Function GetDatatable(pDataTableName As String, pOptions As GetDatatableOptions) As DataTable
|
||||
' ===== URI-CACHE-SYNTAX: "TABELLENNAME?FILTERAUSDRUCK" =====
|
||||
If pOptions.IsCacheQuery AndAlso Not pOptions.ForceFallback AndAlso
|
||||
Not (_ClientConfig IsNot Nothing AndAlso _ClientConfig.ForceDirectDatabaseAccess) Then
|
||||
Dim oTable As String = pOptions.CacheQueryTable
|
||||
Dim oFilter As String = pOptions.CacheQueryFilter
|
||||
|
||||
' ===== LOKALER OVERRIDE-CACHE – vorrangig prüfen =====
|
||||
Dim oCacheKey As String = GetOverrideCacheKey(oTable, oFilter)
|
||||
Dim oOverride As DataTable = Nothing
|
||||
If _localOverrideCache.TryGetValue(oCacheKey, oOverride) Then
|
||||
_Logger.Debug("✔ GetDatatable: Lokaler Override-Cache trifft für [{0}] Filter [{1}]", oTable, oFilter)
|
||||
Return oOverride
|
||||
End If
|
||||
|
||||
_Logger.Debug("GetDatatable: URI-Cache-Query erkannt – Tabelle [{0}] Filter [{1}]", oTable, oFilter)
|
||||
|
||||
If _Client IsNot Nothing AndAlso IsTableCached(oTable) Then
|
||||
Try
|
||||
Dim oResult As TableResult = _Client.GetDatatableByName(oTable, oFilter, pOptions.SortByColumn)
|
||||
If oResult IsNot Nothing AndAlso oResult.OK Then
|
||||
_Logger.Debug("✔ GetDatatable: URI-Cache-Query [{0}] – {1} Zeilen", oTable, oResult.Table?.Rows.Count)
|
||||
Return oResult.Table
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
_Logger.Warn("⚠ GetDatatable: URI-Cache-Query [{0}] fehlgeschlagen – kein SQL-Fallback verfügbar", oTable)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
_Logger.Warn("⚠ GetDatatable: URI-Cache-Query – Tabelle [{0}] nicht im AppServer-Cache", oTable)
|
||||
Return Nothing
|
||||
End If
|
||||
Return GetDatatable(pDataTableName, pOptions.FallbackSQL, pOptions.FallbackType, pOptions.FilterExpression, pOptions.SortByColumn, pOptions.ForceFallback, pOptions.ConnectionId)
|
||||
End Function
|
||||
|
||||
Public Function GetDatatable(pSQL As String, pConnectionId As Integer) As DataTable
|
||||
' ===== URI-CACHE-SYNTAX: "TABELLENNAME?FILTERAUSDRUCK" =====
|
||||
Dim oOptions As New GetDatatableOptions(pSQL, Constants.DatabaseType.ECM) With {.ConnectionId = pConnectionId}
|
||||
If oOptions.IsCacheQuery Then
|
||||
Return GetDatatable(oOptions.CacheQueryTable, oOptions)
|
||||
End If
|
||||
Return GetDatatable("FORCE_FALLBACK", pSQL, Constants.DatabaseType.ECM, pSortByColumn:=Nothing, pForceFallback:=False, pConnectionId:=pConnectionId)
|
||||
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Returns a datatable directly from the database.
|
||||
''' Returns a datatable directly from the database – or from AppServer cache if URI-Cache-Syntax is detected.
|
||||
''' </summary>
|
||||
''' <param name="pOptions">Options object</param>
|
||||
Public Function GetDatatable(pOptions As GetDatatableOptions) As DataTable
|
||||
' ===== URI-CACHE-SYNTAX: "TABELLENNAME?FILTERAUSDRUCK" =====
|
||||
If pOptions.IsCacheQuery Then
|
||||
Return GetDatatable(pOptions.CacheQueryTable, pOptions)
|
||||
End If
|
||||
Dim oForceFallback = True
|
||||
Return GetDatatable("FORCE_FALLBACK", pOptions.FallbackSQL, pOptions.FallbackType, pOptions.FilterExpression, pOptions.SortByColumn, oForceFallback, pOptions.ConnectionId)
|
||||
End Function
|
||||
@@ -185,35 +413,35 @@ Public Class DatabaseWithFallback
|
||||
''' <param name="pConnectionId">Connection Id to use, references TBDD_CONNECTION</param>
|
||||
Public Function GetDatatable(pDataTableName As String, pFallbackSQL As String, pFallbackType As Constants.DatabaseType, Optional pFilterExpression As String = "", Optional pSortByColumn As String = "", Optional pForceFallback As Boolean = False, Optional pConnectionId As Integer = 0) As DataTable
|
||||
Try
|
||||
Dim oResult As DataTable = Nothing
|
||||
Dim oTableResult As TableResult = Nothing
|
||||
|
||||
_Logger.Debug("GetDatatable: Fetching datatable [{0}] , Filter Expression [{1}], Sort By Column [{2}], Force Fallback [{3}]",
|
||||
pDataTableName, pFilterExpression, pSortByColumn, pForceFallback)
|
||||
' If there is no client, we assume there is no service (configured)
|
||||
If _Client Is Nothing Then
|
||||
_Logger.Debug("Client is empty, falling back to direct database access.")
|
||||
_Logger.Debug("GetDatatable: Client is empty, falling back to direct database access.")
|
||||
Return GetDatatableFromDatabase(pFallbackSQL, pFallbackType, pConnectionId)
|
||||
End If
|
||||
|
||||
' If ForceFallback flag is set, we go to database immediately
|
||||
If pForceFallback Or _ClientConfig.ForceDirectDatabaseAccess Then
|
||||
_Logger.Debug("ForceFallback is True, falling back to direct database access.")
|
||||
_Logger.Debug("GetDatatable: ForceFallback is True, falling back to direct database access.")
|
||||
Return GetDatatableFromDatabase(pFallbackSQL, pFallbackType, pConnectionId)
|
||||
End If
|
||||
|
||||
' If the table is not cached, we try going through the service
|
||||
If Not IsTableCached(pDataTableName) Then
|
||||
_Logger.Debug("Datatable is not chached, fetching data from service.")
|
||||
_Logger.Debug("GetDatatable: Datatable [{0}] is not chached, fetching data from service.", pDataTableName)
|
||||
Return GetDatatableFromService(pFallbackSQL, pFallbackType, pConnectionId)
|
||||
End If
|
||||
|
||||
' If there is a proper ConnectionId, we try going through the service
|
||||
If pConnectionId > 0 Then
|
||||
_Logger.Debug("ConnectionId is set, fetching data from service.")
|
||||
_Logger.Debug("GetDatatable: ConnectionId is set, fetching data from service.")
|
||||
Return GetDatatableFromService(pFallbackSQL, pFallbackType, pConnectionId)
|
||||
End If
|
||||
|
||||
Try
|
||||
_Logger.Debug("Datatable is chached, fetching data from cache.")
|
||||
_Logger.Debug("GetDatatable: Datatable is chached, fetching data from cache.")
|
||||
oTableResult = _Client.GetDatatableByName(pDataTableName, pFilterExpression, pSortByColumn)
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
@@ -221,9 +449,10 @@ Public Class DatabaseWithFallback
|
||||
End Try
|
||||
|
||||
If oTableResult Is Nothing OrElse oTableResult.OK = False Then
|
||||
_Logger.Warn("Datatable [{0}] could not be fetched from AppServer Cache. Falling back to direct Database Access.", pDataTableName)
|
||||
_Logger.Warn("⚠ GetDatatable: Datatable [{0}] could not be fetched from AppServer Cache. Falling back to direct Database Access.", pDataTableName)
|
||||
Return GetDatatableFromDatabase(pFallbackSQL, pFallbackType, pConnectionId)
|
||||
Else
|
||||
_Logger.Debug("✔ GetDatatable: Datatable [{0}] fetched from AppServer Cache.", pDataTableName)
|
||||
Return oTableResult.Table
|
||||
End If
|
||||
|
||||
@@ -236,51 +465,75 @@ Public Class DatabaseWithFallback
|
||||
|
||||
''' <summary>
|
||||
''' Returns a Scalar Value by querying the database through the service and querying the database directly as fallback.
|
||||
''' URI-Cache-Syntax wird unterstützt: "TABELLENNAME?FILTERAUSDRUCK" – liefert Wert der ersten Spalte der ersten Zeile aus dem AppServer-Cache.
|
||||
''' </summary>
|
||||
''' <param name="pSQL">SQL Command to execute as fallback</param>
|
||||
''' <param name="pSQL">SQL Command to execute as fallback – oder URI-Cache-Syntax "TABELLENNAME?FILTERAUSDRUCK"</param>
|
||||
''' <param name="pDatabaseType">Named Database to use for the fallback SQL Command</param>
|
||||
''' <param name="pForceFallback">Force the fallback, skipping the service completely</param>
|
||||
''' <param name="pConnectionId">Connection Id to use, references TBDD_CONNECTION</param>
|
||||
Public Function GetScalarValue(pSQL As String, pDatabaseType As Constants.DatabaseType, Optional pForceFallback As Boolean = False, Optional pConnectionId As Integer = 0) As Object
|
||||
Try
|
||||
' If there is no client, we assume there is no service (configured)
|
||||
' ===== URI-CACHE-SYNTAX: "TABELLENNAME?FILTERAUSDRUCK" =====
|
||||
' ForceFallback übersteuert auch die URI-Cache-Syntax
|
||||
Dim oOptions As New GetDatatableOptions(pSQL, pDatabaseType)
|
||||
If oOptions.IsCacheQuery AndAlso Not pForceFallback AndAlso
|
||||
Not (_ClientConfig IsNot Nothing AndAlso _ClientConfig.ForceDirectDatabaseAccess) Then
|
||||
Dim oTable As String = oOptions.CacheQueryTable
|
||||
Dim oFilter As String = oOptions.CacheQueryFilter
|
||||
_Logger.Debug("GetScalarValue: URI-Cache-Query erkannt – Tabelle [{0}] Filter [{1}]", oTable, oFilter)
|
||||
|
||||
If _Client IsNot Nothing AndAlso IsTableCached(oTable) Then
|
||||
Try
|
||||
Dim oResult As TableResult = _Client.GetDatatableByName(oTable, oFilter, "")
|
||||
If oResult IsNot Nothing AndAlso oResult.OK AndAlso
|
||||
oResult.Table IsNot Nothing AndAlso oResult.Table.Rows.Count > 0 Then
|
||||
Dim oScalar As Object = oResult.Table.Rows(0)(0)
|
||||
_Logger.Debug("✔ GetScalarValue: URI-Cache-Query [{0}] – Scalar [{1}]", oTable, oScalar)
|
||||
Return oScalar
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
_Logger.Warn("⚠ GetScalarValue: URI-Cache-Query [{0}] fehlgeschlagen – kein SQL-Fallback verfügbar", oTable)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
_Logger.Warn("⚠ GetScalarValue: URI-Cache-Query – Tabelle [{0}] nicht im AppServer-Cache", oTable)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
If _Client Is Nothing Then
|
||||
Return GetScalarValueFromDatabase(pSQL, pDatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
' If ForceFallback flag is set, we go to database immediately
|
||||
If pForceFallback Or _ClientConfig.ForceDirectDatabaseAccess Then
|
||||
Return GetScalarValueFromDatabase(pSQL, pDatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
Return GetScalarValueFromService(pSQL, pDatabaseType, pConnectionId)
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return Nothing
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' Returns a Scalar Value by querying the database through the service and querying the database directly as fallback.
|
||||
''' Executes a non-query SQL command through the service and falls back to direct database access.
|
||||
''' </summary>
|
||||
''' <param name="pSQL">SQL Command to execute as fallback</param>
|
||||
''' <param name="pDatabaseType">Named Database to use for the fallback SQL Command</param>
|
||||
''' <param name="pSQL">SQL Command to execute</param>
|
||||
''' <param name="pDatabaseType">Named Database to use for the SQL Command</param>
|
||||
''' <param name="pForceFallback">Force the fallback, skipping the service completely</param>
|
||||
''' <param name="pConnectionId">Connection Id to use, references TBDD_CONNECTION</param>
|
||||
Public Function ExecuteNonQuery(pSQL As String, pDatabaseType As Constants.DatabaseType, Optional pForceFallback As Boolean = False, Optional pConnectionId As Integer = 0) As Boolean
|
||||
Try
|
||||
Dim oResult As DataTable = Nothing
|
||||
Dim oTableResult As TableResult = Nothing
|
||||
|
||||
' If there is no client, we assume there is no service (configured)
|
||||
If _Client Is Nothing Then
|
||||
_Logger.Debug("ExecuteNonQuery - Client is empty, falling back to direct database access.")
|
||||
Return ExecuteNonQueryFromDatabase(pSQL, pDatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
' If ForceFallback flag is set, we go to database immediately
|
||||
If pForceFallback Or _ClientConfig.ForceDirectDatabaseAccess Then
|
||||
_Logger.Debug("ExecuteNonQuery - ForceFallback is set, falling back to direct database access.")
|
||||
Return ExecuteNonQueryFromDatabase(pSQL, pDatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
@@ -288,13 +541,82 @@ Public Class DatabaseWithFallback
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return Nothing
|
||||
Return False
|
||||
|
||||
End Try
|
||||
End Function
|
||||
''' <summary>
|
||||
''' Führt ein UPDATE oder DELETE über URI-Write-Syntax aus.
|
||||
''' Der geänderte Snapshot wird lokal gecacht und bei GetDatatable/GetScalarValue
|
||||
''' vorrangig ausgewertet – bis der Server-Refresh den Cache neu befüllt.
|
||||
''' UPDATE: "TBDD_USER?USER_ID=4524!STATUS=1"
|
||||
''' DELETE: "TBDD_USER?USER_ID=4524!DELETE"
|
||||
''' </summary>
|
||||
Public Function ExecuteAppServiceWrite(pOptions As GetDatatableOptions) As Boolean
|
||||
If Not pOptions.IsCacheWriteQuery Then
|
||||
_Logger.Warn("⚠ ExecuteAppServiceWrite: Keine gültige URI-Write-Syntax – [{0}] – Abbruch.", pOptions.FallbackSQL)
|
||||
Return False
|
||||
End If
|
||||
|
||||
If _Client Is Nothing OrElse Not IsTableCached(pOptions.CacheWriteTable) Then
|
||||
_Logger.Warn("⚠ ExecuteAppServiceWrite: Tabelle [{0}] nicht im AppServer-Cache – Abbruch.", pOptions.CacheWriteTable)
|
||||
Return False
|
||||
End If
|
||||
|
||||
_Logger.Debug("ExecuteAppServiceWrite: Tabelle [{0}] | Filter [{1}] | Aktion [{2}] | IsDelete [{3}]",
|
||||
pOptions.CacheWriteTable, pOptions.CacheWriteFilter, pOptions.CacheWriteAction, pOptions.CacheWriteIsDelete)
|
||||
Try
|
||||
' Aktuellen Snapshot aus Cache laden
|
||||
Dim oResult As TableResult = _Client.GetDatatableByName(pOptions.CacheWriteTable, pOptions.CacheWriteFilter, "")
|
||||
If oResult Is Nothing OrElse Not oResult.OK OrElse oResult.Table Is Nothing Then
|
||||
_Logger.Warn("⚠ ExecuteAppServiceWrite: Cache-Abfrage für [{0}] fehlgeschlagen.", pOptions.CacheWriteTable)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oMatchingRows As DataRow() = oResult.Table.Select(pOptions.CacheWriteFilter)
|
||||
If oMatchingRows.Length = 0 Then
|
||||
_Logger.Debug("ExecuteAppServiceWrite: Keine Zeilen für Filter [{0}] gefunden.", pOptions.CacheWriteFilter)
|
||||
Return True
|
||||
End If
|
||||
|
||||
If pOptions.CacheWriteIsDelete Then
|
||||
For Each oRow As DataRow In oMatchingRows
|
||||
oRow.Delete()
|
||||
Next
|
||||
oResult.Table.AcceptChanges()
|
||||
_Logger.Debug("✔ ExecuteAppServiceWrite: DELETE – [{0}] Zeilen entfernt.", oMatchingRows.Length)
|
||||
Else
|
||||
For Each oPair As String In pOptions.CacheWriteAction.Split(","c)
|
||||
Dim oParts = oPair.Split("="c)
|
||||
If oParts.Length <> 2 Then Continue For
|
||||
Dim oCol As String = oParts(0).Trim()
|
||||
Dim oVal As String = oParts(1).Trim().Trim("'"c)
|
||||
For Each oRow As DataRow In oMatchingRows
|
||||
If oResult.Table.Columns.Contains(oCol) Then
|
||||
oRow(oCol) = oVal
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
oResult.Table.AcceptChanges()
|
||||
_Logger.Debug("✔ ExecuteAppServiceWrite: UPDATE – [{0}] Zeilen aktualisiert.", oMatchingRows.Length)
|
||||
End If
|
||||
|
||||
' ===== OVERRIDE-CACHE BEFÜLLEN =====
|
||||
Dim oCacheKey As String = GetOverrideCacheKey(pOptions.CacheWriteTable, pOptions.CacheWriteFilter)
|
||||
_localOverrideCache(oCacheKey) = oResult.Table
|
||||
_Logger.Debug("✔ ExecuteAppServiceWrite: Override-Cache gesetzt für [{0}]", oCacheKey)
|
||||
|
||||
Return True
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
Private Function IsTableCached(pName As String) As Boolean
|
||||
_Logger.Debug("IsTableCached: Checking if table [{0}] is cached.", pName)
|
||||
If _Client Is Nothing Then
|
||||
_Logger.Warn("⚠ IsTableCached: Client is nothing, cannot check if table is cached.")
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -303,42 +625,79 @@ Public Class DatabaseWithFallback
|
||||
|
||||
Private Function GetDatatableFromService(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As DataTable
|
||||
Try
|
||||
_Logger.Debug("GetDatatableFromService: Fetching data from service [{0}] with Connection Id [{1}] and Command [{2}]", DatabaseType.ToString, pConnectionId, pSQLCommand)
|
||||
Dim oResult As GetDatatableResponse = Nothing
|
||||
|
||||
Select Case DatabaseType
|
||||
Case Constants.DatabaseType.ECM
|
||||
oResult = _Client.GetDatatableFromECM(pSQLCommand)
|
||||
|
||||
Case Constants.DatabaseType.IDB
|
||||
oResult = _Client.GetDatatableFromIDB(pSQLCommand)
|
||||
|
||||
Case Else
|
||||
Return GetDatatableFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
End Select
|
||||
|
||||
If oResult Is Nothing Then
|
||||
Throw New ApplicationException("Unexpected server error ocurred!")
|
||||
End If
|
||||
|
||||
If oResult.OK = False Then
|
||||
Throw New ApplicationException(oResult.ErrorMessage)
|
||||
If oResult Is Nothing OrElse oResult.OK = False Then
|
||||
_Logger.Warn("⚠ GetDatatableFromService: Service returned invalid response [{0}]. Falling back to direct database access.", If(oResult Is Nothing, "null", oResult.ErrorMessage))
|
||||
Return GetDatatableFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
Return oResult.Table
|
||||
|
||||
Catch ex As InvalidOperationException
|
||||
_Logger.Warn("⚠ GetDatatableFromService skipped: [{0}] Falling back to direct database access.", ex.Message)
|
||||
Return GetDatatableFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("GetDatatableFromService failed. Falling back to direct database access.")
|
||||
_Logger.Warn("⚠ GetDatatableFromService failed. Falling back to direct database access.")
|
||||
_Logger.Error(ex)
|
||||
Return GetDatatableFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Async Function GetDatatableFromServiceAsync(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Task(Of DataTable)
|
||||
_Logger.Debug("GetDatatableFromServiceAsync called | SQL=[{0}] | DB=[{1}] | ConnId=[{2}]",
|
||||
pSQLCommand, DatabaseType.ToString, pConnectionId)
|
||||
|
||||
If _Client Is Nothing OrElse _ClientConfig?.ForceDirectDatabaseAccess Then
|
||||
' ← Kein Task.Run: direkt synchron, Thread ist ohnehin frei
|
||||
Return GetDatatableFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim oResult As GetDatatableResponse = Nothing
|
||||
|
||||
Select Case DatabaseType
|
||||
Case Constants.DatabaseType.ECM
|
||||
oResult = Await _Client.GetDatatableFromECMAsync(pSQLCommand)
|
||||
Case Constants.DatabaseType.IDB
|
||||
oResult = Await _Client.GetDatatableFromIDBAsync(pSQLCommand)
|
||||
Case Else
|
||||
oResult = Await _Client.GetDatatableFromConnectionAsync(pSQLCommand, pConnectionId)
|
||||
End Select
|
||||
|
||||
If oResult Is Nothing OrElse oResult.OK = False Then
|
||||
_Logger.Warn("⚠ GetDatatableFromServiceAsync failed | Fallback to DB | Error=[{0}]",
|
||||
If(oResult Is Nothing, "null", oResult.ErrorMessage))
|
||||
Return GetDatatableFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
Return oResult.Table
|
||||
|
||||
Catch ex As InvalidOperationException
|
||||
_Logger.Warn("⚠ GetDatatableFromServiceAsync offline: [{0}] | Fallback to DB", ex.Message)
|
||||
Return GetDatatableFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("⚠ GetDatatableFromServiceAsync failed | Fallback to DB")
|
||||
_Logger.Error(ex)
|
||||
Return GetDatatableFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End Try
|
||||
End Function
|
||||
Private Function GetDatatableFromDatabase(pSQLCommand As String, pDatabaseType As Constants.DatabaseType, pConnectionId As Integer) As DataTable
|
||||
Try
|
||||
_Logger.Debug("Fetching data from database [{0}] with Connection Id [{0}]", pDatabaseType.ToString, pConnectionId)
|
||||
_Logger.Debug("GetDatatableFromDatabase: Fetching data from database [{0}] with Connection Id [{1}] and Command [{2}]", pDatabaseType.ToString, pConnectionId, pSQLCommand)
|
||||
|
||||
Select Case pDatabaseType
|
||||
Case Constants.DatabaseType.IDB
|
||||
@@ -347,7 +706,7 @@ Public Class DatabaseWithFallback
|
||||
Case Else
|
||||
If pConnectionId > 0 Then
|
||||
_Logger.Debug("Retrieving Connection String from Connection Id [{0}]", pConnectionId)
|
||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
||||
Dim oConnectionString = GetCachedConnectionString(pConnectionId) ' ← NEU: Cache statt direkter DB-Abfrage
|
||||
Return _DatabaseECM.GetDatatableWithConnection(pSQLCommand, oConnectionString)
|
||||
Else
|
||||
Return _DatabaseECM.GetDatatable(pSQLCommand)
|
||||
@@ -361,35 +720,69 @@ Public Class DatabaseWithFallback
|
||||
|
||||
End Try
|
||||
End Function
|
||||
Private Async Function GetScalarValueFromServiceAsync(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Task(Of Object)
|
||||
_Logger.Debug("GetScalarValueFromServiceAsync called | SQL=[{0}] | DB=[{1}] | ConnId=[{2}]",
|
||||
pSQLCommand, DatabaseType.ToString, pConnectionId)
|
||||
|
||||
If _Client Is Nothing OrElse _ClientConfig?.ForceDirectDatabaseAccess Then
|
||||
Return GetScalarValueFromDatabase(pSQLCommand, DatabaseType, pConnectionId) ' ← kein Task.Run
|
||||
End If
|
||||
|
||||
Private Function GetScalarValueFromService(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Object
|
||||
Try
|
||||
Dim oResult As GetScalarValueResponse = Nothing
|
||||
|
||||
Select Case DatabaseType
|
||||
Case Constants.DatabaseType.ECM
|
||||
oResult = _Client.GetScalarValueFromECM(pSQLCommand)
|
||||
|
||||
oResult = Await _Client.GetScalarValueFromECMAsync(pSQLCommand)
|
||||
Case Constants.DatabaseType.IDB
|
||||
oResult = _Client.GetScalarValueFromIDB(pSQLCommand)
|
||||
|
||||
oResult = Await _Client.GetScalarValueFromIDBAsync(pSQLCommand)
|
||||
Case Else
|
||||
Return GetScalarValueFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
oResult = Await _Client.GetScalarValueFromConnectionAsync(pSQLCommand, pConnectionId)
|
||||
End Select
|
||||
|
||||
If oResult Is Nothing Then
|
||||
Throw New ApplicationException("Unexpected server error ocurred!")
|
||||
End If
|
||||
|
||||
If oResult.OK = False Then
|
||||
Throw New ApplicationException(oResult.ErrorMessage)
|
||||
If oResult Is Nothing OrElse oResult.OK = False Then
|
||||
_Logger.Warn("⚠ GetScalarValueFromServiceAsync failed | Fallback to DB")
|
||||
Return GetScalarValueFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
Return oResult.Scalar
|
||||
|
||||
Catch ex As InvalidOperationException
|
||||
_Logger.Warn("⚠ GetScalarValueFromServiceAsync offline: [{0}] | Fallback to DB", ex.Message)
|
||||
Return GetScalarValueFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("GetScalarValueFromService failed. Falling back to direct database access.")
|
||||
_Logger.Warn("⚠ GetScalarValueFromServiceAsync failed | Fallback to DB")
|
||||
_Logger.Error(ex)
|
||||
Return GetScalarValueFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End Try
|
||||
End Function
|
||||
Private Function GetScalarValueFromService(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Object
|
||||
Try
|
||||
Dim oResult As GetScalarValueResponse = Nothing
|
||||
_Logger.Debug("GetScalarValueFromService [{0}] with Connection Id [{1}] and Command [{2}]", DatabaseType.ToString, pConnectionId, pSQLCommand)
|
||||
Select Case DatabaseType
|
||||
Case Constants.DatabaseType.ECM
|
||||
oResult = _Client.GetScalarValueFromECM(pSQLCommand)
|
||||
Case Constants.DatabaseType.IDB
|
||||
oResult = _Client.GetScalarValueFromIDB(pSQLCommand)
|
||||
Case Else
|
||||
Return GetScalarValueFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End Select
|
||||
|
||||
If oResult Is Nothing OrElse oResult.OK = False Then
|
||||
_Logger.Warn("⚠ GetScalarValueFromService: Service returned invalid response [{0}]. Falling back to direct database access.", If(oResult Is Nothing, "null", oResult.ErrorMessage))
|
||||
Return GetScalarValueFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
Return oResult.Scalar
|
||||
|
||||
Catch ex As InvalidOperationException
|
||||
_Logger.Warn("⚠ GetScalarValueFromService skipped: [{0}] Falling back to direct database access.", ex.Message)
|
||||
Return GetScalarValueFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("⚠ GetScalarValueFromService failed. Falling back to direct database access.")
|
||||
_Logger.Error(ex)
|
||||
Return GetScalarValueFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
@@ -399,13 +792,14 @@ Public Class DatabaseWithFallback
|
||||
|
||||
Private Function GetScalarValueFromDatabase(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Object
|
||||
Try
|
||||
_Logger.Debug("DBwFF GetScalarValueFromDatabase [{0}] with Connection Id [{1}] and Command [{2}]", DatabaseType.ToString, pConnectionId, pSQLCommand)
|
||||
Select Case DatabaseType
|
||||
Case Constants.DatabaseType.IDB
|
||||
Return _DatabaseIDB.GetScalarValue(pSQLCommand)
|
||||
|
||||
Case Else
|
||||
If pConnectionId > 0 Then
|
||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
||||
Dim oConnectionString = GetCachedConnectionString(pConnectionId) ' ← NEU: Cache statt direkter DB-Abfrage
|
||||
Return _DatabaseECM.GetScalarValueWithConnection(pSQLCommand, oConnectionString)
|
||||
Else
|
||||
Return _DatabaseECM.GetScalarValue(pSQLCommand)
|
||||
@@ -419,35 +813,69 @@ Public Class DatabaseWithFallback
|
||||
|
||||
End Try
|
||||
End Function
|
||||
Private Async Function ExecuteNonQueryFromServiceAsync(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Task(Of Boolean)
|
||||
_Logger.Debug("ExecuteNonQueryFromServiceAsync called | SQL=[{0}] | DB=[{1}] | ConnId=[{2}]",
|
||||
pSQLCommand, DatabaseType.ToString, pConnectionId)
|
||||
|
||||
If _Client Is Nothing OrElse _ClientConfig?.ForceDirectDatabaseAccess Then
|
||||
Return ExecuteNonQueryFromDatabase(pSQLCommand, DatabaseType, pConnectionId) ' ← kein Task.Run
|
||||
End If
|
||||
|
||||
Private Function ExecuteNonQueryFromService(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Boolean
|
||||
Try
|
||||
Dim oResult As ExecuteNonQueryResponse = Nothing
|
||||
|
||||
Select Case DatabaseType
|
||||
Case Constants.DatabaseType.ECM
|
||||
oResult = _Client.ExecuteNonQueryFromECM(pSQLCommand)
|
||||
|
||||
oResult = Await _Client.ExecuteNonQueryFromECMAsync(pSQLCommand)
|
||||
Case Constants.DatabaseType.IDB
|
||||
oResult = _Client.ExecuteNonQueryFromIDB(pSQLCommand)
|
||||
|
||||
oResult = Await _Client.ExecuteNonQueryFromIDBAsync(pSQLCommand)
|
||||
Case Else
|
||||
Return ExecuteNonQueryFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
oResult = Await _Client.ExecuteNonQueryFromConnectionAsync(pSQLCommand, pConnectionId)
|
||||
End Select
|
||||
|
||||
If oResult Is Nothing Then
|
||||
Throw New ApplicationException("Unexpected server error ocurred!")
|
||||
End If
|
||||
|
||||
If oResult.OK = False Then
|
||||
Throw New ApplicationException(oResult.ErrorMessage)
|
||||
If oResult Is Nothing OrElse oResult.OK = False Then
|
||||
_Logger.Warn("⚠ ExecuteNonQueryFromServiceAsync failed | Fallback to DB")
|
||||
Return ExecuteNonQueryFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
Return oResult.Result
|
||||
|
||||
Catch ex As InvalidOperationException
|
||||
_Logger.Warn("⚠ ExecuteNonQueryFromServiceAsync offline: [{0}] | Fallback to DB", ex.Message)
|
||||
Return ExecuteNonQueryFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("ExecuteNonQueryFromService failed. Falling back to direct database access.")
|
||||
_Logger.Warn("⚠ ExecuteNonQueryFromServiceAsync failed | Fallback to DB")
|
||||
_Logger.Error(ex)
|
||||
Return ExecuteNonQueryFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End Try
|
||||
End Function
|
||||
Private Function ExecuteNonQueryFromService(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Boolean
|
||||
Try
|
||||
Dim oResult As ExecuteNonQueryResponse = Nothing
|
||||
_Logger.Debug("ExecuteNonQueryFromService [{0}] with Connection Id [{1}] and Command [{2}]", DatabaseType.ToString, pConnectionId, pSQLCommand)
|
||||
Select Case DatabaseType
|
||||
Case Constants.DatabaseType.ECM
|
||||
oResult = _Client.ExecuteNonQueryFromECM(pSQLCommand)
|
||||
Case Constants.DatabaseType.IDB
|
||||
oResult = _Client.ExecuteNonQueryFromIDB(pSQLCommand)
|
||||
Case Else
|
||||
Return ExecuteNonQueryFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End Select
|
||||
|
||||
If oResult Is Nothing OrElse oResult.OK = False Then
|
||||
_Logger.Warn("⚠ ExecuteNonQueryFromService: Service returned invalid response [{0}]. Falling back to direct database access.", If(oResult Is Nothing, "null", oResult.ErrorMessage))
|
||||
Return ExecuteNonQueryFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
End If
|
||||
|
||||
Return oResult.Result
|
||||
|
||||
Catch ex As InvalidOperationException
|
||||
_Logger.Warn("⚠ ExecuteNonQueryFromService skipped: [{0}] Falling back to direct database access.", ex.Message)
|
||||
Return ExecuteNonQueryFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
Catch ex As Exception
|
||||
_Logger.Warn("⚠ ExecuteNonQueryFromService failed. Falling back to direct database access.")
|
||||
_Logger.Error(ex)
|
||||
Return ExecuteNonQueryFromDatabase(pSQLCommand, DatabaseType, pConnectionId)
|
||||
|
||||
@@ -456,13 +884,15 @@ Public Class DatabaseWithFallback
|
||||
|
||||
Private Function ExecuteNonQueryFromDatabase(pSQLCommand As String, DatabaseType As Constants.DatabaseType, pConnectionId As Integer) As Boolean
|
||||
Try
|
||||
_Logger.Debug("ExecuteNonQueryFromDatabase [{0}] with Connection Id [{1}] and Command [{2}]", DatabaseType.ToString, pConnectionId, pSQLCommand)
|
||||
|
||||
Select Case DatabaseType
|
||||
Case Constants.DatabaseType.IDB
|
||||
Return _DatabaseIDB.ExecuteNonQuery(pSQLCommand)
|
||||
|
||||
Case Else
|
||||
If pConnectionId > 0 Then
|
||||
Dim oConnectionString = _DatabaseECM.Get_ConnectionStringforID(pConnectionId)
|
||||
Dim oConnectionString = GetCachedConnectionString(pConnectionId) ' ← NEU: Cache statt direkter DB-Abfrage
|
||||
Return _DatabaseECM.ExecuteNonQueryWithConnection(pSQLCommand, oConnectionString)
|
||||
Else
|
||||
Return _DatabaseECM.ExecuteNonQuery(pSQLCommand)
|
||||
|
||||
@@ -44,6 +44,22 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DigitalData.Modules.Base, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Config, Version=1.4.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Config\bin\Debug\DigitalData.Modules.Config.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Database, Version=2.3.7.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\Logging\bin\Debug\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
@@ -296,22 +312,7 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Base\Base.vbproj">
|
||||
<Project>{6ea0c51f-c2b1-4462-8198-3de0b32b74f8}</Project>
|
||||
<Name>Base</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Config\Config.vbproj">
|
||||
<Project>{44982f9b-6116-44e2-85d0-f39650b1ef99}</Project>
|
||||
<Name>Config</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Database\Database.vbproj">
|
||||
<Project>{eaf0ea75-5fa7-485d-89c7-b2d843b03a96}</Project>
|
||||
<Name>Database</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
</ProjectReference>
|
||||
<Content Include="ErrorLog.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -25,7 +25,7 @@ Namespace Modules.IDB
|
||||
Return True
|
||||
End If
|
||||
|
||||
Logger.Warn("Error while setting Attribute Value: [{0}]", oResponse.ErrorMessage)
|
||||
Logger.Warn("⚠ Error while setting Attribute Value: [{0}]", oResponse.ErrorMessage)
|
||||
Return False
|
||||
|
||||
Catch ex As Exception
|
||||
|
||||
@@ -12,8 +12,8 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("EDMIAPI")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2023")>
|
||||
<Assembly: AssemblyTrademark("1.6.1.1")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2026")>
|
||||
<Assembly: AssemblyTrademark("2.9.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.6.1.1")>
|
||||
<Assembly: AssemblyVersion("2.9.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.6.1.1")>
|
||||
|
||||
3401
EDMIAPI/Reference.vb
Normal file
3401
EDMIAPI/Reference.vb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,8 @@
|
||||
Imports System.DirectoryServices
|
||||
Imports System.DirectoryServices.AccountManagement
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Threading
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
@@ -13,6 +15,9 @@ Public Class ActiveDirectoryInterface
|
||||
Private _rootNode As DirectoryEntry
|
||||
|
||||
Private Const SEARCH_LIMIT = 50000
|
||||
Private Const AD_RETRY_COUNT = 3
|
||||
Private Const AD_RETRY_DELAY_MS = 5000
|
||||
Private Const LDAP_SERVER_NOT_OPERATIONAL As Integer = &H8007203A
|
||||
|
||||
Private Const SAMACCOUNTNAME = "samaccountname"
|
||||
Private Const OBJECTCLASS = "objectClass"
|
||||
@@ -47,9 +52,7 @@ Public Class ActiveDirectoryInterface
|
||||
End Function
|
||||
|
||||
Public Function SyncUsersForGroup(GroupName As String, AttributeMappings As List(Of AttributeMapping), MSSQL As MSSQLServer, Optional Filter As String = DEFAULT_USER_FILTER) As List(Of ADUser)
|
||||
Dim oUsers As New List(Of ADUser)
|
||||
Dim oSyncedUsers As New List(Of ADUser)
|
||||
Dim oGroupId As Int64 = Nothing
|
||||
Dim oUsers As List(Of ADUser)
|
||||
|
||||
Dim oSQLSync As New SyncUsers.SyncUsersMSSQL(_logConfig, MSSQL)
|
||||
Dim oSyncedUsersMSSQL As List(Of ADUser)
|
||||
@@ -57,13 +60,18 @@ Public Class ActiveDirectoryInterface
|
||||
Try
|
||||
_logger.Debug("Fetching users from ActiveDirectory")
|
||||
oUsers = ListUsers(GroupName, AttributeMappings, Filter)
|
||||
|
||||
If oUsers Is Nothing Then
|
||||
_logger.Warn("ActiveDirectory query failed for group [{0}]. Sync skipped.", GroupName)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
_logger.Debug("Found {0} users", oUsers.Count)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
' Do the actual sync into MSSQL
|
||||
If MSSQL IsNot Nothing Then
|
||||
oSyncedUsersMSSQL = oSQLSync.SyncUsers(GroupName, oUsers, AttributeMappings)
|
||||
If oSyncedUsersMSSQL.Count > 0 Then
|
||||
@@ -138,88 +146,112 @@ Public Class ActiveDirectoryInterface
|
||||
Public Async Function ListUsersAsync(GroupName As String, Optional Filter As String = DEFAULT_USER_FILTER) As Task(Of List(Of ADUser))
|
||||
Return Await Task.Run(Function() ListUsers(GroupName, Filter))
|
||||
End Function
|
||||
|
||||
Public Function ListUsers(GroupName As String, AttributeMappings As List(Of AttributeMapping), Optional Filter As String = DEFAULT_USER_FILTER) As List(Of ADUser)
|
||||
Dim oUsers As New List(Of ADUser)
|
||||
For oAttempt As Integer = 1 To AD_RETRY_COUNT
|
||||
Try
|
||||
Dim oUsers As New List(Of ADUser)
|
||||
|
||||
Try
|
||||
Using oContext As New PrincipalContext(ContextType.Domain)
|
||||
Using oGroupPrincipal As GroupPrincipal = GroupPrincipal.FindByIdentity(oContext, IdentityType.Name, GroupName)
|
||||
If oGroupPrincipal Is Nothing Then
|
||||
_logger.Debug("Group {0} does not exist.", GroupName)
|
||||
Return oUsers
|
||||
End If
|
||||
Using oContext As New PrincipalContext(ContextType.Domain)
|
||||
Using oGroupPrincipal As GroupPrincipal = GroupPrincipal.FindByIdentity(oContext, IdentityType.Name, GroupName)
|
||||
If oGroupPrincipal Is Nothing Then
|
||||
_logger.Debug("Group {0} does not exist.", GroupName)
|
||||
Return oUsers
|
||||
End If
|
||||
|
||||
_logger.Debug("Listing members of Group {0}", GroupName)
|
||||
_logger.Debug("Listing members of Group {0}", GroupName)
|
||||
|
||||
Using oMembers = oGroupPrincipal.GetMembers(True)
|
||||
For Each oMember As Principal In oMembers
|
||||
Try
|
||||
If TypeOf oMember Is UserPrincipal Then
|
||||
Dim oUser As UserPrincipal = DirectCast(oMember, UserPrincipal)
|
||||
Dim oUserEx As UserPrincipalEx = UserPrincipalEx.FindByIdentity(oContext, IdentityType.SamAccountName, oUser.SamAccountName)
|
||||
Dim oCustomAttributes As New List(Of ADUser.CustomAttribute)
|
||||
Using oMembers = oGroupPrincipal.GetMembers(True)
|
||||
For Each oMember As Principal In oMembers
|
||||
Try
|
||||
If TypeOf oMember Is UserPrincipal Then
|
||||
Dim oUser As UserPrincipal = DirectCast(oMember, UserPrincipal)
|
||||
Dim oUserEx As UserPrincipalEx = UserPrincipalEx.FindByIdentity(oContext, IdentityType.SamAccountName, oUser.SamAccountName)
|
||||
Dim oCustomAttributes As New List(Of ADUser.CustomAttribute)
|
||||
|
||||
Dim oUserFound = FindUserWithFilter(oUserEx, Filter)
|
||||
Dim oUserFound = FindUserWithFilter(oUserEx, Filter)
|
||||
|
||||
If oUserFound = False Then
|
||||
_logger.Debug("User [{0}] was skipped out due to user filter.", oUserEx.SamAccountName)
|
||||
Continue For
|
||||
If oUserFound = False Then
|
||||
_logger.Debug("User [{0}] was skipped out due to user filter.", oUserEx.SamAccountName)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
If oUserEx IsNot Nothing Then
|
||||
For Each oMap As AttributeMapping In AttributeMappings
|
||||
Dim oAttributeValue = oUserEx.GetAttributeValue(oMap.AttributeName)
|
||||
|
||||
If oAttributeValue <> String.Empty Then
|
||||
oCustomAttributes.Add(New ADUser.CustomAttribute() With {
|
||||
.Name = oMap.AttributeName,
|
||||
.Value = oAttributeValue,
|
||||
.FirebirdSyskey = oMap.FirebirdSyskey,
|
||||
.MSSQLColumn = oMap.MSSQLColumn
|
||||
})
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
oUsers.Add(New ADUser With {
|
||||
.SId = oUser.Sid,
|
||||
.samAccountName = oUser.SamAccountName,
|
||||
.Middlename = oUser.MiddleName,
|
||||
.GivenName = oUser.GivenName,
|
||||
.Surname = oUser.Surname,
|
||||
.GUID = oUser.Guid,
|
||||
.Email = oUser.EmailAddress,
|
||||
.CustomAttributes = oCustomAttributes
|
||||
})
|
||||
End If
|
||||
_logger.Debug("User [{0}] passed the filter.", oUserEx.SamAccountName)
|
||||
|
||||
' TODO: Figure out why oUserEx can be nothing for certain users
|
||||
If oUserEx IsNot Nothing Then
|
||||
For Each oMap As AttributeMapping In AttributeMappings
|
||||
Dim oAttributeValue = oUserEx.GetAttributeValue(oMap.AttributeName)
|
||||
|
||||
If oAttributeValue <> String.Empty Then
|
||||
_logger.Debug("Attribute [{0}] is not empty.", oMap.AttributeName)
|
||||
|
||||
oCustomAttributes.Add(New ADUser.CustomAttribute() With {
|
||||
.Name = oMap.AttributeName,
|
||||
.Value = oAttributeValue,
|
||||
.FirebirdSyskey = oMap.FirebirdSyskey,
|
||||
.MSSQLColumn = oMap.MSSQLColumn
|
||||
})
|
||||
Else
|
||||
_logger.Debug("Attribute [{0}] is empty.", oMap.AttributeName)
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
_logger.Debug("Could not fetch CustomAttributes for user [{0}]", oUser)
|
||||
End If
|
||||
|
||||
_logger.Debug("Trying to add User [{0}] to user list", oUser)
|
||||
|
||||
Dim oNewUser As New ADUser With {
|
||||
.SId = oUser.Sid,
|
||||
.samAccountName = oUser.SamAccountName,
|
||||
.Middlename = oUser.MiddleName,
|
||||
.GivenName = oUser.GivenName,
|
||||
.Surname = oUser.Surname,
|
||||
.GUID = oUser.Guid,
|
||||
.Email = oUser.EmailAddress,
|
||||
.CustomAttributes = oCustomAttributes
|
||||
}
|
||||
|
||||
oUsers.Add(oNewUser)
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_logger.Warn("User could not be processed")
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
Catch ex As Exception
|
||||
_logger.Warn("User could not be processed")
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
Next
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
|
||||
Return oUsers
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return oUsers
|
||||
End Try
|
||||
Return oUsers
|
||||
Catch ex As Exception
|
||||
If IsTransientAdException(ex) AndAlso oAttempt < AD_RETRY_COUNT Then
|
||||
_logger.Warn("ActiveDirectory unavailable (attempt {0}/{1}) for group [{2}]. Retrying in {3} ms.", oAttempt, AD_RETRY_COUNT, GroupName, AD_RETRY_DELAY_MS)
|
||||
Thread.Sleep(AD_RETRY_DELAY_MS)
|
||||
Continue For
|
||||
End If
|
||||
|
||||
_logger.Error(ex)
|
||||
|
||||
If IsTransientAdException(ex) Then
|
||||
_logger.Warn("ActiveDirectory unavailable after {0} attempts for group [{1}]. Returning Nothing.", AD_RETRY_COUNT, GroupName)
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Return New List(Of ADUser)
|
||||
End Try
|
||||
Next
|
||||
|
||||
Return Nothing
|
||||
End Function
|
||||
Private Function IsTransientAdException(ex As Exception) As Boolean
|
||||
Dim oCurrent = ex
|
||||
|
||||
While oCurrent IsNot Nothing
|
||||
If TypeOf oCurrent Is COMException Then
|
||||
Dim oComEx = DirectCast(oCurrent, COMException)
|
||||
If oComEx.ErrorCode = LDAP_SERVER_NOT_OPERATIONAL Then
|
||||
Return True
|
||||
End If
|
||||
End If
|
||||
|
||||
If oCurrent.Message IsNot Nothing AndAlso oCurrent.Message.IndexOf("The server is not operational", StringComparison.OrdinalIgnoreCase) >= 0 Then
|
||||
Return True
|
||||
End If
|
||||
|
||||
oCurrent = oCurrent.InnerException
|
||||
End While
|
||||
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Private Function GetPartFromFirstOU(dnString As String) As String
|
||||
Dim keyword As String = "OU="
|
||||
Dim index As Integer = dnString.IndexOf(keyword)
|
||||
|
||||
@@ -26,6 +26,11 @@ Namespace SyncUsers
|
||||
Dim oCreatedUsers As New List(Of ADUser)
|
||||
Dim oUpdatedUsers As New List(Of ADUser)
|
||||
|
||||
If Users Is Nothing Then
|
||||
_logger.Warn("SyncUsers aborted: Users is Nothing. Skipping sync and delete step for group [{0}].", GroupName)
|
||||
Return oSyncedUsers
|
||||
End If
|
||||
|
||||
Try
|
||||
_logger.Debug("Getting group Id for group {0}", GroupName)
|
||||
oGroupId = GetGroupId(GroupName)
|
||||
@@ -45,7 +50,6 @@ Namespace SyncUsers
|
||||
Dim oUserId As Long
|
||||
Dim oUserExists As Boolean
|
||||
|
||||
' Check if user already exists
|
||||
Try
|
||||
_logger.Debug("Checking if user [{0}] exists", oUser)
|
||||
oUserId = GetUserId(oUser.samAccountName)
|
||||
@@ -57,38 +61,32 @@ Namespace SyncUsers
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
' Collect user ids from existing users
|
||||
If oUserExists Then
|
||||
oSyncedUserIds.Add(oUserId)
|
||||
End If
|
||||
|
||||
' Create or update user
|
||||
Try
|
||||
If Not oUserExists Then
|
||||
_logger.Debug("Creating new user for [{0}]", oUser)
|
||||
oUserId = CreateUser(oUser)
|
||||
_logger.Debug("User created with Id [{0}]", oUserId)
|
||||
_logger.Info("Added new User [{0}]", oUser)
|
||||
|
||||
oCreatedUsers.Add(oUser)
|
||||
Else
|
||||
_logger.Debug("Updating user [{0}]", oUser)
|
||||
oUserId = UpdateUser(oUser)
|
||||
If oUserId <> 0 Then
|
||||
_logger.Debug("User created with Id [{0}]", oUserId)
|
||||
_logger.Debug("User updated with Id [{0}]", oUserId)
|
||||
_logger.Info("Updated User [{0}]", oUser)
|
||||
|
||||
oUpdatedUsers.Add(oUser)
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_logger.Warn("Could Not create/update user [{0}]. Skipping.", oUser)
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
' Add custom attributes to user
|
||||
If oUserId > 0 Then
|
||||
oSyncedUserIds.Add(oUserId)
|
||||
End If
|
||||
|
||||
Try
|
||||
AddCustomAttributesToUser(oUser, oUserId)
|
||||
Catch ex As Exception
|
||||
@@ -96,7 +94,6 @@ Namespace SyncUsers
|
||||
_logger.Debug("Could Not add custom attributes to user {0}. Continuing.", oUser)
|
||||
End Try
|
||||
|
||||
' Add the user to group
|
||||
Try
|
||||
If AddUserToGroup(oUserId, oGroupId) Then
|
||||
_logger.Info("User [{0}] added to group [{1}]", oUser, GroupName)
|
||||
@@ -110,26 +107,33 @@ Namespace SyncUsers
|
||||
oSyncedUsers.Add(oUser)
|
||||
Next
|
||||
|
||||
' Delete users that are assigned to the group but no longer exist in active directory
|
||||
Dim oUserIdString = String.Join(",", oSyncedUserIds)
|
||||
If oSyncedUserIds.Count = 0 Then
|
||||
_logger.Info("Group {0} does not contain any users.", GroupName)
|
||||
oUserIdString = 0
|
||||
' Safety: never delete relations on empty source result
|
||||
If Users.Count = 0 Then
|
||||
_logger.Warn("Safety stop: AD returned 0 users for group [{0}]. Delete step skipped.", GroupName)
|
||||
Return oSyncedUsers
|
||||
End If
|
||||
Dim oSQL As String = $"DELETE FROM TBDD_GROUPS_USER WHERE USER_ID NOT IN ({oUserIdString}) AND GROUP_ID = {oGroupId}"
|
||||
Dim oDeletedRelations = _mssql.GetScalarValue(oSQL)
|
||||
|
||||
If oSyncedUserIds.Count > 0 Then
|
||||
Dim oUserIdString = String.Join(",", oSyncedUserIds.Distinct())
|
||||
Dim oSQL As String = $"DELETE FROM TBDD_GROUPS_USER WHERE USER_ID NOT IN ({oUserIdString}) AND GROUP_ID = {oGroupId}"
|
||||
Dim oDeleteResult = _mssql.ExecuteNonQuery(oSQL)
|
||||
|
||||
If oDeleteResult Then
|
||||
_logger.Info("User-group relations cleanup executed for group [{0}].", GroupName)
|
||||
Else
|
||||
_logger.Warn("User-group relations cleanup failed for group [{0}].", GroupName)
|
||||
End If
|
||||
Else
|
||||
_logger.Warn("Safety stop: No synced user IDs collected for group [{0}]. Delete step skipped.", GroupName)
|
||||
End If
|
||||
|
||||
If oCreatedUsers.Count > 0 Then
|
||||
_logger.Info("Created [{0}] new users", oCreatedUsers.Count)
|
||||
End If
|
||||
_logger.Info("Updated [{0}] users", oUpdatedUsers.Count)
|
||||
If oDeletedRelations > 0 Then
|
||||
_logger.Info("Removed [{0}] users from Group [{1}]", oDeletedRelations, GroupName)
|
||||
End If
|
||||
|
||||
|
||||
Return oSyncedUsers
|
||||
End Function
|
||||
|
||||
Private Function AddUserToGroup(UserId As Integer, GroupId As Integer) As Boolean Implements ISyncUsers.AddUserToGroup
|
||||
Try
|
||||
Dim oSQL = $"SELECT COUNT(*) FROM TBDD_GROUPS_USER WHERE USER_ID = {UserId} And GROUP_ID = {GroupId}"
|
||||
|
||||
@@ -265,6 +265,7 @@
|
||||
<Compile Include="GrapQLInterface\LoginData.vb" />
|
||||
<Compile Include="GrapQLInterface\LogoutData.vb" />
|
||||
<Compile Include="GrapQLInterface\QueryData.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\ebInterface6.1\InvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Enums\ErrorCodes.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Enums\Item_Types.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Exceptions.vb" />
|
||||
@@ -300,6 +301,7 @@
|
||||
<Compile Include="ZUGFeRDInterface\Version2.3_3_FacturX\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.3_FacturX\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.4_FacturX\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.5_2_FacturX\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\Version2.5_FacturX\CrossIndustryInvoiceType.vb" />
|
||||
<Compile Include="ZUGFeRDInterface\XmlItemProperty.vb" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Interfaces")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2026")>
|
||||
<Assembly: AssemblyTrademark("2.4.5.0")>
|
||||
<Assembly: AssemblyTrademark("2.5.2.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.4.5.0")>
|
||||
<Assembly: AssemblyFileVersion("2.4.5.0")>
|
||||
<Assembly: AssemblyVersion("2.5.2.0")>
|
||||
<Assembly: AssemblyFileVersion("2.5.2.0")>
|
||||
|
||||
@@ -3,6 +3,7 @@ Imports System.Xml
|
||||
Imports System.Xml.Serialization
|
||||
Imports DigitalData.Modules.Interfaces.Exceptions
|
||||
Imports DigitalData.Modules.Interfaces.PDFEmbeds
|
||||
Imports DigitalData.Modules.Interfaces.PropertyValues
|
||||
Imports DigitalData.Modules.Interfaces.ZUGFeRD
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
@@ -21,8 +22,6 @@ Public Class ZUGFeRDInterface
|
||||
Public Const ZUGFERD_SPEC_2x = "ZUGFERD_2x"
|
||||
Public Const ZUGFERD_SPEC_2_3x = "ZUGFERD_2_3x"
|
||||
|
||||
Public Const UBL_SPEC_21 = "UBL_21"
|
||||
|
||||
Public Const XMLSCHEMA_ZUGFERD_10 = "Version1_0"
|
||||
Public Const XMLSCHEMA_ZUGFERD_20 = "Version2_0"
|
||||
Public Const XMLSCHEMA_ZUGFERD_211 = "Version2_1_1"
|
||||
@@ -31,9 +30,15 @@ Public Class ZUGFeRDInterface
|
||||
Public Const XMLSCHEMA_ZUGFERD_233 = "Version2_3_3_FacturX"
|
||||
Public Const XMLSCHEMA_ZUGFERD_24 = "Version2_4_FacturX"
|
||||
Public Const XMLSCHEMA_ZUGFERD_25 = "Version2_5_FacturX"
|
||||
Public Const XMLSCHEMA_ZUGFERD_252 = "Version2_5_2_FacturX"
|
||||
|
||||
Public Const UBL_SPEC_21 = "UBL_21"
|
||||
Public Const XMLSCHEMA_UBL_21_INVOICE = "UBL2_1_INVOICE"
|
||||
Public Const XMLSCHEMA_UBL_21_CREDITNOTE = "UBL2_1_CREDITNOTE"
|
||||
|
||||
Public Const EBINTERFACE_SPEC_61 = "EBINTERFACE_61"
|
||||
Public Const XMLSCHEMA_EBINTERFACE_61 = "Version6_1"
|
||||
|
||||
Public Const RECEIPT_TYPE_XML = "XML"
|
||||
Public Const RECEIPT_TYPE_PDF = "PDF"
|
||||
|
||||
@@ -63,10 +68,11 @@ Public Class ZUGFeRDInterface
|
||||
Public Class ZugferdOptions
|
||||
Public Property AllowFacturX_Filename As Boolean = True
|
||||
Public Property AllowXRechnung_Filename As Boolean = True
|
||||
Public Property AllowZugferd_1_0_Schema As Boolean = True
|
||||
Public Property AllowZugferd_2_x_Schema As Boolean = True
|
||||
Public Property AllowZugferd_2_3_x_Schema As Boolean = True
|
||||
Public Property AllowZugferd_1_0_Schema As Boolean = False
|
||||
Public Property AllowZugferd_2_x_Schema As Boolean = False
|
||||
Public Property AllowZugferd_2_3_x_Schema As Boolean = False
|
||||
Public Property AllowPeppol_3_x_Schema As Boolean = False
|
||||
Public Property AllowEBInterface_Schema As Boolean = False
|
||||
End Class
|
||||
|
||||
Public Class ZugferdResult
|
||||
@@ -105,6 +111,7 @@ Public Class ZUGFeRDInterface
|
||||
_Options = New ZugferdOptions()
|
||||
Else
|
||||
_Options = pOptions
|
||||
LogSpecificationOptions(_Options)
|
||||
End If
|
||||
|
||||
ApplyFilenameOptions(_Options)
|
||||
@@ -121,6 +128,16 @@ Public Class ZUGFeRDInterface
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub LogSpecificationOptions(options As ZugferdOptions)
|
||||
_logger.Debug("AllowFacturX_Filename has Value [{0}]",options.AllowFacturX_Filename)
|
||||
_logger.Debug("AllowXRechnung_Filename has Value [{0}]",options.AllowXRechnung_Filename)
|
||||
_logger.Debug("AllowZugferd_1_0_Schema has Value [{0}]",options.AllowZugferd_1_0_Schema)
|
||||
_logger.Debug("AllowZugferd_2_x_Schema has Value [{0}]",options.AllowZugferd_2_x_Schema)
|
||||
_logger.Debug("AllowZugferd_2_3_x_Schema has Value [{0}]",options.AllowZugferd_2_3_x_Schema)
|
||||
_logger.Debug("AllowPeppol_3_x_Schema has Value [{0}]",options.AllowPeppol_3_x_Schema)
|
||||
_logger.Debug("AllowEBInterface_Schema has Value [{0}]", options.AllowEBInterface_Schema)
|
||||
End Sub
|
||||
|
||||
Private Sub ApplyFilenameOptions(pOptions As ZugferdOptions)
|
||||
Dim oAllowedFilenames As List(Of String) = ValidFilenames
|
||||
|
||||
@@ -152,6 +169,20 @@ Public Class ZUGFeRDInterface
|
||||
Where(Function(kv) kv.Specification = pSpecification Or kv.Specification = ZUGFERD_SPEC_DEFAULT).
|
||||
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
ElseIf pSpecification = EBINTERFACE_SPEC_61 Then
|
||||
|
||||
Try
|
||||
' root-Elemente werden hier herausgefiltert
|
||||
Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification And Not x.XMLPath.StartsWith("root.")).Count
|
||||
_logger.Debug("Property map list contains [{0}] elements for specification [{1}]", countElements, pSpecification)
|
||||
|
||||
Return pPropertyMapList.
|
||||
Where(Function(kv) kv.Specification = pSpecification And Not kv.XMLPath.StartsWith("root.")).
|
||||
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
@@ -174,6 +205,27 @@ Public Class ZUGFeRDInterface
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
Public Function FilterRootPropertyMap(pPropertyMapList As List(Of XmlItemProperty), pSpecification As String) As Dictionary(Of String, XmlItemProperty)
|
||||
|
||||
' Aktuell verwendet nur ebeInterafce attribute im root-Knoten
|
||||
If pSpecification = EBINTERFACE_SPEC_61 Then
|
||||
Try
|
||||
' root-Elemente werden hier herausgefiltert
|
||||
Dim countElements As Integer = pPropertyMapList.Where(Function(x) x.Specification = pSpecification And x.XMLPath.StartsWith("root.")).Count
|
||||
_logger.Debug("Property map list contains [{0}] root attribute elements for specification [{1}]", countElements, pSpecification)
|
||||
|
||||
Return pPropertyMapList.
|
||||
Where(Function(kv) kv.Specification = pSpecification And kv.XMLPath.StartsWith("root.")).
|
||||
ToDictionary(Function(kv) kv.XMLPath, Function(kv) kv)
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
End If
|
||||
|
||||
Return Nothing
|
||||
End Function
|
||||
|
||||
Public Function GetSerializedXMLContentFromFile(oFileInfo As FileInfo) As ZugferdResult
|
||||
Dim oResult = New ZugferdResult()
|
||||
Dim oMessage As String = String.Empty
|
||||
@@ -194,6 +246,14 @@ Public Class ZUGFeRDInterface
|
||||
}
|
||||
End Using
|
||||
|
||||
oResult = _Validator.ValidateZUGFeRDDocument(oResult)
|
||||
|
||||
If oResult.ValidationErrors.Count > 0 Then
|
||||
_logger.Warn($"XML-Logik - Nach Validator() Errors: {oResult.ValidationErrors.Count}")
|
||||
Else
|
||||
_logger.Info($"XML-Logik - Nach Validator() NO Errors.")
|
||||
End If
|
||||
|
||||
Catch ex As ZUGFeRDExecption
|
||||
' Don't log ZUGFeRD Exceptions here, they should be handled by the calling code.
|
||||
' It also produces misleading error messages when checking if an attachment is a zugferd file.
|
||||
@@ -409,6 +469,11 @@ Public Class ZUGFeRDInterface
|
||||
'' Reihenfolge ab 2.3 geändert. Neuste Version immer zuerst bzw. oben
|
||||
If _Options.AllowZugferd_2_3_x_Schema Then
|
||||
oAllowedTypes.AddRange(New List(Of AllowedType) From {
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_5_2_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2_3x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_252
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_5_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2_3x,
|
||||
@@ -447,6 +512,16 @@ Public Class ZUGFeRDInterface
|
||||
})
|
||||
End If
|
||||
|
||||
If _Options.AllowEBInterface_Schema Then
|
||||
oAllowedTypes.AddRange(New List(Of AllowedType) From {
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(EBINTERFACE_61.InvoiceType),
|
||||
.Specification = EBINTERFACE_SPEC_61,
|
||||
.XMLSchema = XMLSCHEMA_EBINTERFACE_61
|
||||
}
|
||||
})
|
||||
End If
|
||||
|
||||
For Each oType In oAllowedTypes
|
||||
Dim oTypeName As String = oType.SchemaType.FullName
|
||||
Dim oSerializer As New XmlSerializer(oType.SchemaType)
|
||||
@@ -489,4 +564,5 @@ Public Class ZUGFeRDInterface
|
||||
Throw New ZUGFeRDExecption(ErrorCodes.UnsupportedFerdException, oMessage)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
Public Enum Item_Types
|
||||
StringType '0
|
||||
DateType '1
|
||||
MoneyType '2
|
||||
FileType '3
|
||||
ListType '4 - vgl. Währung
|
||||
StringType = 0 '0
|
||||
DateType = 1 '1
|
||||
MoneyType = 2 '2
|
||||
FileType = 3 '3
|
||||
ListType = 4 '4 - vgl. Währung
|
||||
|
||||
End Enum
|
||||
|
||||
@@ -205,7 +205,8 @@ Public Class PDFEmbeds
|
||||
End If
|
||||
Else
|
||||
Logger.Error("An error occurred getting the file name for [{0}]. Status: {1}", oFileName, GDPicturePDF.GetStat().ToString())
|
||||
Continue For
|
||||
Dim oMessage = String.Format("An error occurred getting the file name for [{0}]. Status: {1}", oFileName, GDPicturePDF.GetStat().ToString())
|
||||
Throw New ApplicationException(oMessage)
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
Imports System.Globalization
|
||||
Imports System.Reflection
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports System.Xml
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture.Internal.MSOfficeBinary.translator.Spreadsheet.XlsFileFormat.Records
|
||||
Imports GdPicture.Internal.MSOfficeBinary.translator.Tools
|
||||
|
||||
Public Class PropertyValues
|
||||
Private _logger As Logger
|
||||
@@ -122,12 +125,13 @@ Public Class PropertyValues
|
||||
' Returns nothing if oColumn.Value contains an empty list
|
||||
Dim oPropertyValue = oColumn.Value.ElementAtOrDefault(oRowIndex)
|
||||
|
||||
_logger.Debug("Processing itemColumn *TableColumn* [{0}].", oTableColumn)
|
||||
If oTableColumn = "INVOICE_SELLER_EMAIL" Then
|
||||
Console.WriteLine("INVOICE_SELLER_EMAIL")
|
||||
ElseIf oTableColumn = "INVOICE_POSITION_ARTICLE" Then
|
||||
Console.WriteLine("INVOICE_POSITION_ARTICLE")
|
||||
End If
|
||||
'_logger.Debug("Processing itemColumn *TableColumn* [{0}].", oTableColumn)
|
||||
'If oTableColumn = "INVOICE_SELLER_EMAIL" Then
|
||||
' Console.WriteLine("INVOICE_SELLER_EMAIL")
|
||||
'ElseIf oTableColumn = "INVOICE_POSITION_ARTICLE" Then
|
||||
' Console.WriteLine("INVOICE_POSITION_ARTICLE")
|
||||
'End If
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oColumn.Key.IsRequired Then
|
||||
_logger.Warn($"{MessageId} - oPropertyValue for column [{oTableColumn}] is empty or not found but is required. Continuing with Empty String.")
|
||||
@@ -154,7 +158,11 @@ Public Class PropertyValues
|
||||
|
||||
End If
|
||||
|
||||
If oTableColumn = "INVOICE_CURRENCY" Or oItemType = 4 Then
|
||||
If oItemType = Item_Types.MoneyType Then
|
||||
oPropertyValue = GetFormattedDecimalValue(oPropertyValue)
|
||||
End If
|
||||
|
||||
If oTableColumn = "INVOICE_CURRENCY" Or oItemType = Item_Types.ListType Then
|
||||
Dim oValuestring = oPropertyValue.ToString()
|
||||
|
||||
' Bei Listenelementen entfernen wir den String Item, um den Wert zu erhalten
|
||||
@@ -218,9 +226,15 @@ Public Class PropertyValues
|
||||
|
||||
' This should hopefully show config errors
|
||||
If TypeOf oPropertyValue Is List(Of Object) Then
|
||||
_logger.Warn("Item with specification [{0}] may be configured incorrectly", oTableColumn)
|
||||
_logger.Warn("Item [{0}] may be configured incorrectly", oTableColumn)
|
||||
oPropertyValue = Nothing
|
||||
End If
|
||||
|
||||
If IsComplexeObject(oPropertyValue) = True Then
|
||||
_logger.Debug("Item Value [{0}] is complexe. cant be used.", oTableColumn)
|
||||
oPropertyValue = Nothing
|
||||
End If
|
||||
|
||||
End Select
|
||||
End If
|
||||
Catch ex As Exception
|
||||
@@ -247,8 +261,12 @@ Public Class PropertyValues
|
||||
End If
|
||||
End If
|
||||
|
||||
If oItemType = Item_Types.MoneyType Then
|
||||
oPropertyValue = GetFormattedDecimalValue(oPropertyValue)
|
||||
End If
|
||||
|
||||
' Statt dem Zahlenwert des Enums, wollen wir die Währungsbezeichnung
|
||||
If oTableColumn = "INVOICE_CURRENCY" Or oItemType = 4 Then
|
||||
If oTableColumn = "INVOICE_CURRENCY" Or oItemType = Item_Types.ListType Then
|
||||
Dim oValuestring = oPropertyValue.ToString()
|
||||
|
||||
' Bei Listenelementen entfernen wir den String Item, um den Wert zu erhalten
|
||||
@@ -275,6 +293,167 @@ Public Class PropertyValues
|
||||
Return oResult
|
||||
End Function
|
||||
|
||||
Private Function GetFormattedDecimalValue(pPropertyValue As Object) As Object
|
||||
' wir versuchen den gefundenen Wert in einen decimal mit 2 Nachommastellen umzuwandeln
|
||||
' Eingaben können mit . oder mit , als Dezimal-Trenner kommen: 19.00 = 19,00
|
||||
|
||||
If IsNothing(pPropertyValue) OrElse String.IsNullOrEmpty(pPropertyValue) Then
|
||||
Return String.Empty
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim stringValue = pPropertyValue.ToString()
|
||||
|
||||
Dim deCulture As New CultureInfo("de-DE")
|
||||
Dim usCulture As New CultureInfo("en-US")
|
||||
Dim decimalValue As Decimal
|
||||
|
||||
If stringValue.Contains(".") AndAlso Not stringValue.Contains(",") Then
|
||||
' Wir wandeln mit en-US um
|
||||
If Decimal.TryParse(pPropertyValue, NumberStyles.Any, usCulture, decimalValue) Then
|
||||
decimalValue = Math.Round(decimalValue, 2)
|
||||
pPropertyValue = decimalValue.ToString("F2", CultureInfo.InvariantCulture)
|
||||
End If
|
||||
|
||||
ElseIf stringValue.Contains(",") AndAlso Not stringValue.Contains(".") Then
|
||||
' Wir wandeln mit de-DE um, wenn Komma als Trennzeichen enthalten ist
|
||||
If Decimal.TryParse(pPropertyValue, NumberStyles.Any, deCulture, decimalValue) Then
|
||||
decimalValue = Math.Round(decimalValue, 2)
|
||||
pPropertyValue = decimalValue.ToString("F2", CultureInfo.InvariantCulture)
|
||||
End If
|
||||
|
||||
ElseIf Not stringValue.Contains(",") AndAlso Not stringValue.Contains(".") Then
|
||||
' Wir wandeln mit en-US um, wenn KEIN Trennzeichen enthalten ist
|
||||
If Decimal.TryParse(pPropertyValue, NumberStyles.Any, usCulture, decimalValue) Then
|
||||
decimalValue = Math.Round(decimalValue, 2)
|
||||
pPropertyValue = decimalValue.ToString("F2", CultureInfo.InvariantCulture)
|
||||
End If
|
||||
End If
|
||||
|
||||
Return pPropertyValue
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Public Function CheckRootAttributeValues(pDocument As Object, pPropertyMap As Dictionary(Of String, XmlItemProperty), pMessageId As String, pCheckResult As CheckPropertyValuesResult) As CheckPropertyValuesResult
|
||||
|
||||
If pPropertyMap Is Nothing Then
|
||||
Return pCheckResult
|
||||
End If
|
||||
|
||||
' PropertyMap items with `IsGrouped = False` are handled normally
|
||||
Dim oRootAttributeProperties As Dictionary(Of String, XmlItemProperty) = pPropertyMap.
|
||||
ToDictionary(Function(Item) Item.Key,
|
||||
Function(Item) Item.Value)
|
||||
|
||||
For Each oItem As KeyValuePair(Of String, XmlItemProperty) In oRootAttributeProperties
|
||||
Dim oTableColumn As String = oItem.Value.TableColumn
|
||||
Dim oPropertyDescription As String = oItem.Value.Description
|
||||
Dim oPropertyPath As String = oItem.Value.XMLPath
|
||||
Dim oPropertyValue As Object = Nothing
|
||||
Dim oTableName = oItem.Value.TableName
|
||||
Dim oIsRequired = oItem.Value.IsRequired
|
||||
Dim oDescription = oItem.Value.Description
|
||||
Dim oItemType = oItem.Value.ItemType
|
||||
Dim oEN16931_ID = oItem.Value.EN16931_ID
|
||||
|
||||
Try
|
||||
oPropertyValue = GetRootAttributeValue(pDocument, oItem.Key)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
oPropertyValue = Nothing
|
||||
End Try
|
||||
|
||||
If IsNothing(oPropertyValue) OrElse String.IsNullOrEmpty(oPropertyValue) Then
|
||||
If oItem.Value.IsRequired Then
|
||||
_logger.Warn("Column [{0}] is empty, but marked as required! Adding MissingProperty.", oTableColumn)
|
||||
Dim oMissingProperty = New MissingProperty With
|
||||
{
|
||||
.EN16931_ID = oEN16931_ID,
|
||||
.Description = oPropertyDescription,
|
||||
.XMLPath = oPropertyPath
|
||||
}
|
||||
pCheckResult.MissingProperties.Add(oMissingProperty)
|
||||
Continue For
|
||||
Else
|
||||
_logger.Debug("oPropertyValue for Column [{0}] is empty or not found. Skipping.", oTableColumn)
|
||||
Continue For
|
||||
End If
|
||||
End If
|
||||
|
||||
If pDocument.Specification = "EBINTERFACE_61" Then
|
||||
|
||||
' ebInterface DocumentType in UNTDID 1001 — Document type
|
||||
If oTableColumn = "INVOICE_TYPE" Then
|
||||
oPropertyValue = GetUNTDID1001_DocumentType(oPropertyValue)
|
||||
_logger.Debug("oPropertyValue for Column [{0}] in EBINTERFACE_61 with value [{1}] ", oTableColumn, oPropertyValue)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
pCheckResult.ValidProperties.Add(New ValidProperty() With {
|
||||
.MessageId = pMessageId,
|
||||
.Description = oPropertyDescription,
|
||||
.Value = oPropertyValue,
|
||||
.GroupCounter = 0,
|
||||
.TableName = oTableName,
|
||||
.TableColumn = oTableColumn,
|
||||
.IsRequired = oIsRequired,
|
||||
.XMLPath = oPropertyPath,
|
||||
.ItemType = oItemType,
|
||||
.EN16931_ID = oEN16931_ID
|
||||
})
|
||||
|
||||
Next
|
||||
|
||||
Return pCheckResult
|
||||
End Function
|
||||
|
||||
Private Function GetUNTDID1001_DocumentType(oPropertyValue As String) As String
|
||||
|
||||
Select Case oPropertyValue
|
||||
Case "CreditMemo"
|
||||
Return 381 ' Credit note
|
||||
Case "FinalSettlement"
|
||||
Return 877 ' Final construction invoice
|
||||
Case "Invoice"
|
||||
Return 380 ' Commercial invoice
|
||||
Case "InvoiceForAdvancePayment"
|
||||
Return 386 ' Prepayment invoice
|
||||
Case "InvoiceForPartialDelivery"
|
||||
Return 381 ' Partial invoice
|
||||
Case "SelfBilling"
|
||||
Return 261 ' Self billed credit note
|
||||
Case "SubsequentCredit"
|
||||
Return 83 ' Credit note related to financial adjustments
|
||||
Case "SubsequentDebit"
|
||||
Return 84 ' Debit note related to financial adjustments
|
||||
Case Else
|
||||
Return 0
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
Private Function GetRootAttributeValue(pDocument As Object, pXmlPath As String) As String
|
||||
If pDocument.XElementObject Is Nothing Then
|
||||
Return Nothing
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim attributeName As String = pXmlPath.Replace("root.", "")
|
||||
Dim attributeValue As String = pDocument.XElementObject.Attribute(attributeName).Value
|
||||
Return attributeValue
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
Return Nothing
|
||||
End Try
|
||||
|
||||
End Function
|
||||
|
||||
Public Function GetPropValue(Obj As Object, PropertyName As String) As List(Of Object)
|
||||
Dim oNameParts As String() = PropertyName.Split("."c)
|
||||
|
||||
@@ -421,8 +600,21 @@ Public Class PropertyValues
|
||||
firstElement = oList.FirstOrDefault()
|
||||
If firstElement IsNot Nothing AndAlso IsArray(firstElement) Then
|
||||
|
||||
' Attachments sind Byte-Arrays und müssen umgewandelt werden
|
||||
Return Convert.ToBase64String(firstElement)
|
||||
Dim oStr As String
|
||||
' Array behandeln -> erstes Element nehmen
|
||||
If TypeOf firstElement Is String() Then
|
||||
Dim arr As String() = CType(firstElement, String())
|
||||
oStr = If(arr.Length > 0, arr(0), String.Empty)
|
||||
Else
|
||||
oStr = firstElement.ToString()
|
||||
End If
|
||||
|
||||
If IsBase64String(oStr) Then
|
||||
' Attachments sind Byte-Arrays und müssen umgewandelt werden
|
||||
Return Convert.ToBase64String(firstElement)
|
||||
Else
|
||||
Return oStr
|
||||
End If
|
||||
|
||||
Else
|
||||
Return DoGetFinalPropValue(oList.First())
|
||||
@@ -464,4 +656,40 @@ Public Class PropertyValues
|
||||
Return Regex.IsMatch(Prop, _indexPattern)
|
||||
End Function
|
||||
|
||||
Private Function IsComplexeObject(obj As Object) As Boolean
|
||||
If obj Is Nothing Then Return False
|
||||
|
||||
Dim t As Type = obj.GetType()
|
||||
|
||||
' Einfache Typen ausschließen
|
||||
If t.IsPrimitive OrElse
|
||||
t.IsEnum OrElse
|
||||
t Is GetType(String) OrElse
|
||||
t Is GetType(Decimal) OrElse
|
||||
t Is GetType(DateTime) Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
' Wenn es öffentliche Properties hat, ist es "komplex"
|
||||
Return t.GetProperties().Length > 0 OrElse t.IsClass
|
||||
End Function
|
||||
|
||||
Function IsBase64String(str As String) As Boolean
|
||||
If String.IsNullOrEmpty(str) Then Return False
|
||||
|
||||
' Base64 hat bestimmte Zeichen und meist Länge Vielfaches von 4
|
||||
If str.Length Mod 4 <> 0 Then Return False
|
||||
|
||||
' Regex-Check für gültige Base64-Zeichen
|
||||
If Not System.Text.RegularExpressions.Regex.IsMatch(str, "^[A-Za-z0-9+/]*={0,2}$") Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim bytes As Byte() = Convert.FromBase64String(str)
|
||||
Return True
|
||||
Catch ex As FormatException
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -26,6 +26,7 @@ Public Class Validator
|
||||
For Each oNode As XElement In oDecimalNodes
|
||||
Dim oParsedValue As Decimal = 0.0
|
||||
If Decimal.TryParse(oNode.Value, oParsedValue) = False Then
|
||||
_logger.Warn($"Invalid Decimal Value in {oNode.Name.LocalName}")
|
||||
pResult.ValidationErrors.Add(New ZugferdValidationError() With {
|
||||
.ElementName = oNode.Name.LocalName,
|
||||
.ElementValue = oNode.Value,
|
||||
@@ -50,6 +51,8 @@ Public Class Validator
|
||||
For Each oNode As XElement In oCurrencyCodeNodes
|
||||
Dim oValid = ValidateCurrencyCode(oNode.Value)
|
||||
If oValid = False Then
|
||||
_logger.Warn($"Invalid CurrencyCode in {oNode.Name.LocalName}")
|
||||
|
||||
pResult.ValidationErrors.Add(New ZugferdValidationError() With {
|
||||
.ElementName = oNode.Name.LocalName,
|
||||
.ElementValue = oNode.Value,
|
||||
@@ -78,6 +81,7 @@ Public Class Validator
|
||||
|
||||
Dim oValid = ValidateCurrencyCode(oCurrencyID)
|
||||
If oValid = False Then
|
||||
_logger.Warn($"Invalid CurrencyID in {oNode.Name.LocalName}")
|
||||
pResult.ValidationErrors.Add(New ZugferdValidationError() With {
|
||||
.ElementName = oNode.Name.LocalName,
|
||||
.ElementValue = oCurrencyID,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
3373
Interfaces/ZUGFeRDInterface/ebInterface6.1/InvoiceType.vb
Normal file
3373
Interfaces/ZUGFeRDInterface/ebInterface6.1/InvoiceType.vb
Normal file
File diff suppressed because it is too large
Load Diff
@@ -12,7 +12,7 @@ Public Class ADSyncJob
|
||||
MyBase.New(LogConfig, MSSQL)
|
||||
End Sub
|
||||
|
||||
Public Sub Start(Arguments As ADSyncArgs) Implements IJob(Of ADSyncArgs).Start
|
||||
Public Sub Start(Arguments As ADSyncArgs) Implements IJob(Of ADSyncArgs).StartDexAPISQL
|
||||
Dim oJobName As String = [GetType]().Name
|
||||
|
||||
Try
|
||||
|
||||
@@ -5,7 +5,7 @@ Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class DEX_APIJob
|
||||
Public Class API_DEXSQLJob
|
||||
Inherits JobBase
|
||||
Implements IJob(Of APISQLArgs)
|
||||
|
||||
@@ -13,7 +13,7 @@ Public Class DEX_APIJob
|
||||
MyBase.New(LogConfig, MSSQL)
|
||||
End Sub
|
||||
|
||||
Public Sub StartDex_API(Arguments As APISQLArgs) Implements IJob(Of APISQLArgs).Start
|
||||
Public Sub StartDexAPISQL(Arguments As APISQLArgs) Implements IJob(Of APISQLArgs).StartDexAPISQL
|
||||
Dim oJobName As String = [GetType]().Name
|
||||
|
||||
Try
|
||||
@@ -21,7 +21,7 @@ Public Class GraphQLJob
|
||||
MyBase.New(LogConfig, MSSQL)
|
||||
End Sub
|
||||
|
||||
Public Sub Start(Args As GraphQLArgs) Implements IJob(Of GraphQLArgs).Start
|
||||
Public Sub Start(Args As GraphQLArgs) Implements IJob(Of GraphQLArgs).StartDexAPISQL
|
||||
Try
|
||||
Dim oConfigPath As String = Args.QueryConfigPath
|
||||
Dim oConfigManager As New ConfigManager(Of GraphQLConfig)(_LogConfig, oConfigPath)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
End Interface
|
||||
|
||||
Public Interface IJob(Of T)
|
||||
Sub Start(Arguments As T)
|
||||
Sub StartDexAPISQL(Arguments As T)
|
||||
|
||||
Function ShouldStart(Arguments As T) As Boolean
|
||||
End Interface
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
<Compile Include="ADSync\ADSyncJob.vb" />
|
||||
<Compile Include="DEX_API\APISQLArgs.vb" />
|
||||
<Compile Include="DEX_API\APISQLConfig.vb" />
|
||||
<Compile Include="DEX_API\DEX_APIJob.vb" />
|
||||
<Compile Include="DEX_API\API_DEXSQLJob.vb" />
|
||||
<Compile Include="GraphQL\GraphQLArgs.vb" />
|
||||
<Compile Include="GraphQL\GraphQLConfig.vb" />
|
||||
<Compile Include="GraphQL\GraphQLJob.vb" />
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data")>
|
||||
<Assembly: AssemblyProduct("Modules.Jobs")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2026")>
|
||||
<Assembly: AssemblyTrademark("3.8.0")>
|
||||
<Assembly: AssemblyTrademark("3.9.1.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices
|
||||
' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
|
||||
<Assembly: AssemblyVersion("3.8.0.0")>
|
||||
<Assembly: AssemblyFileVersion("3.8.0.0")>
|
||||
<Assembly: AssemblyVersion("3.9.1.0")>
|
||||
<Assembly: AssemblyFileVersion("3.9.1.0")>
|
||||
|
||||
@@ -48,7 +48,7 @@ Namespace ZUGFeRD
|
||||
Dim intCode As Integer = DirectCast(pErrorCode, Integer)
|
||||
oErrorCode = $"{EmailStrings.ErrorCodePraefix}{intCode}"
|
||||
|
||||
Dim oSQL = $"SELECT COUNT(*) FROM TBDD_GUI_LANGUAGE_PHRASE WHERE TITLE = '{oErrorCode}'"
|
||||
Dim oSQL = $"SELECT COUNT(*) FROM TBDD_GUI_LANGUAGE_PHRASE WITH (NOLOCK) WHERE TITLE = '{oErrorCode}'"
|
||||
If _mssql.GetScalarValue(oSQL) > 0 Then
|
||||
useLegacyMethod = False
|
||||
Else
|
||||
@@ -59,7 +59,7 @@ Namespace ZUGFeRD
|
||||
' Gibt es das Template in TBDD_EMAIL_TEMPLATE?
|
||||
If useLegacyMethod = False AndAlso pTemplateId > 0 Then
|
||||
Try
|
||||
Dim oSQL = $"SELECT COUNT(*) FROM TBDD_EMAIL_TEMPLATE WHERE GUID = {pTemplateId}"
|
||||
Dim oSQL = $"SELECT COUNT(*) FROM TBDD_EMAIL_TEMPLATE WITH (NOLOCK) WHERE GUID = {pTemplateId}"
|
||||
If _mssql.GetScalarValue(oSQL) <= 0 Then
|
||||
_logger.Warn($"EMAIL_TEMPLATE [{pTemplateId}] not found in TBDD_EMAIL_TEMPLATE!")
|
||||
useLegacyMethod = True
|
||||
@@ -137,7 +137,11 @@ Namespace ZUGFeRD
|
||||
, '{pParameter2}'
|
||||
, 77"
|
||||
|
||||
_mssql.ExecuteNonQuery(oExecute, pTransaction)
|
||||
If pTransaction IsNot Nothing Then
|
||||
_mssql.ExecuteNonQuery(oExecute, pTransaction)
|
||||
Else
|
||||
_mssql.ExecuteNonQuery(oExecute)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
@@ -185,7 +189,7 @@ Namespace ZUGFeRD
|
||||
_logger.Debug("To: {0}", oEmailTo)
|
||||
_logger.Debug("Subject: {0}", oSubject)
|
||||
_logger.Debug("Body {0}", oFinalBodyText)
|
||||
Dim osql = $"Select MAX(GUID) FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{MessageId}'"
|
||||
Dim osql = $"Select MAX(GUID) FROM TBEMLP_HISTORY WITH (NOLOCK) WHERE EMAIL_MSGID = '{MessageId}'"
|
||||
Dim oHistoryID = _mssql.GetScalarValue(osql)
|
||||
|
||||
If IsNumeric(oHistoryID) Then
|
||||
@@ -223,7 +227,7 @@ Namespace ZUGFeRD
|
||||
End Sub
|
||||
|
||||
Public Function GetEmailDataForMessageId(MessageId As String) As EmailData
|
||||
Dim oSQL = $"SELECT EMAIL_FROM, EMAIL_SUBJECT FROM TBEMLP_HISTORY WHERE EMAIL_MSGID = '{MessageId}'"
|
||||
Dim oSQL = $"SELECT EMAIL_FROM, EMAIL_SUBJECT FROM TBEMLP_HISTORY WITH (NOLOCK) WHERE EMAIL_MSGID = '{MessageId}'"
|
||||
Try
|
||||
Dim oDatatable = _mssql.GetDatatable(oSQL)
|
||||
Dim oRow As DataRow
|
||||
|
||||
@@ -10,5 +10,5 @@
|
||||
FileSizeLimitReachedException = 20008
|
||||
OutOfMemoryException = 20009
|
||||
UnhandledException = 20010
|
||||
FileMoveException = 200011
|
||||
FileMoveException = 20011
|
||||
End Enum
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports System.Linq
|
||||
Imports System.Text
|
||||
Imports DigitalData.Modules.Base
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
@@ -91,7 +93,8 @@ Namespace ZUGFeRD
|
||||
' Write Embedded Files to disk
|
||||
For Each oResult In pEmbeddedAttachments
|
||||
Try
|
||||
Dim oFileName As String = $"{pMessageId}~{oResult.FileName}"
|
||||
Dim oCleanedFilename As String = BereinigeDateinamenAscii(oResult.FileName)
|
||||
Dim oFileName As String = $"{pMessageId}~{oCleanedFilename}"
|
||||
Dim oFilePath As String = Path.Combine(oAttachmentDirectory, oFileName)
|
||||
|
||||
If Not File.Exists(oAttachmentDirectory) Then
|
||||
@@ -208,6 +211,7 @@ Namespace ZUGFeRD
|
||||
Return False ' Andere Fehler
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function GetEmailPathWithSubjectAsName(RejectedEmailDirectory As String, UncleanedSubject As String) As String
|
||||
Dim oCleanSubject = String.Join("", UncleanedSubject.Split(Path.GetInvalidPathChars()))
|
||||
Dim oAttachmentDirectory = RejectedEmailDirectory
|
||||
@@ -218,6 +222,41 @@ Namespace ZUGFeRD
|
||||
|
||||
Return oAttachmentPath
|
||||
End Function
|
||||
|
||||
''' <summary>
|
||||
''' 20.8.2026 - In den Dateinamen der Anhänge in einem PDF können Unicode-Zeichen vorkommen
|
||||
''' die später nicht mehr verarbeitet werden können. sie werden hier rausgefiltert
|
||||
''' </summary>
|
||||
''' <param name="pFilename"></param>
|
||||
''' <returns></returns>
|
||||
Function BereinigeDateinamenAscii(pFilename As String) As String
|
||||
If pFilename.IsNullOrEmpty() Then
|
||||
Return String.Empty
|
||||
End If
|
||||
|
||||
' Restliche Diakritika entfernen (é, à, ñ, etc.)
|
||||
Dim normalisiert As String = pFilename.Normalize(NormalizationForm.FormD)
|
||||
Dim sb As New StringBuilder()
|
||||
|
||||
For Each c As Char In normalisiert
|
||||
If CharUnicodeInfo.GetUnicodeCategory(c) = UnicodeCategory.NonSpacingMark Then
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim code As Integer = AscW(c)
|
||||
|
||||
If code >= 32 AndAlso code <= 126 Then
|
||||
If "\/:*?""<>|".Contains(c) Then
|
||||
sb.Append("_")
|
||||
Else
|
||||
sb.Append(c)
|
||||
End If
|
||||
End If
|
||||
' Alles andere (z.B. 你好) wird komplett verworfen
|
||||
Next
|
||||
|
||||
Return sb.ToString()
|
||||
End Function
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
|
||||
@@ -33,7 +33,7 @@ Public Class HashFunctions
|
||||
End If
|
||||
|
||||
' Check if Checksum exists in History Table
|
||||
Dim oCheckCommand = $"SELECT * FROM TBEMLP_HISTORY WHERE GUID = (SELECT MAX(GUID) FROM TBEMLP_HISTORY WHERE UPPER(MD5HASH) = UPPER('{oMD5CheckSum}'))"
|
||||
Dim oCheckCommand = $"SELECT * FROM TBEMLP_HISTORY WITH (NOLOCK) WHERE GUID = (SELECT MAX(GUID) FROM TBEMLP_HISTORY WITH (NOLOCK) WHERE UPPER(MD5HASH) = UPPER('{oMD5CheckSum}'))"
|
||||
Dim oTable As DataTable = Database.GetDatatable(oCheckCommand, MSSQLServer.TransactionMode.NoTransaction)
|
||||
|
||||
' If History entries could not be fetched, just return the MD5 Checksum
|
||||
@@ -94,7 +94,7 @@ Public Class HashFunctions
|
||||
Public Function GetOriginalFilename(pFilename As String) As String
|
||||
' Try to get the original filename from Attachment table
|
||||
' If this fails, falls back to the new filename (<msgid>~Attm<i>.ext)
|
||||
Dim oSQL = $"SELECT EMAIL_ATTMT FROM TBEMLP_HISTORY_ATTACHMENT WHERE EMAIL_ATTMT_INDEX = '{pFilename}'"
|
||||
Dim oSQL = $"SELECT EMAIL_ATTMT FROM TBEMLP_HISTORY_ATTACHMENT WITH (NOLOCK) WHERE EMAIL_ATTMT_INDEX = '{pFilename}'"
|
||||
Dim oEmailAttachment = Database.GetScalarValue(oSQL, MSSQLServer.TransactionMode.NoTransaction)
|
||||
Dim oOriginalName = ObjectEx.NotNull(oEmailAttachment, pFilename)
|
||||
Return oOriginalName
|
||||
|
||||
@@ -68,6 +68,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Private ReadOnly _embeds As PDFEmbeds
|
||||
|
||||
Private SQL_xRechnung_ItemTemplate As String = ""
|
||||
Private SQL_ebInterface_CompleteXMLItems As String = ""
|
||||
|
||||
Private ReadOnly _gdpictureLicenseKey As String
|
||||
Private ReadOnly _xRechnungCreator As XRechnungViewDocument
|
||||
@@ -81,6 +82,8 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
Public ZugferdFileCount As Integer = 0
|
||||
Public MD5Checksum As String = Nothing
|
||||
Public XMLSpecification As String = Nothing
|
||||
Public XMLSchema As String = Nothing
|
||||
|
||||
Public EmailAttachmentFiles As New List(Of FileInfo)
|
||||
Public EmbeddedAttachmentFiles As New List(Of PDFEmbeds.EmbeddedFile)
|
||||
@@ -114,22 +117,31 @@ Public Class ImportZUGFeRDFiles
|
||||
Public Sub Start(Arguments As Object) Implements IJob.Start
|
||||
Dim oArgs As WorkerArgs = Arguments
|
||||
Dim oAttachmentExtractor = New PDFEmbeds(_logConfig)
|
||||
Dim oSpecification As String = String.Empty
|
||||
|
||||
_EmailOutAccountId = oArgs.EmailOutProfileId
|
||||
|
||||
_zugferd = New ZUGFeRDInterface(_logConfig, _gdpictureLicenseKey, New ZUGFeRDInterface.ZugferdOptions() With {
|
||||
.AllowFacturX_Filename = oArgs.AllowFacturX,
|
||||
.AllowXRechnung_Filename = oArgs.AllowXRechnung,
|
||||
.AllowPeppol_3_x_Schema = oArgs.AllowPeppolBISBill3x
|
||||
.AllowZugferd_1_0_Schema = oArgs.AllowZugferd10,
|
||||
.AllowZugferd_2_x_Schema = oArgs.AllowZugferd2x,
|
||||
.AllowZugferd_2_3_x_Schema = oArgs.AllowZugferd23x,
|
||||
.AllowPeppol_3_x_Schema = oArgs.AllowPeppolBISBill3x,
|
||||
.AllowEBInterface_Schema = oArgs.AllowEBInterface
|
||||
})
|
||||
|
||||
_logger.Debug("Starting Job {0}", [GetType].Name)
|
||||
If oArgs.AllowXRechnung Then
|
||||
' TODO - Config-Schalter hat NIX mit XRechnung-Dateien u. Sichtbelegen zu tun, sondern nur mit Dateinamen zu tun.
|
||||
If oArgs.AllowXRechnung Or oArgs.AllowPeppolBISBill3x Or oArgs.AllowEBInterface Then
|
||||
Dim oSQL = "SELECT SQL_COMMAND FROM TBDD_SQL_COMMANDS WITH (NOLOCK) WHERE TITLE = 'VWDD_ZUGFERD_VIEW_RECEIPT_TEMPLATE_ITEMS'"
|
||||
SQL_xRechnung_ItemTemplate = _mssql.GetScalarValue(oSQL)
|
||||
End If
|
||||
|
||||
If oArgs.AllowEBInterface Then
|
||||
Dim oSQL = "SELECT SQL_COMMAND FROM TBDD_SQL_COMMANDS WITH (NOLOCK) WHERE TITLE = 'EBINTERFACE_COMPLETE_MISSING_XML_ITEMS'"
|
||||
SQL_ebInterface_CompleteXMLItems = _mssql.GetScalarValue(oSQL)
|
||||
End If
|
||||
|
||||
Try
|
||||
'For Each oPath As String In oArgs.WatchDirectory
|
||||
Dim oPath As String = oArgs.WatchDirectory
|
||||
@@ -208,6 +220,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Try
|
||||
|
||||
For Each oFile In oEInvoiceFileGroup
|
||||
oSpecification = String.Empty
|
||||
oFileCounter += 1
|
||||
Dim oResult As ProcessFileResult
|
||||
|
||||
@@ -221,6 +234,7 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Debug("eInvoice File found")
|
||||
oMD5CheckSum = oResult.MD5Checksum
|
||||
oZUGFeRDCount = oResult.ZugferdFileCount
|
||||
oSpecification = oResult.XMLSpecification
|
||||
oEmailAttachmentFiles.AddRange(oResult.EmailAttachmentFiles)
|
||||
oEmbeddedAttachmentFiles.AddRange(oResult.EmbeddedAttachmentFiles)
|
||||
Else ' No zugferd found!
|
||||
@@ -439,21 +453,34 @@ Public Class ImportZUGFeRDFiles
|
||||
If oMoveDirectory = DIRECTORY_DONT_MOVE Then
|
||||
_logger.Info("Application Error occurred. Files for message Id {0} will not be moved.", oMessageId)
|
||||
|
||||
ElseIf oArgs.AllowXRechnung And oIsSuccess And
|
||||
ElseIf (oArgs.AllowXRechnung Or oArgs.AllowPeppolBISBill3x Or oArgs.AllowEBInterface) And oIsSuccess And
|
||||
oEInvoiceFileGroup.Item(0).Extension.Equals(".xml", StringComparison.OrdinalIgnoreCase) = True Then
|
||||
_logger.Debug("Before Creating the PDF-File from XML data / Before Commit")
|
||||
|
||||
oxRechnungHandle = True
|
||||
|
||||
If oSQLTransaction IsNot Nothing Then
|
||||
' Commit Transaction - muss ausgeführt werden, sonst sind keine Daten in der DB vorhanden
|
||||
oSQLTransaction.Commit()
|
||||
_logger.Debug("XML commit triggered")
|
||||
End If
|
||||
|
||||
' Vor der Sichtbeleg-Erzeugung, müssen ggf Daten nachberechnet werden.
|
||||
' Hier wird die Prozedur für EBINTERFACE_61 aufgerufen, falls der Beleg dieses Schema verwendet
|
||||
If oArgs.AllowEBInterface AndAlso
|
||||
String.Equals(oSpecification, "EBINTERFACE_61", StringComparison.InvariantCultureIgnoreCase) AndAlso
|
||||
Not String.IsNullOrEmpty(SQL_ebInterface_CompleteXMLItems) Then
|
||||
_logger.Debug("Before Calling ebInterface Procedure")
|
||||
Dim oSQL_MsgIDReplace_1 As String = SQL_ebInterface_CompleteXMLItems.Replace("@MSG_ID", oFileGroup.Key)
|
||||
Dim oSqlResult = _mssql.ExecuteNonQuery(oSQL_MsgIDReplace_1)
|
||||
_logger.Debug("Result of ebInterface Procedure: [{0}]", oSqlResult)
|
||||
End If
|
||||
|
||||
' Hier das neue PDF erzeugen
|
||||
'but before we need to get all Data we need
|
||||
MyTemplateValues_xInvDT = Nothing
|
||||
Dim oSQL_MsgIDReplace = SQL_xRechnung_ItemTemplate
|
||||
oSQL_MsgIDReplace = oSQL_MsgIDReplace.Replace("@MSG_ID", oFileGroup.Key)
|
||||
If oSQLTransaction IsNot Nothing Then
|
||||
' Commit Transaction
|
||||
oSQLTransaction.Commit()
|
||||
_logger.Debug("XML commit triggered")
|
||||
End If
|
||||
MyTemplateValues_xInvDT = _mssql.GetDatatable(oSQL_MsgIDReplace)
|
||||
|
||||
If Not IsNothing(MyTemplateValues_xInvDT) Then
|
||||
@@ -597,6 +624,8 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
If oDocument IsNot Nothing Then
|
||||
sqlResult = StoreXMLItemsInDatabase(pMessageId, oDocument, pFile, pConnections, pArgs, oResult)
|
||||
oResult.XMLSpecification = oDocument.Specification
|
||||
oResult.XMLSchema = oDocument.UsedXMLSchema
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
@@ -719,6 +748,10 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oPropertyMap As Dictionary(Of String, XmlItemProperty) = _zugferd.FilterPropertyMap(pArgs.PropertyMapList, pDocument.Specification)
|
||||
Dim oCheckResult = _zugferd.PropertyValues.CheckPropertyValues(pDocument.SchemaObject, oPropertyMap, pMessageId)
|
||||
|
||||
' root-Attribute falls konfiguriert auslesen, Ergebnis im oCheckResult enthalten
|
||||
Dim oRootAttributePropertyMap As Dictionary(Of String, XmlItemProperty) = _zugferd.FilterRootPropertyMap(pArgs.PropertyMapList, pDocument.Specification)
|
||||
oCheckResult = _zugferd.PropertyValues.CheckRootAttributeValues(pDocument, oRootAttributePropertyMap, pMessageId, oCheckResult)
|
||||
|
||||
_logger.Info("Properties checked: [{0}] missing properties / [{1}] valid properties found.", oCheckResult.MissingProperties.Count, oCheckResult.ValidProperties.Count)
|
||||
|
||||
If oCheckResult.MissingProperties.Count > 0 Then
|
||||
@@ -835,6 +868,7 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Error("Could not save File to Disk!")
|
||||
Dim oReasonString = "Could not save file " + newAttachmentFilename + " to disk."
|
||||
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
|
||||
nextAttachmentIndex += 1
|
||||
Continue For
|
||||
End If
|
||||
|
||||
@@ -842,6 +876,11 @@ Public Class ImportZUGFeRDFiles
|
||||
_logger.Error("Could not save File to Disk!")
|
||||
Dim oReasonString = "Validation of file " + newAttachmentFilename + " on disk was NOT succesfully."
|
||||
AddRejectedState(pMessageId, oReasonString, "EMBEDDED FILE CONSISTENCY NOT OK", "Info GUI", pConnections.SQLServerTransaction)
|
||||
|
||||
' Datei ist Murks und muss gelöscht werden, wenn möglich
|
||||
DeleteFileFromDisk(embeddedFilePath)
|
||||
|
||||
nextAttachmentIndex += 1
|
||||
Continue For
|
||||
End If
|
||||
|
||||
@@ -887,6 +926,20 @@ Public Class ImportZUGFeRDFiles
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function DeleteFileFromDisk(pEmbeddedFilePath As String) As Boolean
|
||||
|
||||
Try
|
||||
Dim oFile As FileInfo = New FileInfo(pEmbeddedFilePath)
|
||||
If oFile IsNot Nothing Then
|
||||
oFile.Delete()
|
||||
End If
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Coul not delete file {0}.", pEmbeddedFilePath)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Private Function GetEmbeddedFileExtension(pMimeTypeValue As String) As String
|
||||
|
||||
If pMimeTypeValue.IsNullOrEmpty() Then
|
||||
|
||||
@@ -29,9 +29,10 @@ Public Class WorkerArgs
|
||||
' Feature Flags
|
||||
Public AllowFacturX As Boolean = True
|
||||
Public AllowXRechnung As Boolean = True
|
||||
Public AllowZugferd10 As Boolean = True
|
||||
Public AllowZugferd2x As Boolean = True
|
||||
Public AllowZugferd23x As Boolean = True
|
||||
Public AllowZugferd10 As Boolean = False
|
||||
Public AllowZugferd2x As Boolean = False
|
||||
Public AllowZugferd23x As Boolean = False
|
||||
Public AllowPeppolBISBill3x As Boolean = False
|
||||
Public AllowEBInterface As Boolean = False
|
||||
|
||||
End Class
|
||||
@@ -895,17 +895,55 @@ Public Class XRechnungViewDocument
|
||||
End Function
|
||||
|
||||
Private Sub RenderLabelValuePair(context As PdfRenderContext, label As String, value As String)
|
||||
context.PDF.DrawText(fontResName, MARGIN_LEFT, context.YPosition, label)
|
||||
Dim safeLabel As String = SanitizeForPdf(label)
|
||||
Dim safeValue As String = SanitizeForPdf(value)
|
||||
|
||||
context.PDF.DrawText(fontResName, MARGIN_LEFT, context.YPosition, safeLabel)
|
||||
|
||||
If context.CreateTextBox Then
|
||||
Dim textBoxYPos As Integer = context.YPosition - 3
|
||||
context.PDF.DrawTextBox(fontResName, COL_VALUE_X, textBoxYPos, 90, YCoo_TextBoxPlus5(textBoxYPos),
|
||||
TextAlignment.TextAlignmentFar, TextAlignment.TextAlignmentCenter,
|
||||
value)
|
||||
safeValue)
|
||||
Else
|
||||
context.PDF.DrawText(fontResName, COL_VALUE_X, context.YPosition, value)
|
||||
context.PDF.DrawText(fontResName, COL_VALUE_X, context.YPosition, safeValue)
|
||||
End If
|
||||
End Sub
|
||||
''' <summary>
|
||||
''' Bereinigt einen String vor der Übergabe an GdPicture DrawText.
|
||||
''' Entfernt Steuerzeichen, Surrogate und Format-/BiDi-Zeichen,
|
||||
''' die GdPictures UnicodeBidi-Algorithmus zum Absturz bringen.
|
||||
''' </summary>
|
||||
Private Function SanitizeForPdf(text As String) As String
|
||||
If String.IsNullOrEmpty(text) Then Return String.Empty
|
||||
|
||||
Dim sb As New System.Text.StringBuilder(text.Length)
|
||||
Dim removedChars As New System.Text.StringBuilder()
|
||||
|
||||
For Each c As Char In text
|
||||
Dim cat As Globalization.UnicodeCategory = Char.GetUnicodeCategory(c)
|
||||
|
||||
Dim isProblematic As Boolean =
|
||||
cat = Globalization.UnicodeCategory.Control OrElse
|
||||
cat = Globalization.UnicodeCategory.Surrogate OrElse
|
||||
cat = Globalization.UnicodeCategory.Format OrElse
|
||||
cat = Globalization.UnicodeCategory.OtherNotAssigned OrElse
|
||||
Char.IsHighSurrogate(c) OrElse
|
||||
Char.IsLowSurrogate(c)
|
||||
|
||||
If isProblematic Then
|
||||
removedChars.Append($"U+{AscW(c):X4}[{cat}] ")
|
||||
Else
|
||||
sb.Append(c)
|
||||
End If
|
||||
Next
|
||||
|
||||
If removedChars.Length > 0 Then
|
||||
_logger.Warn($"SanitizeForPdf: Removed [{removedChars.ToString().Trim()}] from text [{text.Substring(0, Math.Min(80, text.Length))}]")
|
||||
End If
|
||||
|
||||
Return sb.ToString()
|
||||
End Function
|
||||
|
||||
Private Sub RenderTextWithWrapping(context As PdfRenderContext, text As String)
|
||||
If text.Length > MAX_TEXT_LENGTH_FULL Then
|
||||
|
||||
@@ -510,7 +510,6 @@ Public Class LogConfig
|
||||
' Add debug rule, if configured
|
||||
If _EnableDebugLogging = True Then
|
||||
_config.AddRule(LogLevel.Debug, LogLevel.Error, TARGET_DEBUG)
|
||||
oLogger.Info("DEBUG Logging is now Enabled.")
|
||||
Else
|
||||
oLogger.Debug("DEBUG Logging is now Disabled.")
|
||||
End If
|
||||
|
||||
@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
|
||||
<Assembly: AssemblyCompany("Digital Data GmbH, Heuchelheim")>
|
||||
<Assembly: AssemblyProduct("Modules.Logging")>
|
||||
<Assembly: AssemblyCopyright("Copyright © 2025")>
|
||||
<Assembly: AssemblyTrademark("2.6.4.0")>
|
||||
<Assembly: AssemblyTrademark("2.7.0.0")>
|
||||
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.6.5.0")>
|
||||
<Assembly: AssemblyFileVersion("2.6.5.0")>
|
||||
<Assembly: AssemblyVersion("2.7.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.7.0.0")>
|
||||
|
||||
@@ -247,7 +247,7 @@ Namespace Mail
|
||||
|
||||
Try
|
||||
If pSession.User <> String.Empty Then
|
||||
Logger.Info("Logging in with user [{0}] and Auth Type [{1}]", pSession.User, pSession.AuthType)
|
||||
Logger.Debug("Logging in with user [{0}] and Auth Type [{1}]", pSession.User, pSession.AuthType)
|
||||
|
||||
If pSession.AuthType = AUTH_OAUTH2 Then
|
||||
' Use OAuth2 token
|
||||
@@ -273,10 +273,10 @@ Namespace Mail
|
||||
Public Function DisconnectFromServer() As Boolean
|
||||
Try
|
||||
If Client IsNot Nothing Then
|
||||
Logger.Debug("Closing connection to Server [{0}].", Session.Server)
|
||||
Logger.Debug("Closing connection to Server [{0}]...", Session.Server)
|
||||
DoClose(Client)
|
||||
Session.Connected = False
|
||||
Logger.Info("Connection to Server [{0}] closed.", Session.Server)
|
||||
Logger.Debug("Connection to Server [{0}] closed.", Session.Server)
|
||||
Else
|
||||
Logger.Debug("No connection currently open. Exiting.")
|
||||
End If
|
||||
|
||||
25
Modules.sln
25
Modules.sln
@@ -24,8 +24,6 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "License", "License\License.
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Logging", "Logging\Logging.vbproj", "{903B2D7D-3B80-4BE9-8713-7447B704E1B0}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Logging.Test", "Logging.Test\Logging.Test.vbproj", "{3207D8E7-36E3-4714-9B03-7B5B3D6D351A}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Patterns", "Patterns\Patterns.vbproj", "{7C3B0C7E-59FE-4E1A-A655-27AE119F9444}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Windows", "Windows\Windows.vbproj", "{5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}"
|
||||
@@ -40,6 +38,8 @@ Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Database.Test", "Database.T
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Filesystem", "Filesystem\Filesystem.vbproj", "{991D0231-4623-496D-8BD0-9CA906029CBC}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "EDMIService", "..\DDMonorepo\Service.EDMIService\EDMIService.vbproj", "{A8C3F298-76AB-4359-AB3C-986E313B4336}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -47,63 +47,45 @@ Global
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{6EA0C51F-C2B1-4462-8198-3DE0B32B74F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6EA0C51F-C2B1-4462-8198-3DE0B32B74F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6EA0C51F-C2B1-4462-8198-3DE0B32B74F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6EA0C51F-C2B1-4462-8198-3DE0B32B74F8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{44982F9B-6116-44E2-85D0-F39650B1EF99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{44982F9B-6116-44E2-85D0-F39650B1EF99}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{44982F9B-6116-44E2-85D0-F39650B1EF99}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{44982F9B-6116-44E2-85D0-F39650B1EF99}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EAF0EA75-5FA7-485D-89C7-B2D843B03A96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{25017513-0D97-49D3-98D7-BA76D9B251B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{25017513-0D97-49D3-98D7-BA76D9B251B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{25017513-0D97-49D3-98D7-BA76D9B251B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{25017513-0D97-49D3-98D7-BA76D9B251B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8A8F20FC-C46E-41AC-BEE7-218366CFFF99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8A8F20FC-C46E-41AC-BEE7-218366CFFF99}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8A8F20FC-C46E-41AC-BEE7-218366CFFF99}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8A8F20FC-C46E-41AC-BEE7-218366CFFF99}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AB6F09BF-E794-4F6A-94BB-C97C0BA84D64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AB6F09BF-E794-4F6A-94BB-C97C0BA84D64}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AB6F09BF-E794-4F6A-94BB-C97C0BA84D64}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AB6F09BF-E794-4F6A-94BB-C97C0BA84D64}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{39EC839A-3C30-4922-A41E-6B09D1DDE5C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{39EC839A-3C30-4922-A41E-6B09D1DDE5C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{39EC839A-3C30-4922-A41E-6B09D1DDE5C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{39EC839A-3C30-4922-A41E-6B09D1DDE5C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5EBACBFA-F11A-4BBF-8D02-91461F2293ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5EBACBFA-F11A-4BBF-8D02-91461F2293ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5EBACBFA-F11A-4BBF-8D02-91461F2293ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5EBACBFA-F11A-4BBF-8D02-91461F2293ED}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{903B2D7D-3B80-4BE9-8713-7447B704E1B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{903B2D7D-3B80-4BE9-8713-7447B704E1B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{903B2D7D-3B80-4BE9-8713-7447B704E1B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{903B2D7D-3B80-4BE9-8713-7447B704E1B0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3207D8E7-36E3-4714-9B03-7B5B3D6D351A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3207D8E7-36E3-4714-9B03-7B5B3D6D351A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3207D8E7-36E3-4714-9B03-7B5B3D6D351A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3207D8E7-36E3-4714-9B03-7B5B3D6D351A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7C3B0C7E-59FE-4E1A-A655-27AE119F9444}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7C3B0C7E-59FE-4E1A-A655-27AE119F9444}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7C3B0C7E-59FE-4E1A-A655-27AE119F9444}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7C3B0C7E-59FE-4E1A-A655-27AE119F9444}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5EFAEF9B-90B9-4F05-9F70-F79AD77FFF86}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4C86DF8F-A280-40D4-85B0-10B1BF66C15C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4C86DF8F-A280-40D4-85B0-10B1BF66C15C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4C86DF8F-A280-40D4-85B0-10B1BF66C15C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4C86DF8F-A280-40D4-85B0-10B1BF66C15C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{81CAC44F-3711-4C8F-AE98-E02A7448782A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{81CAC44F-3711-4C8F-AE98-E02A7448782A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{81CAC44F-3711-4C8F-AE98-E02A7448782A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{81CAC44F-3711-4C8F-AE98-E02A7448782A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AF664D85-0A4B-4BAB-A2F8-83110C06553A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{91B4DFC0-543C-43A7-A9E0-6817DCA277EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
@@ -114,6 +96,9 @@ Global
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{991D0231-4623-496D-8BD0-9CA906029CBC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A8C3F298-76AB-4359-AB3C-986E313B4336}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A8C3F298-76AB-4359-AB3C-986E313B4336}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A8C3F298-76AB-4359-AB3C-986E313B4336}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -44,11 +44,13 @@
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.Data.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Data.Desktop.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Utils.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraEditors.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraGrid.v21.2, Version=21.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Drawing.v25.2, Version=25.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Printing.v25.2.Core, Version=25.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Data.v25.2, Version=25.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Data.Desktop.v25.2, Version=25.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Utils.v25.2, Version=25.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraEditors.v25.2, Version=25.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraGrid.v25.2, Version=25.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DigitalData.Controls.LookupGrid, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DDMonorepo\Controls.LookupGrid\bin\Debug\DigitalData.Controls.LookupGrid.dll</HintPath>
|
||||
@@ -155,4 +157,8 @@
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Analyzer Include="D:\ProgramFiles\DevExpress 25.2\Components\Offline Packages\devexpress.data\25.2.3\analyzers\dotnet\DevExpress.Generator.dll" Visible="false" Condition="Exists('D:\ProgramFiles\DevExpress 25.2\Components\Offline Packages\devexpress.data\25.2.3\analyzers\dotnet\DevExpress.Generator.dll')" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
164
Patterns/Patterns.vbproj.bak
Normal file
164
Patterns/Patterns.vbproj.bak
Normal file
@@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7C3B0C7E-59FE-4E1A-A655-27AE119F9444}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>DigitalData.Modules.Patterns</RootNamespace>
|
||||
<AssemblyName>DigitalData.Modules.Patterns</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<MyType>Windows</MyType>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.Patterns.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DocumentationFile>DigitalData.Modules.Patterns.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.Drawing.v26.1, Version=26.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Printing.v26.1.Core, Version=26.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Data.v26.1, Version=26.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Data.Desktop.v26.1, Version=26.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.Utils.v26.1, Version=26.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraEditors.v26.1, Version=26.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DevExpress.XtraGrid.v26.1, Version=26.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||
<Reference Include="DigitalData.Controls.LookupGrid, Version=3.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\DDMonorepo\Controls.LookupGrid\bin\Debug\DigitalData.Controls.LookupGrid.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DigitalData.Modules.Logging, Version=2.6.5.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\DigitalData.Modules.Logging.2.6.5\lib\net462\DigitalData.Modules.Logging.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Interop.WINDREAMLib">
|
||||
<HintPath>M:\Bibliotheken\3rdParty\windream\Interop.WINDREAMLib.dll</HintPath>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Collections.Generic" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Linq" />
|
||||
<Import Include="System.Xml.Linq" />
|
||||
<Import Include="System.Threading.Tasks" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Constants.vb" />
|
||||
<Compile Include="Modules\FileInformation.vb" />
|
||||
<Compile Include="Modules\Globix\GlobixAutomatic.vb" />
|
||||
<Compile Include="Modules\IDB.vb" />
|
||||
<Compile Include="Modules\Globix\GlobixManual.vb" />
|
||||
<Compile Include="Modules\Custom.vb" />
|
||||
<Compile Include="Modules\Windream.vb" />
|
||||
<Compile Include="Modules\User.vb" />
|
||||
<Compile Include="IModule.vb" />
|
||||
<Compile Include="Modules\Clipboard.vb" />
|
||||
<Compile Include="Modules\Controls.vb" />
|
||||
<Compile Include="Modules\Internal.vb" />
|
||||
<Compile Include="Modules\BaseModule.vb" />
|
||||
<Compile Include="Pattern.vb" />
|
||||
<Compile Include="Patterns.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<Compile Include="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="Patterns2.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<CustomToolNamespace>My</CustomToolNamespace>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ZooFlow\ZooFlow.vbproj">
|
||||
<Project>{81cac44f-3711-4c8f-ae98-e02a7448782a}</Project>
|
||||
<Name>ZooFlow</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>powershell.exe -command "& { &'$(SolutionDir)copy-binary.ps1' '$(TargetPath)' '$(TargetFileName)' '$(ConfigurationName)' '$(ProjectName)' }"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Analyzer Include="D:\ProgramFiles\DevExpress 26.1\Components\Offline Packages\devexpress.data\26.1.5\analyzers\dotnet\DevExpress.Generator.dll" Visible="false" Condition="Exists('D:\ProgramFiles\DevExpress 26.1\Components\Offline Packages\devexpress.data\26.1.5\analyzers\dotnet\DevExpress.Generator.dll')" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.9.8.0")>
|
||||
<Assembly: AssemblyFileVersion("1.9.8.0")>
|
||||
<Assembly: AssemblyVersion("2.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("2.0.0.0")>
|
||||
|
||||
@@ -1244,7 +1244,7 @@ Public Class Windream
|
||||
Dim oWMObject As IWMObject6 = GetFileByPath(Path)
|
||||
|
||||
If LockObject(oWMObject, WMObjectEditModeIndexEdit) = False Then
|
||||
_logger.Warn("File {0} could not be locked")
|
||||
_logger.Warn("File {0} could not be locked", Path)
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -1254,22 +1254,26 @@ Public Class Windream
|
||||
|
||||
Try
|
||||
Dim oType As Integer = GetIndexType(pIndexName)
|
||||
If Not IsNothing(oType) Then
|
||||
Dim oConvertedValue As Object = Helpers.ConvertIndexValue(oType, pStringValue)
|
||||
|
||||
oWMObject.SetVariableValue(pIndexName, oConvertedValue)
|
||||
oWMObject.Save()
|
||||
|
||||
If UnlockObject(oWMObject) = False Then
|
||||
_logger.Warn("File {0} could not be unlocked", Path)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Else
|
||||
' IsNothing() schlägt bei Integer (Werttyp) nie an – stattdessen auf Undefined (0) prüfen
|
||||
If oType = WMObjectVariableValueTypeUndefined Then
|
||||
_logger.Warn("Index '{0}' not found or has undefined type – SetFileIndex aborted for file '{1}'", pIndexName, Path)
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oConvertedValue As Object = Helpers.ConvertIndexValue(oType, pStringValue)
|
||||
|
||||
oWMObject.SetVariableValue(pIndexName, oConvertedValue)
|
||||
oWMObject.Save()
|
||||
|
||||
If UnlockObject(oWMObject) = False Then
|
||||
_logger.Warn("File {0} could not be unlocked", Path)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not set value '{0}' for index '{1}' on file '{2}'", pStringValue, pIndexName, Path)
|
||||
_logger.Error(ex)
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
@@ -1285,6 +1289,7 @@ Public Class Windream
|
||||
_logger.Warn("File '{0}' does not exist", pPath)
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim oWMObject As IWMObject6
|
||||
|
||||
Try
|
||||
@@ -1295,9 +1300,10 @@ Public Class Windream
|
||||
_logger.Warn(ex.Message)
|
||||
Return False
|
||||
End Try
|
||||
|
||||
'Lock WMObject for changes
|
||||
If LockObject(oWMObject, WMObjectEditModeIndexEdit) = False Then
|
||||
_logger.Warn("File {0} could not be locked")
|
||||
_logger.Warn("File '{0}' could not be locked", pPath)
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -1307,9 +1313,18 @@ Public Class Windream
|
||||
|
||||
Try
|
||||
Dim oType As Integer = GetIndexType(pIndexName)
|
||||
Dim oConvertedValues As New List(Of String)
|
||||
Dim oArray As Object
|
||||
|
||||
' Gleicher Bug wie in SetFileIndex: Integer-Werttyp – IsNothing() greift nie
|
||||
' Stattdessen auf Undefined (0) prüfen
|
||||
If oType = WMObjectVariableValueTypeUndefined Then
|
||||
_logger.Warn("Index '{0}' not found or has undefined type – SetFileIndexLoS aborted for file '{1}'", pIndexName, pPath)
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
End If
|
||||
|
||||
_logger.Debug("SetFileIndexLoS '{0}' - Indextype: {1} - Values.Count: {2} ... ", pIndexName, oType, pAttributeValues.Count)
|
||||
|
||||
Dim oArray As Object
|
||||
ReDim oArray(pAttributeValues.Count - 1)
|
||||
|
||||
For oIndex = 0 To pAttributeValues.Count - 1
|
||||
@@ -1322,13 +1337,14 @@ Public Class Windream
|
||||
oWMObject.Save()
|
||||
|
||||
If UnlockObject(oWMObject) = False Then
|
||||
_logger.Warn("File {0} could not be unlocked", pPath)
|
||||
_logger.Warn("File '{0}' could not be unlocked", pPath)
|
||||
End If
|
||||
|
||||
Return True
|
||||
Catch ex As Exception
|
||||
_logger.Warn("Could not set value for index '{0}' on file '{1}'", pIndexName, pPath)
|
||||
_logger.Error(ex)
|
||||
|
||||
UnlockObject(oWMObject)
|
||||
Return False
|
||||
End Try
|
||||
End Function
|
||||
|
||||
@@ -65,9 +65,6 @@
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
@@ -81,6 +78,11 @@
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="NLog">
|
||||
<Version>5.0.5</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="DigitalData.Modules.Logging" version="2.6.5" targetFramework="net462" />
|
||||
<package id="NLog" version="5.0.5" targetFramework="net461" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user