MS_Initial
This commit is contained in:
91
Global_Indexer/frmLicense.vb
Normal file
91
Global_Indexer/frmLicense.vb
Normal file
@@ -0,0 +1,91 @@
|
||||
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.txtNewlicences.Text <> "" And txtProfile.Text <> "" Then
|
||||
'Encode the license
|
||||
Dim result As String = Me._lizenzManager.EncodeLicenseKey(txtNewlicences.Text & "#" & dtpGueltig_GI.Text & "#" & txtProfile.Text & "#" & txtHotKey.Text, "#DigitalData35452!#")
|
||||
txtlicensekey.Text = result
|
||||
Dim sql As String = "UPDATE TBGI_CONFIGURATION SET LICENSEKEY = '" & result & "' where guid = 1"
|
||||
If ClassDatabase.Execute_non_Query(sql, True) = True Then
|
||||
Refresh_Licence(True)
|
||||
End If
|
||||
|
||||
'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 sql As String = "SELECT LICENSEKEY FROM TBGI_CONFIGURATION WHERE GUID = 1"
|
||||
|
||||
Dim lic As String = ClassDatabase.Execute_Scalar(sql, MyConnectionString)
|
||||
Dim licString = Me._lizenzManager.DecodeLicenseKey(lic)
|
||||
|
||||
Dim split() = licString.ToString.Split("#")
|
||||
|
||||
If lic <> "" Then
|
||||
lizenzzahl = split(0)
|
||||
License_Anzahl = lizenzzahl
|
||||
Else
|
||||
lizenzzahl = "0"
|
||||
End If
|
||||
txtNewlicences.Text = lizenzzahl
|
||||
dtpGueltig_GI.Value = split(1)
|
||||
If CDate(split(1)) < CDate(Now.ToShortDateString) Then
|
||||
License_Expired = True
|
||||
Else
|
||||
License_Expired = False
|
||||
End If
|
||||
|
||||
txtProfile.Text = split(2)
|
||||
Try
|
||||
txtHotKey.Text = split(3)
|
||||
Catch ex As Exception
|
||||
txtHotKey.Text = 0
|
||||
End Try
|
||||
|
||||
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
|
||||
grbBoxlicense.Visible = False
|
||||
Me.lblPW.Visible = True
|
||||
Me.txtPW.Visible = True
|
||||
Me.btnPW_check.Visible = True
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Fehler bei Formular Load:")
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user