This commit is contained in:
Jonathan Jenne 2020-02-04 16:19:26 +01:00
commit 20689335e1
8 changed files with 96 additions and 44 deletions

View File

@ -42,7 +42,12 @@ Public Class ClassInit
Try Try
Database = New MSSQLServer(LogConfig, MyConnectionString) Database = New MSSQLServer(LogConfig, MyConnectionString)
Return True If Database.DBInitialized = True Then
Return True
Else
Return False
End If
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
Return False Return False
@ -86,40 +91,46 @@ Public Class ClassInit
End If End If
End Function End Function
Public Shared Function CheckModuleData() Public Shared Function CheckModuleData()
Dim sql = String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','CW',{1})", USER_USERNAME, CLIENT_SELECTED) Try
Dim DT_CHECKUSER_MODULE As DataTable = Database.GetDatatable(sql) Dim sql = String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','CW',{1})", USER_USERNAME, CLIENT_SELECTED)
If DT_CHECKUSER_MODULE.Rows.Count = 0 Then Dim DT_CHECKUSER_MODULE As DataTable = Database.GetDatatable(sql)
Logger.Info("DT_CHECKUSER_MODULE.Rows.Count = 0", True) If DT_CHECKUSER_MODULE.Rows.Count = 0 Then
'ERROR_STATE = "NO USER" Logger.Info("DT_CHECKUSER_MODULE.Rows.Count = 0", True)
MsgBox("Sorry - Something went wrong in getting Your rights." & vbNewLine & "Please contact the system administrator!", MsgBoxStyle.Exclamation) '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 Return False
End If End Try
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
End Function End Function
Public Shared Function InitUserLogin(Optional _User As String = "") Public Shared Function InitUserLogin(Optional _User As String = "")
Try Try

View File

@ -2,9 +2,18 @@
Public Class ClassLicense Public Class ClassLicense
Private Shared lic_string As String Private Shared lic_string As String
Private Shared Sub Get_License(CLIENT_ID As Integer) 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 End Sub
Public Shared Sub Refresh_Licence(CLIENT_ID As Integer) Public Shared Sub Refresh_Licence(CLIENT_ID As Integer)
Try Try

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2.0.0.0")> <Assembly: AssemblyVersion("2.0.0.1")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -1,6 +1,6 @@
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class frmAdministration 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. 'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()> <System.Diagnostics.DebuggerNonUserCode()>

View File

@ -16,7 +16,7 @@ Public Class frmAdministration
End Class End Class
Public Sub New() Public Sub New()
MyBase.New(LogConfig) MyBase.New()
' Dieser Aufruf ist für den Designer erforderlich. ' Dieser Aufruf ist für den Designer erforderlich.
InitializeComponent() InitializeComponent()
End Sub End Sub
@ -98,7 +98,7 @@ Public Class frmAdministration
Status_Changed("Keine Änderung") Status_Changed("Keine Änderung")
End If End If
Catch ex As Exception Catch ex As Exception
ShowErrorMessage(ex) Logger.Error(ex)
'MsgBox("Unerwarteter Fehler beim Speichern des Profils: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text) 'MsgBox("Unerwarteter Fehler beim Speichern des Profils: " & vbNewLine & ex.Message, MsgBoxStyle.Critical, Text)
End Try End Try
End Sub End Sub
@ -628,7 +628,7 @@ Public Class frmAdministration
Status_Changed("Daten-Suche gespeichert") Status_Changed("Daten-Suche gespeichert")
End If End If
Catch ex As Exception Catch ex As Exception
ShowErrorMessage(ex) Logger.Error(ex)
'MsgBox("Unexpected Error while saving Data Search: " & vbNewLine & ex.Message, MsgBoxStyle.Critical) 'MsgBox("Unexpected Error while saving Data Search: " & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try End Try
End Sub End Sub
@ -662,7 +662,7 @@ Public Class frmAdministration
Status_Changed("Dokument-Suche gespeichert") Status_Changed("Dokument-Suche gespeichert")
End If End If
Catch ex As Exception Catch ex As Exception
ShowErrorMessage(ex) Logger.Error(ex)
End Try End Try
End Sub End Sub

View File

@ -34,6 +34,8 @@ Partial Class frmLicense
Me.txtNewlicences = New System.Windows.Forms.TextBox() Me.txtNewlicences = New System.Windows.Forms.TextBox()
Me.lblnewlicenses = New System.Windows.Forms.Label() Me.lblnewlicenses = New System.Windows.Forms.Label()
Me.btnPW_check = New System.Windows.Forms.Button() 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.grbBoxlicense.SuspendLayout()
Me.SuspendLayout() Me.SuspendLayout()
' '
@ -58,6 +60,8 @@ Partial Class frmLicense
' '
'grbBoxlicense 'grbBoxlicense
' '
Me.grbBoxlicense.Controls.Add(Me.lblClient1)
Me.grbBoxlicense.Controls.Add(Me.txtClient)
Me.grbBoxlicense.Controls.Add(Me.lblClient) Me.grbBoxlicense.Controls.Add(Me.lblClient)
Me.grbBoxlicense.Controls.Add(Me.cmbClients) Me.grbBoxlicense.Controls.Add(Me.cmbClients)
Me.grbBoxlicense.Controls.Add(Me.Label5) Me.grbBoxlicense.Controls.Add(Me.Label5)
@ -163,6 +167,23 @@ Partial Class frmLicense
Me.btnPW_check.TextAlign = System.Drawing.ContentAlignment.MiddleRight Me.btnPW_check.TextAlign = System.Drawing.ContentAlignment.MiddleRight
Me.btnPW_check.UseVisualStyleBackColor = True 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 'frmLicense
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) 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 btnnewLicenses As System.Windows.Forms.Button
Friend WithEvents txtNewlicences As System.Windows.Forms.TextBox Friend WithEvents txtNewlicences As System.Windows.Forms.TextBox
Friend WithEvents lblnewlicenses As System.Windows.Forms.Label Friend WithEvents lblnewlicenses As System.Windows.Forms.Label
Friend WithEvents lblClient1 As Label
Friend WithEvents txtClient As TextBox
End Class End Class

