66 lines
2.7 KiB
VB.net
66 lines
2.7 KiB
VB.net
Imports System.Globalization
|
|
Imports DLLLicenseManager
|
|
Public Class ClassLicence
|
|
Public Shared License_Date As Date
|
|
Private Shared _lizenzManager As ClassLicenseManager
|
|
Public Shared Sub Refresh_Licence()
|
|
Try
|
|
_lizenzManager = New ClassLicenseManager("#DigitalData35452!#", "")
|
|
Dim sql As String = "SELECT LICENSEKEY FROM TBGI_CONFIGURATION WHERE GUID = 1"
|
|
|
|
Dim licEncoded As String = ClassDatabase.Execute_Scalar(sql, MyConnectionString)
|
|
Dim licString As String = _lizenzManager.DecodeLicenseKey(licEncoded)
|
|
Dim licArray() As String = licString.ToString.Split("#")
|
|
|
|
If licEncoded <> "" Then
|
|
LICENSE_COUNT = licArray(0)
|
|
Else
|
|
LICENSE_COUNT = 0
|
|
End If
|
|
|
|
LOGGER.Debug("License Date is {0}", licArray(1))
|
|
|
|
License_Date = Date.ParseExact(licArray(1), "dd.MM.yyyy", CultureInfo.InvariantCulture)
|
|
'License_Date = CDate(split(1))
|
|
|
|
If License_Date < Now Then
|
|
If USER_LANGUAGE = "de-DE" Then
|
|
MsgBox("Ihre Lizenz ist abgelaufen!" & vbNewLine & "Letztes Gültigkeitsdatum: " & licArray(1) & vbNewLine & "Bitte setzen Sie sich mit Digital Data in Verbindung", MsgBoxStyle.Exclamation)
|
|
Else
|
|
MsgBox("Your license has expired!" & vbNewLine & "Last Valid Date: " & licArray(1) & vbNewLine & "Please contact Digital Data", MsgBoxStyle.Exclamation)
|
|
End If
|
|
START_INCOMPLETE = True
|
|
LICENSE_EXPIRED = True
|
|
LICENSE_COUNT = 0
|
|
End If
|
|
|
|
'tslblLicenses.Text = "Anzahl Lizenzen: " & licenseanzahl
|
|
LICENSE_DOCTYPE_COUNT = licArray(2)
|
|
Try
|
|
LicenseHotKey = licArray(3)
|
|
Catch ex As Exception
|
|
LicenseHotKey = 0
|
|
End Try
|
|
Catch ex As Exception
|
|
LOGGER.Error(ex)
|
|
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Unexpected error in Licensemanager:")
|
|
START_INCOMPLETE = True
|
|
End Try
|
|
End Sub
|
|
|
|
Public Shared Function license_is_Valid()
|
|
If LICENSE_EXPIRED Then
|
|
If USER_LANGUAGE = "de-DE" Then
|
|
MsgBox("Ihre Lizenz ist abgelaufen!" & vbNewLine & "Letztes Gültigkeitsdatum: " & License_Date & vbNewLine & "Bitte setzen Sie sich mit Digital Data in Verbindung", MsgBoxStyle.Exclamation)
|
|
Else
|
|
MsgBox("Your license has expired!" & vbNewLine & "Last Valid Date: " & License_Date & vbNewLine & "Please contact Digital Data", MsgBoxStyle.Exclamation)
|
|
End If
|
|
|
|
Return False
|
|
Else : Return True
|
|
|
|
End If
|
|
End Function
|
|
|
|
End Class
|