classDataASorDB
This commit is contained in:
parent
6ab3bef54d
commit
01db5a2bcf
140
app/DD_Clipboard_Searcher/ClassDataASorDB.vb
Normal file
140
app/DD_Clipboard_Searcher/ClassDataASorDB.vb
Normal file
@ -0,0 +1,140 @@
|
||||
Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Imports DigitalData.Modules.Logging
|
||||
|
||||
Public Class ClassDataASorDB
|
||||
Private _Logger As Logger
|
||||
Public Sub New(LogConfig As LogConfig)
|
||||
_Logger = LogConfig.GetLogger
|
||||
End Sub
|
||||
Public Function GetDatatable(pSQL As String, pAppServDT As String, pAppServFilter As String, pAppServSort As String, pForce As String) As DataTable
|
||||
Try
|
||||
Dim oReturnDT As DataTable
|
||||
If APPSERVER_ACTIVE = True And pForce = String.Empty Then
|
||||
Try
|
||||
Dim oTableResult As TableResult = _Client.GetDatatableByName(pAppServDT, pAppServFilter, pAppServSort)
|
||||
oReturnDT = oTableResult.Table
|
||||
If IsNothing(oReturnDT) Then
|
||||
_Logger.Warn($"Datatable from ApPServData is nothing [{pAppServDT} - {pAppServFilter}] - Failover via DB")
|
||||
GetDatatable(pSQL, "", "", "", "DB")
|
||||
End If
|
||||
Catch ex As Exception
|
||||
_Logger.Warn($"Error getting ApPServData [{pAppServDT} - {pAppServFilter}]")
|
||||
GetDatatable(pSQL, "", "", "", "DB")
|
||||
End Try
|
||||
Else
|
||||
oReturnDT = Database.GetDatatable(pSQL)
|
||||
End If
|
||||
Return oReturnDT
|
||||
Catch ex As Exception
|
||||
_Logger.Error(ex)
|
||||
End Try
|
||||
End Function
|
||||
|
||||
Public Function CheckModuleData()
|
||||
Try
|
||||
Dim oSql = String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','CW',{1})", USER_USERNAME, CLIENT_SELECTED)
|
||||
Dim DT_CHECKUSER_MODULE As DataTable
|
||||
DT_CHECKUSER_MODULE = GetDatatable(oSql, "TBDD_USER_MODULE", $"USERNAME = '{USER_USERNAME.ToLower}' AND MODULE_SHORT = 'CW'", "", "")
|
||||
|
||||
'If APPSERVER_ACTIVE = True Then
|
||||
' Dim oTableResult As TableResult = _Client.GetDatatableByName("TBDD_USER_MODULE", $"USERNAME = '{USER_USERNAME.ToLower}' AND MODULE_SHORT = 'CW'")
|
||||
' DT_CHECKUSER_MODULE = oTableResult.Table
|
||||
'Else
|
||||
' DT_CHECKUSER_MODULE = Database.GetDatatable(oSql)
|
||||
'End If
|
||||
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")
|
||||
ADDITIONAL_TITLE = DT_CHECKUSER_MODULE.Rows(0).Item("ADDITIONAL_TITLE")
|
||||
If ADDITIONAL_TITLE = String.Empty Then
|
||||
ADDITIONAL_TITLE = My.Application.Info.ProductName
|
||||
End If
|
||||
USERCOUNT_LOGGED_IN = DT_CHECKUSER_MODULE.Rows(0).Item("USERCOUNT_LOGGED_IN")
|
||||
USERCOUNT_LOGGED_IN += 1
|
||||
Try
|
||||
WORKING_MODE = DT_CHECKUSER_MODULE.Rows(0).Item("WORKING_MODE")
|
||||
Catch ex As Exception
|
||||
WORKING_MODE = ""
|
||||
End Try
|
||||
Dim oSplitWorkMode As String() = WORKING_MODE.Split("#")
|
||||
Dim oMode As String
|
||||
For Each oMode In oSplitWorkMode
|
||||
Logger.Debug($"oWorkingMode Parameter: {oMode}")
|
||||
If oMode = "NO_BASICCONF" Then
|
||||
BASIC_CONF_VISIBLE = False
|
||||
ElseIf oMode.StartsWith("NOMATCH_INFO") Then
|
||||
Try
|
||||
Dim oResult = oMode.Replace("NOMATCH_INFO=", "")
|
||||
NOMATCH_INFO = CBool(oResult)
|
||||
Catch ex As Exception
|
||||
NOMATCH_INFO = False
|
||||
End Try
|
||||
ElseIf oMode.StartsWith("HotkeySearchKey") Then
|
||||
Try
|
||||
Dim oResult = oMode.Replace("HotkeySearchKey=", "")
|
||||
HotkeySearchKey = oResult
|
||||
HotkeySearchKey_via_Server = True
|
||||
Catch ex As Exception
|
||||
NOMATCH_INFO = "d"
|
||||
End Try
|
||||
|
||||
Else
|
||||
Logger.Info($"Wrong oMode: {oMode}")
|
||||
End If
|
||||
Next
|
||||
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 Try
|
||||
|
||||
End Function
|
||||
Public Sub Refresh_Connections()
|
||||
Try
|
||||
Dim oSql = String.Format("SELECT * FROM TBDD_CONNECTION")
|
||||
Dim oDatatable As New MyDataset.TBDD_CONNECTIONDataTable()
|
||||
Dim oResult As DataTable
|
||||
oResult = GetDatatable(oSql, "TBDD_CONNECTION", "", "", "")
|
||||
|
||||
|
||||
'If APPSERVER_ACTIVE = True Then
|
||||
' Dim oTableResult As TableResult = _Client.GetDatatableByName("TBDD_CONNECTION")
|
||||
' oResult = oTableResult.Table
|
||||
|
||||
'Else
|
||||
' oResult = Database.GetDatatable(oSql)
|
||||
'End If
|
||||
|
||||
oDatatable.Merge(oResult)
|
||||
|
||||
DT_CONNECTIONS = oDatatable
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
MsgBox("Unexpected Error in Refresh_Connections: " & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
@ -9,10 +9,12 @@ Imports DigitalData.Modules.EDMI.API.EDMIServiceReference
|
||||
Public Class ClassInit
|
||||
Public _lizenzManager As clsLicenseManager
|
||||
Public _database As MSSQLServer
|
||||
Private _DataASorDB As ClassDataASorDB
|
||||
|
||||
Public Sub InitLogger()
|
||||
LogConfig = New LogConfig(LogConfig.PathType.AppData, Nothing, Nothing, Application.CompanyName, Application.ProductName)
|
||||
Logger = LogConfig.GetLogger()
|
||||
_DataASorDB = New ClassDataASorDB(LogConfig)
|
||||
Try
|
||||
Dim directory As New IO.DirectoryInfo(LogConfig.LogDirectory)
|
||||
|
||||
@ -132,7 +134,7 @@ Public Class ClassInit
|
||||
|
||||
If ConfigManager.Config.AppServerConfig <> String.Empty Then
|
||||
Try
|
||||
Dim oSplit() As String = ConfigManager.Config.AppServerConfig.ToString.Split(":")
|
||||
Dim oSplit() As String = ConfigManager.Config.AppServerConfig.ToString.Split(";")
|
||||
Dim oAppServerAddress As String = oSplit(0)
|
||||
Dim oAppServerPort As Integer = 9000
|
||||
If oSplit.Length = 2 Then
|
||||
@ -173,10 +175,18 @@ Public Class ClassInit
|
||||
Return EncryptedConnectionString
|
||||
End If
|
||||
End Function
|
||||
Public Shared Function CheckModuleData()
|
||||
Public Function CheckModuleData()
|
||||
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)
|
||||
Dim oSql = String.Format("SELECT * FROM [dbo].[FNDD_CHECK_USER_MODULE] ('{0}','CW',{1})", USER_USERNAME, CLIENT_SELECTED)
|
||||
Dim DT_CHECKUSER_MODULE As DataTable
|
||||
DT_CHECKUSER_MODULE = _DataASorDB.GetDatatable(oSql, "TBDD_USER_MODULE", $"USERNAME = '{USER_USERNAME.ToLower}' AND MODULE_SHORT = 'CW'", "", "")
|
||||
|
||||
'If APPSERVER_ACTIVE = True Then
|
||||
' Dim oTableResult As TableResult = _Client.GetDatatableByName("TBDD_USER_MODULE", $"USERNAME = '{USER_USERNAME.ToLower}' AND MODULE_SHORT = 'CW'")
|
||||
' DT_CHECKUSER_MODULE = oTableResult.Table
|
||||
'Else
|
||||
' DT_CHECKUSER_MODULE = Database.GetDatatable(oSql)
|
||||
'End If
|
||||
If DT_CHECKUSER_MODULE.Rows.Count = 0 Then
|
||||
Logger.Info("DT_CHECKUSER_MODULE.Rows.Count = 0", True)
|
||||
'ERROR_STATE = "NO USER"
|
||||
@ -259,13 +269,16 @@ Public Class ClassInit
|
||||
If CheckModuleData() = False Then
|
||||
Return False
|
||||
End If
|
||||
If APPSERVER_ACTIVE = True Then
|
||||
Dim oTableResult As TableResult = _Client.GetDatatableByName("VWDD_USER_CLIENT", $"USER_ID = {USER_ID}")
|
||||
Dim oSQL1 = String.Format("SELECT * FROM VWDD_USER_CLIENT WHERE UPPER(USERNAME) = UPPER('{0}')", Environment.UserName)
|
||||
DT_CLIENT_USER = _DataASorDB.GetDatatable(oSQL1, "VWDD_USER_CLIENT", $"USER_ID = {USER_ID}", "", "")
|
||||
|
||||
DT_CLIENT_USER = oTableResult.Table
|
||||
Else
|
||||
DT_CLIENT_USER = Database.GetDatatable(String.Format("SELECT * FROM VWDD_USER_CLIENT WHERE UPPER(USERNAME) = UPPER('{0}')", Environment.UserName))
|
||||
End If
|
||||
'If APPSERVER_ACTIVE = True Then
|
||||
' Dim oTableResult As TableResult = _Client.GetDatatableByName("VWDD_USER_CLIENT", $"USER_ID = {USER_ID}")
|
||||
|
||||
' DT_CLIENT_USER = oTableResult.Table
|
||||
'Else
|
||||
' DT_CLIENT_USER = Database.GetDatatable(String.Format("SELECT * FROM VWDD_USER_CLIENT WHERE UPPER(USERNAME) = UPPER('{0}')", Environment.UserName))
|
||||
'End If
|
||||
If Not IsNothing(DT_CLIENT_USER) Then
|
||||
|
||||
If DT_CLIENT_USER.Rows.Count > 1 Then
|
||||
@ -362,13 +375,23 @@ Public Class ClassInit
|
||||
|
||||
End Function
|
||||
|
||||
Public Shared Sub Refresh_Connections()
|
||||
Public Sub Refresh_Connections()
|
||||
Try
|
||||
Dim oSql = String.Format("SELECT * FROM TBDD_CONNECTION")
|
||||
Dim oDatatable As New MyDataset.TBDD_CONNECTIONDataTable()
|
||||
Dim oResult = Database.GetDatatable(oSql)
|
||||
Dim oResult As DataTable
|
||||
oDatatable = _DataASorDB.GetDatatable(oSql, "TBDD_CONNECTION", "", "", "")
|
||||
|
||||
oDatatable.Merge(oResult)
|
||||
|
||||
'If APPSERVER_ACTIVE = True Then
|
||||
' Dim oTableResult As TableResult = _Client.GetDatatableByName("TBDD_CONNECTION")
|
||||
' oResult = oTableResult.Table
|
||||
|
||||
'Else
|
||||
' oResult = Database.GetDatatable(oSql)
|
||||
'End If
|
||||
|
||||
'oDatatable.Merge(oResult)
|
||||
|
||||
DT_CONNECTIONS = oDatatable
|
||||
Catch ex As Exception
|
||||
|
||||
@ -166,6 +166,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="ClassAutomation.vb" />
|
||||
<Compile Include="ClassClipboardWatcher.vb" />
|
||||
<Compile Include="ClassDataASorDB.vb" />
|
||||
<Compile Include="ClassDragDrop.vb" />
|
||||
<Compile Include="ClassWindow.vb" />
|
||||
<Compile Include="ClassConfig.vb" />
|
||||
|
||||
@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
|
||||
' übernehmen, indem Sie "*" eingeben:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("2.0.0.15")>
|
||||
<Assembly: AssemblyVersion("2.1.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
|
||||
@ -7,6 +7,7 @@ Public Class frmAdministration
|
||||
|
||||
Private Const MAX_DATA_SEARCHES = 5
|
||||
Private Const MAX_DOC_SEARCHES = 5
|
||||
Private _DataASorDB As ClassDataASorDB
|
||||
|
||||
Class ProfileType
|
||||
Public Name As String
|
||||
@ -53,6 +54,7 @@ Public Class frmAdministration
|
||||
End Function
|
||||
|
||||
Private Sub frmAdministration_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
_DataASorDB = New ClassDataASorDB(modCurrent.LogConfig)
|
||||
' Select first tab to prevent profile textbox from being empty
|
||||
XtraTabControl3.SelectedTabPageIndex = 0
|
||||
|
||||
@ -637,7 +639,7 @@ Public Class frmAdministration
|
||||
End Sub
|
||||
|
||||
Private Sub frmAdministration_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
|
||||
ClassInit.Refresh_Connections()
|
||||
_DataASorDB.Refresh_Connections()
|
||||
ClassInit.Refresh_Profile_Links()
|
||||
End Sub
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ Public Class frmMain
|
||||
'Private WithEvents _Watcher As ClipboardWatcher = ClipboardWatcher.Singleton
|
||||
Private WithEvents _Watcher2 As ClassClipboardWatcher = ClassClipboardWatcher.Singleton
|
||||
Private _MatchForm As frmMatch = Nothing
|
||||
Private _DataASorDB As ClassDataASorDB
|
||||
Public Sub New()
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
InitializeComponent()
|
||||
@ -24,6 +25,7 @@ Public Class frmMain
|
||||
CultureInfo.DefaultThreadCurrentCulture = cultureInfo
|
||||
CultureInfo.DefaultThreadCurrentUICulture = cultureInfo
|
||||
End If
|
||||
_DataASorDB = New ClassDataASorDB(modCurrent.LogConfig)
|
||||
End Sub
|
||||
|
||||
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
@ -43,7 +45,7 @@ Public Class frmMain
|
||||
End If
|
||||
NotifyIconMain.Visible = True
|
||||
ClassInit.Refresh_Profile_Links()
|
||||
ClassInit.Refresh_Connections()
|
||||
_DataASorDB.Refresh_Connections()
|
||||
Try
|
||||
Hotkey.AddHotKey(Keys.T, ClassHotkey.ModfierKey.MOD_CONTROL, HOTKEY_TOGGLE_WATCHER)
|
||||
Dim oKeyCode As Keys
|
||||
@ -80,7 +82,7 @@ Public Class frmMain
|
||||
RibbonPageGroup1.Visible = False
|
||||
RibbonControl1.Minimized = True
|
||||
End If
|
||||
lblVersion.Caption = String.Format(lblVersion.Caption, My.Application.Info.Version.ToString)
|
||||
lblVersion.Caption = My.Application.Info.Version.ToString
|
||||
lblUser.Caption = String.Format(lblUser.Caption, USER_USERNAME)
|
||||
Catch ex As Exception
|
||||
Logger.Warn($"Unexpected Error in FormLoad2: {ex.Message}")
|
||||
@ -369,11 +371,12 @@ Public Class frmMain
|
||||
Private Sub RefreshUI()
|
||||
Dim oResultText = ClassInit.Refresh_Profile_Links()
|
||||
lblRefresh.Caption = ""
|
||||
ClassInit.CheckModuleData()
|
||||
_DataASorDB.CheckModuleData()
|
||||
'ClassInit.CheckModuleData()
|
||||
labelStatus.Text = oResultText
|
||||
labelRefresh.Text = $"Aktualisiert: {Now.ToShortTimeString}"
|
||||
lblRefresh.Caption = $"Eingeloggte Benutzer: {USERCOUNT_LOGGED_IN}"
|
||||
lblVersion.Caption = String.Format(lblVersion.Caption, My.Application.Info.Version.ToString)
|
||||
lblVersion.Caption = My.Application.Info.Version.ToString
|
||||
lblUser.Caption = String.Format(lblUser.Caption, USER_USERNAME)
|
||||
labelHotkey.Text = String.Format(labelHotkey.Text, $"{HotkeyFunctionKey.ToUpper}+{HotkeySearchKey.ToUpper}")
|
||||
End Sub
|
||||
|
||||
2
app/DD_Clipboard_Searcher/frmStart.Designer.vb
generated
2
app/DD_Clipboard_Searcher/frmStart.Designer.vb
generated
@ -266,7 +266,7 @@ Partial Class frmStart
|
||||
'
|
||||
Me.btnAdminConfig.Image = Global.DD_Clipboard_Watcher.My.Resources.Resources.Editdatasetwithdesigner_8449
|
||||
Me.btnAdminConfig.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
|
||||
Me.btnAdminConfig.Location = New System.Drawing.Point(182, 12)
|
||||
Me.btnAdminConfig.Location = New System.Drawing.Point(188, 54)
|
||||
Me.btnAdminConfig.Name = "btnAdminConfig"
|
||||
Me.btnAdminConfig.Size = New System.Drawing.Size(151, 32)
|
||||
Me.btnAdminConfig.TabIndex = 13
|
||||
|
||||
@ -4663,7 +4663,7 @@
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABU
|
||||
CwAAAk1TRnQBSQFMAgEBBQEAAWABAAFgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
CwAAAk1TRnQBSQFMAgEBBQEAAWgBAAFoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
|
||||
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
|
||||
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
|
||||
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
|
||||
|
||||
@ -45,7 +45,7 @@ Public Class frmStart
|
||||
End If
|
||||
NotifyIconMain.Visible = True
|
||||
ClassInit.Refresh_Profile_Links()
|
||||
ClassInit.Refresh_Connections()
|
||||
' ClassInit.Refresh_Connections()
|
||||
Hotkey.AddHotKey(Keys.T, ClassHotkey.ModfierKey.MOD_CONTROL, HOTKEY_TOGGLE_WATCHER)
|
||||
Dim oKeyCode As Keys
|
||||
Dim oConverter As New KeysConverter
|
||||
@ -362,7 +362,7 @@ Public Class frmStart
|
||||
Private Sub RefreshUI()
|
||||
Dim oResultText = ClassInit.Refresh_Profile_Links()
|
||||
lblrefresh.Text = ""
|
||||
ClassInit.CheckModuleData()
|
||||
'ClassInit.CheckModuleData()
|
||||
labelStatus.Text = oResultText
|
||||
labelRefresh.Text = $"Aktualisiert: {Now.ToShortTimeString}"
|
||||
lblrefresh.Text = $"Eingeloggte Benutzer: {USERCOUNT_LOGGED_IN}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user