Imports System.Globalization Imports DLLLicenseManager Public Class frmLicense Public _lizenzManager As ClassLicenseManager Private Sub btnPW_check_Click(sender As System.Object, e As System.EventArgs) Handles btnPW_check.Click If Me.txtPW.Text <> "" Then If Me.txtPW.Text = "35452dd!" Then Me.grbBoxlicense.Visible = True Refresh_Licence(False) Me.lblPW.Visible = False Me.txtPW.Visible = False Me.btnPW_check.Visible = False Else Me.grbBoxlicense.Visible = False MsgBox("Das eingegebene Passwort stimmt nicht überein!", MsgBoxStyle.Critical, "Falsche Eingabe:") Me.txtPW.Text = "" Me.txtPW.Focus() End If End If End Sub Private Sub btnnewLicenses_Click(sender As System.Object, e As System.EventArgs) Handles btnnewLicenses.Click Try If Me.txtNewlizences.Text <> "" And txtProfile.Text <> "" Then Dim dt As Date = CDate(dtp_Gültigkeit.Text) Dim oDateddMMyyyy = dt.ToString("dd.MM.yyyy", CultureInfo.InvariantCulture) Dim result As String = Me._lizenzManager.EncodeLicenseKey(txtNewlizences.Text & "#" & oDateddMMyyyy & "#" & txtProfile.Text, "#DigitalData35452!#") txtlicensekey.Text = result Me.TBPM_KONFIGURATIONTableAdapter.CmdUpdateLizenz(Environment.UserName, CStr(result)) Refresh_Licence(True) 'MsgBox("Die Lizenzen wurden erfolgreich aktualisiert!", MsgBoxStyle.Exclamation, "Erfolgsmeldung:") End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, "Fehler bei New Licenses:") End Try End Sub Sub Refresh_Licence(Neu As Boolean) Dim lizenzzahl As Integer Try Me._lizenzManager = New ClassLicenseManager("#DigitalData35452!#", "") Dim lic As String = TBPM_KONFIGURATIONTableAdapter.cmdGetLizenz Dim licString = Me._lizenzManager.DecodeLicenseKey(lic) Dim split() = licString.ToString.Split("#") If lic <> "" Then lizenzzahl = split(0) Else lizenzzahl = "0" End If dtp_Gültigkeit.Value = split(1) txtProfile.Text = split(2) LICENSE_PROFILES = split(2) Me.lblAktuelleLizenzen.Text = "Aktuelle Anzahl Lizenzen: " & lizenzzahl If Neu = True Then If CInt(lizenzzahl) > 0 Then MsgBox("Die Lizenz wurde aktualisiert!", MsgBoxStyle.Information, "Erfolgsmeldung:") End If End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Fehler bei Licensemanager:") End Try End Sub Private Sub frmLicense_Load(sender As Object, e As System.EventArgs) Handles Me.Load Try TBPM_KONFIGURATIONTableAdapter.Connection.ConnectionString = MyConnectionString Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Fehler bei Formular Load:") End Try End Sub End Class