View File

@ -14,6 +14,8 @@ Public Class frmLicense
Me.txtPW.Visible = False Me.txtPW.Visible = False
Me.btnPW_check.Visible = False Me.btnPW_check.Visible = False
If DT_CLIENT_USER.Rows.Count > 1 Then If DT_CLIENT_USER.Rows.Count > 1 Then
lblClient1.Visible = False
txtClient.Visible = False
lblClient.Visible = True lblClient.Visible = True
cmbClients.Visible = True cmbClients.Visible = True
Try Try
@ -24,9 +26,13 @@ Public Class frmLicense
MsgBox("Unexpected Error in Loading Clients: " & ex.Message, MsgBoxStyle.Critical) MsgBox("Unexpected Error in Loading Clients: " & ex.Message, MsgBoxStyle.Critical)
End Try End Try
ElseIf DT_CLIENT_USER.Rows.Count = 1 Then ElseIf DT_CLIENT_USER.Rows.Count = 1 Then
lblClient1.Visible = True
txtClient.Visible = True
lblClient.Visible = False lblClient.Visible = False
cmbClients.Visible = False cmbClients.Visible = False
CLIENT_ID = DT_CLIENT_USER.Rows(0).Item("CLIENT_ID") CLIENT_ID = DT_CLIENT_USER.Rows(0).Item("CLIENT_ID")
txtClient.Text = CLIENT_ID
End If End If
@ -45,9 +51,13 @@ Public Class frmLicense
'Encode the license 'Encode the license
Dim result As String = Me._lizenzManager.EncodeLicenseKey(txtNewlicences.Text & "#" & dtpGueltig_GI.Text, "#DigitalData35452!#") 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) Dim sql As String = String.Format("UPDATE TBDD_CLIENT SET LICENSE_CBSEARCHER = '" & result & "' WHERE GUID = {0}", CLIENT_ID)
If Database.ExecuteNonQuery(sql) = True Then If Database.ExecuteNonQuery(sql) = False Then
sql = $"UPDATE TBDD_MODULES SET LICENSE = '{result}' where SHORT_NAME = 'CW'"
Database.ExecuteNonQuery(sql)
Refresh_Licence(True) Refresh_Licence(True)
Else
MsgBox("Could not renew the license!!", MsgBoxStyle.Critical)
End If End If
'MsgBox("Die Lizenzen wurden erfolgreich aktualisiert!", MsgBoxStyle.Exclamation, "Erfolgsmeldung:") 'MsgBox("Die Lizenzen wurden erfolgreich aktualisiert!", MsgBoxStyle.Exclamation, "Erfolgsmeldung:")

View File

@ -125,7 +125,6 @@
<File Id="DevExpress.XtraPrinting.v18.1" Name="DevExpress.XtraPrinting.v18.1.dll" /> <File Id="DevExpress.XtraPrinting.v18.1" Name="DevExpress.XtraPrinting.v18.1.dll" />
<File Id="DevExpress.XtraTreeList.v18.1" Name="DevExpress.XtraTreeList.v18.1.dll" /> <File Id="DevExpress.XtraTreeList.v18.1" Name="DevExpress.XtraTreeList.v18.1.dll" />
<File Id="DevExpress.XtraDialogs.v18.1" Name="DevExpress.XtraDialogs.v18.1.dll" /> <File Id="DevExpress.XtraDialogs.v18.1" Name="DevExpress.XtraDialogs.v18.1.dll" />
<File Id="DevExpress.XtraRichEdit.v18.1" Name="DevExpress.XtraRichEdit.v18.1.dll" />
<File Id="DevExpress.Dialogs.v18.1.Core" Name="DevExpress.Dialogs.v18.1.Core.dll" /> <File Id="DevExpress.Dialogs.v18.1.Core" Name="DevExpress.Dialogs.v18.1.Core.dll" />
<File Id="DevExpress.RichEdit.v18.1.Core" Name="DevExpress.RichEdit.v18.1.Core.dll" /> <File Id="DevExpress.RichEdit.v18.1.Core" Name="DevExpress.RichEdit.v18.1.Core.dll" />
</Component> </Component>