From 3c1657fa28baf1a03dfccf1db12e393007111815 Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Fri, 10 Jan 2020 14:02:24 +0100 Subject: [PATCH] =?UTF-8?q?MS=20=C3=84NDerungen=20wegen=20License?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/DD_Clipboard_Searcher/ClassInit.vb | 79 +++++++++++-------- app/DD_Clipboard_Searcher/ClassLicense.vb | 13 ++- .../My Project/AssemblyInfo.vb | 2 +- .../frmAdministration.Designer.vb | 2 +- .../frmAdministration.vb | 8 +- .../frmLicense.Designer.vb | 23 ++++++ app/DD_Clipboard_Searcher/frmLicense.vb | 14 +++- app/SetupWix/Product.wxs | 1 - 8 files changed, 97 insertions(+), 45 deletions(-) diff --git a/app/DD_Clipboard_Searcher/ClassInit.vb b/app/DD_Clipboard_Searcher/ClassInit.vb index f558a4b..19c5ebb 100644 --- a/app/DD_Clipboard_Searcher/ClassInit.vb +++ b/app/DD_Clipboard_Searcher/ClassInit.vb @@ -42,7 +42,12 @@ Public Class ClassInit Try Database = New MSSQLServer(LogConfig, MyConnectionString) - Return True + If Database.DBInitialized = True Then + Return True + Else + Return False + End If + Catch ex As Exception Logger.Error(ex) Return False @@ -86,40 +91,46 @@ Public Class ClassInit End If End Function Public Shared Function CheckModuleData() - Dim sql = String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','CW',{1})", USER_USERNAME, CLIENT_SELECTED) - Dim DT_CHECKUSER_MODULE As DataTable = Database.GetDatatable(sql) - If DT_CHECKUSER_MODULE.Rows.Count = 0 Then - Logger.Info("DT_CHECKUSER_MODULE.Rows.Count = 0", True) - 'ERROR_STATE = "NO USER" - MsgBox("Sorry - Something went wrong in getting Your rights." & vbNewLine & "Please contact the system administrator!", MsgBoxStyle.Exclamation) - Return False - End If - If DT_CHECKUSER_MODULE.Rows.Count = 1 Then - Logger.Info(">> Login Username: " & USER_USERNAME, False) - Logger.Info(">> Login time: " & Now.ToString, False) - USER_ID = DT_CHECKUSER_MODULE.Rows(0).Item("USER_ID") - USER_SURNAME = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_SURNAME")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_SURNAME")) - USER_PRENAME = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_PRENAME")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_PRENAME")) - USER_SHORTNAME = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_SHORTNAME")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_SHORTNAME")) - USER_EMAIL = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_EMAIL")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_EMAIL")) - USER_LANGUAGE = DT_CHECKUSER_MODULE.Rows(0).Item("USER_LANGUAGE") - USER_DATE_FORMAT = DT_CHECKUSER_MODULE.Rows(0).Item("USER_DATE_FORMAT") - - USER_IN_MODULE = DT_CHECKUSER_MODULE.Rows(0).Item("MODULE_ACCESS") - USER_IS_ADMIN = DT_CHECKUSER_MODULE.Rows(0).Item("IS_ADMIN") - - - USERCOUNT_LOGGED_IN = DT_CHECKUSER_MODULE.Rows(0).Item("USERCOUNT_LOGGED_IN") - USERCOUNT_LOGGED_IN += 1 - Return True - Else - Logger.Info(" - User '" & USER_USERNAME & "' not listed in Useradministration!", False) - 'MsgBox("Achtung: Sie sind nicht in der Userverwaltung hinterlegt." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:") - 'Me.Close() - Dim msg = String.Format("You are not listed in the Useradministration." & vbNewLine & "Please contact the admin.") - MsgBox(msg, MsgBoxStyle.Exclamation) + Try + Dim sql = String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','CW',{1})", USER_USERNAME, CLIENT_SELECTED) + Dim DT_CHECKUSER_MODULE As DataTable = Database.GetDatatable(sql) + If DT_CHECKUSER_MODULE.Rows.Count = 0 Then + Logger.Info("DT_CHECKUSER_MODULE.Rows.Count = 0", True) + 'ERROR_STATE = "NO USER" + MsgBox("Sorry - Something went wrong in getting Your rights." & vbNewLine & "Please contact the system administrator!", MsgBoxStyle.Exclamation) + Return False + End If + If DT_CHECKUSER_MODULE.Rows.Count = 1 Then + Logger.Info(">> Login Username: " & USER_USERNAME, False) + Logger.Info(">> Login time: " & Now.ToString, False) + USER_ID = DT_CHECKUSER_MODULE.Rows(0).Item("USER_ID") + USER_SURNAME = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_SURNAME")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_SURNAME")) + USER_PRENAME = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_PRENAME")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_PRENAME")) + USER_SHORTNAME = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_SHORTNAME")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_SHORTNAME")) + USER_EMAIL = IIf(IsDBNull(DT_CHECKUSER_MODULE.Rows(0).Item("USER_EMAIL")), "", DT_CHECKUSER_MODULE.Rows(0).Item("USER_EMAIL")) + USER_LANGUAGE = DT_CHECKUSER_MODULE.Rows(0).Item("USER_LANGUAGE") + USER_DATE_FORMAT = DT_CHECKUSER_MODULE.Rows(0).Item("USER_DATE_FORMAT") + + USER_IN_MODULE = DT_CHECKUSER_MODULE.Rows(0).Item("MODULE_ACCESS") + USER_IS_ADMIN = DT_CHECKUSER_MODULE.Rows(0).Item("IS_ADMIN") + + + USERCOUNT_LOGGED_IN = DT_CHECKUSER_MODULE.Rows(0).Item("USERCOUNT_LOGGED_IN") + USERCOUNT_LOGGED_IN += 1 + Return True + Else + Logger.Info(" - User '" & USER_USERNAME & "' not listed in Useradministration!", False) + 'MsgBox("Achtung: Sie sind nicht in der Userverwaltung hinterlegt." & vbNewLine & "Bitte setzen Sie sich mit dem Systembetreuer in Verbindung!", MsgBoxStyle.Critical, "Achtung:") + 'Me.Close() + Dim msg = String.Format("You are not listed in the Useradministration." & vbNewLine & "Please contact the admin.") + MsgBox(msg, MsgBoxStyle.Exclamation) + Return False + End If + Catch ex As Exception + Logger.Error(ex) Return False - End If + End Try + End Function Public Shared Function InitUserLogin(Optional _User As String = "") Try diff --git a/app/DD_Clipboard_Searcher/ClassLicense.vb b/app/DD_Clipboard_Searcher/ClassLicense.vb index e8e944f..59ee1c6 100644 --- a/app/DD_Clipboard_Searcher/ClassLicense.vb +++ b/app/DD_Clipboard_Searcher/ClassLicense.vb @@ -2,9 +2,18 @@ Public Class ClassLicense Private Shared lic_string As String Private Shared Sub Get_License(CLIENT_ID As Integer) - Dim sql As String = String.Format("SELECT LICENSE_DDCBSEARCHER FROM TBDD_CLIENT WHERE GUID = {0}", CLIENT_ID) + Try + Dim sql As String = String.Format("SELECT LICENSE FROM TBDD_MODULES WHERE SHORT_NAME = 'CW'") + lic_string = Database.GetScalarValue(sql) + Catch ex As Exception + Try + Dim sql As String = String.Format("SELECT LICENSE_DDCBSEARCHER FROM TBDD_CLIENT WHERE GUID = {0}", CLIENT_ID) + lic_string = Database.GetScalarValue(sql) + Catch ex1 As Exception + MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error in Get_License:") + End Try + End Try - lic_string = Database.GetScalarValue(sql) End Sub Public Shared Sub Refresh_Licence(CLIENT_ID As Integer) Try diff --git a/app/DD_Clipboard_Searcher/My Project/AssemblyInfo.vb b/app/DD_Clipboard_Searcher/My Project/AssemblyInfo.vb index 1a19513..5ba7720 100644 --- a/app/DD_Clipboard_Searcher/My Project/AssemblyInfo.vb +++ b/app/DD_Clipboard_Searcher/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/app/DD_Clipboard_Searcher/frmAdministration.Designer.vb b/app/DD_Clipboard_Searcher/frmAdministration.Designer.vb index d2e5acc..a9ada60 100644 --- a/app/DD_Clipboard_Searcher/frmAdministration.Designer.vb +++ b/app/DD_Clipboard_Searcher/frmAdministration.Designer.vb @@ -1,6 +1,6 @@  Partial Class frmAdministration - Inherits DigitalData.GUIs.Common.Base.BaseRibbonForm + Inherits DevExpress.XtraBars.Ribbon.RibbonForm '.GUIs.Common.Base.BaseRibbonForm 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen. diff --git a/app/DD_Clipboard_Searcher/frmAdministration.vb b/app/DD_Clipboard_Searcher/frmAdministration.vb index 6333f17..1425f9d 100644 --- a/app/DD_Clipboard_Searcher/frmAdministration.vb +++ b/app/DD_Clipboard_Searcher/frmAdministration.vb @@ -16,7 +16,7 @@ Public Class frmAdministration End Class Public Sub New() - MyBase.New(LogConfig) + MyBase.New() ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() End Sub @@ -98,7 +98,7 @@ Public Class frmAdministration Status_Changed("Keine Änderung") End If Catch ex As Exception - ShowErrorMessage(ex) + Logger.Error(ex) 'MsgBox("Unerwarteter Fehler beim Speichern des Profils: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text) End Try End Sub @@ -628,7 +628,7 @@ Public Class frmAdministration Status_Changed("Daten-Suche gespeichert") End If Catch ex As Exception - ShowErrorMessage(ex) + Logger.Error(ex) 'MsgBox("Unexpected Error while saving Data Search: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) End Try End Sub @@ -662,7 +662,7 @@ Public Class frmAdministration Status_Changed("Dokument-Suche gespeichert") End If Catch ex As Exception - ShowErrorMessage(ex) + Logger.Error(ex) End Try End Sub diff --git a/app/DD_Clipboard_Searcher/frmLicense.Designer.vb b/app/DD_Clipboard_Searcher/frmLicense.Designer.vb index 009d434..4c12962 100644 --- a/app/DD_Clipboard_Searcher/frmLicense.Designer.vb +++ b/app/DD_Clipboard_Searcher/frmLicense.Designer.vb @@ -34,6 +34,8 @@ Partial Class frmLicense Me.txtNewlicences = New System.Windows.Forms.TextBox() Me.lblnewlicenses = New System.Windows.Forms.Label() Me.btnPW_check = New System.Windows.Forms.Button() + Me.txtClient = New System.Windows.Forms.TextBox() + Me.lblClient1 = New System.Windows.Forms.Label() Me.grbBoxlicense.SuspendLayout() Me.SuspendLayout() ' @@ -58,6 +60,8 @@ Partial Class frmLicense ' 'grbBoxlicense ' + Me.grbBoxlicense.Controls.Add(Me.lblClient1) + Me.grbBoxlicense.Controls.Add(Me.txtClient) Me.grbBoxlicense.Controls.Add(Me.lblClient) Me.grbBoxlicense.Controls.Add(Me.cmbClients) Me.grbBoxlicense.Controls.Add(Me.Label5) @@ -163,6 +167,23 @@ Partial Class frmLicense Me.btnPW_check.TextAlign = System.Drawing.ContentAlignment.MiddleRight Me.btnPW_check.UseVisualStyleBackColor = True ' + 'txtClient + ' + Me.txtClient.Location = New System.Drawing.Point(307, 39) + Me.txtClient.Name = "txtClient" + Me.txtClient.ReadOnly = True + Me.txtClient.Size = New System.Drawing.Size(100, 21) + Me.txtClient.TabIndex = 20 + ' + 'lblClient1 + ' + Me.lblClient1.AutoSize = True + Me.lblClient1.Location = New System.Drawing.Point(307, 22) + Me.lblClient1.Name = "lblClient1" + Me.lblClient1.Size = New System.Drawing.Size(38, 13) + Me.lblClient1.TabIndex = 21 + Me.lblClient1.Text = "Label1" + ' 'frmLicense ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -196,4 +217,6 @@ Partial Class frmLicense Friend WithEvents btnnewLicenses As System.Windows.Forms.Button Friend WithEvents txtNewlicences As System.Windows.Forms.TextBox Friend WithEvents lblnewlicenses As System.Windows.Forms.Label + Friend WithEvents lblClient1 As Label + Friend WithEvents txtClient As TextBox End Class diff --git a/app/DD_Clipboard_Searcher/frmLicense.vb b/app/DD_Clipboard_Searcher/frmLicense.vb index 0f129f6..e497a98 100644 --- a/app/DD_Clipboard_Searcher/frmLicense.vb +++ b/app/DD_Clipboard_Searcher/frmLicense.vb @@ -14,6 +14,8 @@ Public Class frmLicense Me.txtPW.Visible = False Me.btnPW_check.Visible = False If DT_CLIENT_USER.Rows.Count > 1 Then + lblClient1.Visible = False + txtClient.Visible = False lblClient.Visible = True cmbClients.Visible = True Try @@ -24,9 +26,13 @@ Public Class frmLicense MsgBox("Unexpected Error in Loading Clients: " & ex.Message, MsgBoxStyle.Critical) End Try ElseIf DT_CLIENT_USER.Rows.Count = 1 Then + lblClient1.Visible = True + txtClient.Visible = True + lblClient.Visible = False cmbClients.Visible = False CLIENT_ID = DT_CLIENT_USER.Rows(0).Item("CLIENT_ID") + txtClient.Text = CLIENT_ID End If @@ -45,9 +51,13 @@ Public Class frmLicense 'Encode the license Dim result As String = Me._lizenzManager.EncodeLicenseKey(txtNewlicences.Text & "#" & dtpGueltig_GI.Text, "#DigitalData35452!#") - Dim sql As String = String.Format("UPDATE TBDD_CLIENT SET LICENSE_DDCBSEARCHER = '" & result & "' WHERE GUID = {0}", CLIENT_ID) - If Database.ExecuteNonQuery(sql) = True Then + Dim sql As String = String.Format("UPDATE TBDD_CLIENT SET LICENSE_CBSEARCHER = '" & result & "' WHERE GUID = {0}", CLIENT_ID) + If Database.ExecuteNonQuery(sql) = False Then + sql = $"UPDATE TBDD_MODULES SET LICENSE = '{result}' where SHORT_NAME = 'CW'" + Database.ExecuteNonQuery(sql) Refresh_Licence(True) + Else + MsgBox("Could not renew the license!!", MsgBoxStyle.Critical) End If 'MsgBox("Die Lizenzen wurden erfolgreich aktualisiert!", MsgBoxStyle.Exclamation, "Erfolgsmeldung:") diff --git a/app/SetupWix/Product.wxs b/app/SetupWix/Product.wxs index 1943d13..563e832 100644 --- a/app/SetupWix/Product.wxs +++ b/app/SetupWix/Product.wxs @@ -125,7 +125,6 @@ -