53 lines
1.9 KiB
VB.net
53 lines
1.9 KiB
VB.net
Imports DigitalData.Modules.Logging
|
|
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 LogConfig, 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 + "'"
|
|
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
|