Modules.Config: Abfrage von Lizenzen zentral über eine Funktion, die auch die Version berücksichtigt.
This commit is contained in:
parent
3ddb98c3d8
commit
976da9a153
@ -47,6 +47,9 @@
|
|||||||
<Reference Include="DigitalData.Modules.Base">
|
<Reference Include="DigitalData.Modules.Base">
|
||||||
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
<HintPath>..\Base\bin\Debug\DigitalData.Modules.Base.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="DigitalData.Modules.Database">
|
||||||
|
<HintPath>..\Database\bin\Debug\DigitalData.Modules.Database.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
|
<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>
|
<HintPath>..\packages\NLog.5.0.5\lib\net46\NLog.dll</HintPath>
|
||||||
@ -78,6 +81,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ConfigAttributes.vb" />
|
<Compile Include="ConfigAttributes.vb" />
|
||||||
|
<Compile Include="ConfigDbFunct.vb" />
|
||||||
<Compile Include="ConfigManager.vb" />
|
<Compile Include="ConfigManager.vb" />
|
||||||
<Compile Include="ConfigSample.vb" />
|
<Compile Include="ConfigSample.vb" />
|
||||||
<Compile Include="ConfigUtils.vb" />
|
<Compile Include="ConfigUtils.vb" />
|
||||||
|
|||||||
52
Config/ConfigDbFunct.vb
Normal file
52
Config/ConfigDbFunct.vb
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
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
|
||||||
Loading…
x
Reference in New Issue
Block a user