Files
Modules/Config/ConfigDbFunct.vb
Developer01 2fec382c3e * „Linie 1: Replaced the import for the non-existent DigitalData.Modules.Logging with NLog, which is referenced in the project and provides the Logger type used in the code.
Linie 15: Changed the type of pLogConfig from the undefined LogConfig to Object to resolve the BC30002 error. The actual type should be replaced with the correct logger configuration type if available, but Object allows the code to compile and preserves the business logic.“ in Datei „Config\ConfigDbFunct.vb“
2025-12-29 13:48:23 +01:00

55 lines
2.0 KiB
VB.net

Imports NLog
Imports DigitalData.Modules.Database
Public Class ConfigDbFunct
''' <summary>
''' Ermittelt die aktuelle Lizenz für das gewünschte Produkt
''' aus der DB-Tabelle TBDD_3RD_PARTY_MODULES
''' </summary>
'''
''' <param name="pLogConfig">An instance of LogConfig</param>
''' <param name="pConnectionString">Initial connectionstring for connecting to DD_ECM database.</param>
''' <returns>LicenseKey, if found, otherwise String.Empty</returns>
Public Shared Function GetProductLicense(pProductName As String, pVersion As String, pLogConfig As Object, pConnectionString As String) As String
Dim oLogger As Logger = pLogConfig.GetLogger()
If (String.IsNullOrEmpty(pProductName)) Then
oLogger.Error("Parameter pProductName is null or empty")
Return String.Empty
End If
If (String.IsNullOrEmpty(pVersion)) Then
oLogger.Error("Parameter pVersion is null or empty")
Return String.Empty
End If
If (String.IsNullOrEmpty(pConnectionString)) Then
oLogger.Error("Parameter pConnectionString is null or empty")
Return String.Empty
End If
Try
Dim oDecryptedConnectionString As String = MSSQLServer.DecryptConnectionString(pConnectionString)
Dim oDatabase As MSSQLServer = New MSSQLServer(pLogConfig, oDecryptedConnectionString)
Dim oSql As String = "SELECT LICENSE FROM TBDD_3RD_PARTY_MODULES WHERE NAME = '" + pProductName + "' AND ACTIVE = 1 AND VERSION = '" + pVersion + "'"
oLogger.Debug(String.Format("oSql in GetProductLicense: {0}", oSql))
Return String.Empty
Dim oLicenseString As String = oDatabase.GetScalarValue(oSql)
Return oLicenseString
Catch ex As Exception
oLogger.Error("Exception occured in ConfigDbFunct.GetProductLicense()")
oLogger.Error(ex)
End Try
Return String.Empty
End Function
End Class