diff --git a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb index 2e513db0..1d7b7573 100644 --- a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb +++ b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb @@ -241,7 +241,7 @@ Public Class frmDocumentResultList Private Function LoadFile_IDB(GridRow As DataRow) As DocumentResultInfo Try Dim oObjectId = GridRow.Item(COLUMN_DOCID) - _Logger.Debug($"Getting Information for oObjectId: {oObjectId}") + _Logger.Debug("Loading Information for ObjectId: [{0}]", oObjectId) ' This needs to be Sync bc otherwise the PopupMenuShowing event will fire before this method loaded the Document Info Dim oDocumentInfo As DocumentInfo = _IDBClient.GetDocumentInfo(_Environment.User.UserId, oObjectId) @@ -249,34 +249,47 @@ Public Class frmDocumentResultList .AccessRight = oDocumentInfo.AccessRight, .FullPath = oDocumentInfo.FullPath } + _Logger.Debug("Successfully loaded Information for ObjectId: [{0}]", oObjectId) + _Logger.Debug("Loading file [{0}]", oResultDocumentInfo.FullPath) If File.Exists(oResultDocumentInfo.FullPath) Then oResultDocumentInfo = LoadFile_AsByteArray(oResultDocumentInfo) _OpenDocuments.Add(oResultDocumentInfo) _CurrentDocument = oResultDocumentInfo + Else + _Logger.Warn("File [{0}] does not exist.", oResultDocumentInfo.FullPath) End If - _Logger.Debug($"Got Info for oObjectId: {oObjectId}!") + _Logger.Debug("Successfully loaded File [{0}]", oResultDocumentInfo.FullPath) + Return oResultDocumentInfo + Catch ex As Exception _Logger.Error(ex) Return Nothing + End Try End Function Private Function LoadFile_AsByteArray(DocumentInfo As DocumentResultInfo) As DocumentResultInfo Try + _Logger.Debug("Loading File [{0}]", DocumentInfo.FullPath) Dim oFullPath As String = DocumentInfo.FullPath Dim oPathExists = From oFile In _OpenDocuments Where oFile.FullPath = oFullPath And oFile.Contents IsNot Nothing Select oFile + Dim oExistsInCache = oPathExists.Count() > 0 Dim oSizeChanged = False Dim oWriteTimeChanged = False + _Logger.Debug("File exists in Cache: [{0}]", oExistsInCache) + ' Get Information about the file on the filesystem Dim oFileInfo As New FileInfo(oFullPath) If oExistsInCache Then + _Logger.Debug("Loading file from cache.") + Dim oCachedItem = oPathExists.First() If oCachedItem.Contents Is Nothing Then @@ -284,37 +297,29 @@ Public Class frmDocumentResultList Else oSizeChanged = Not (oFileInfo.Length = oCachedItem.Contents.Length) End If + _Logger.Debug("Filesize changed: [{0}]", oSizeChanged) If oCachedItem.LastWriteTime = Nothing Then oWriteTimeChanged = False Else oWriteTimeChanged = Not oFileInfo.LastWriteTime.Equals(oCachedItem.LastWriteTime) End If + _Logger.Debug("Write-time changed: [{0}]", oWriteTimeChanged) If oSizeChanged Or oWriteTimeChanged Then - Using oStream = File.OpenRead(DocumentInfo.FullPath) - Using oMemoryStream = New MemoryStream() - oStream.CopyTo(oMemoryStream) - DocumentInfo.Contents = oMemoryStream.ToArray() - DocumentInfo.LastWriteTime = oFileInfo.LastWriteTime - End Using - End Using + _Logger.Debug("Size or Write-time changed, loading from disk.") - Return DocumentInfo + Return LoadFile_FromDisk(DocumentInfo, oFileInfo) Else + _Logger.Debug("Loading from cache") + Return oCachedItem End If Else - Using oStream = File.OpenRead(DocumentInfo.FullPath) - Using oMemoryStream = New MemoryStream() - oStream.CopyTo(oMemoryStream) - DocumentInfo.Contents = oMemoryStream.ToArray() - DocumentInfo.LastWriteTime = oFileInfo.LastWriteTime - End Using - End Using + _Logger.Debug("File exists in cache, loading from disk.") - Return DocumentInfo + Return LoadFile_FromDisk(DocumentInfo, oFileInfo) End If Catch ex As Exception @@ -323,6 +328,22 @@ Public Class frmDocumentResultList End Try End Function + Private Function LoadFile_FromDisk(pDocumentInfo As DocumentResultInfo, pFileInfo As FileInfo) As DocumentResultInfo + Using oStream = File.OpenRead(pDocumentInfo.FullPath) + _Logger.Debug("File opened.") + + Using oMemoryStream = New MemoryStream() + _Logger.Debug("Copying file contents to memory stream.") + oStream.CopyTo(oMemoryStream) + pDocumentInfo.Contents = oMemoryStream.ToArray() + pDocumentInfo.LastWriteTime = pFileInfo.LastWriteTime + _Logger.Debug("Successfully copied file contents to memory stream.") + End Using + End Using + + Return pDocumentInfo + End Function + Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults _IsLoading = True Try diff --git a/GUIs.Common/My Project/AssemblyInfo.vb b/GUIs.Common/My Project/AssemblyInfo.vb index f07881ad..c572eb30 100644 --- a/GUIs.Common/My Project/AssemblyInfo.vb +++ b/GUIs.Common/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.vb b/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.vb index 133116ac..68968ad0 100644 --- a/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.vb +++ b/GUIs.Common/ObjectPropertyDialog/frmObjectPropertyDialog.vb @@ -170,6 +170,10 @@ Public Class frmObjectPropertyDialog Dim oAttributes = Await GetAttributesForBusinessEntity(oEntityId) + If oAttributes.Count = 0 Then + MsgBox($"Es konnten keine Attribute für das Objekt '{_ObjectId}' geladen werden!", MsgBoxStyle.Critical, Text) + End If + For Each oAttribute As Attribute In oAttributes Dim oControl = _Controls.GetControlForAttribute(oAttribute, True) Dim oItem As LayoutControlItem = AttributeLayout.AddItem() @@ -230,4 +234,8 @@ Public Class frmObjectPropertyDialog Return False End Try End Function + + Private Sub TabFormControl1_Click(sender As Object, e As EventArgs) Handles TabFormControl1.Click + + End Sub End Class \ No newline at end of file diff --git a/GUIs.ZooFlow/frmFlowForm.vb b/GUIs.ZooFlow/frmFlowForm.vb index e981e38e..4a3ef323 100644 --- a/GUIs.ZooFlow/frmFlowForm.vb +++ b/GUIs.ZooFlow/frmFlowForm.vb @@ -858,27 +858,42 @@ Public Class frmFlowForm oState.CurrentClipboardContents = ClipboardContents If oState.MonitoringActive = False Then - Logger.Info("Clipboard Watcher is not active!") + Dim oMessage As String = "Clipboard Watcher is not active!" + Logger.Info(oMessage) + MsgBox(oMessage, MsgBoxStyle.Critical, Text) + Exit Sub End If If oState.UserProfiles Is Nothing Then - Logger.Warn("User Profiles is empty!") + Dim oMessage As String = "User Profiles are empty!" + Logger.Info(oMessage) + MsgBox(oMessage, MsgBoxStyle.Critical, Text) + Exit Sub End If If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then - Logger.Warn("Profile Processes is empty!") + Dim oMessage As String = "Profile Processes are empty!" + Logger.Info(oMessage) + MsgBox(oMessage, MsgBoxStyle.Critical, Text) + Exit Sub End If If oState.ProfileWindows Is Nothing OrElse oState.ProfileWindows.Rows.Count = 0 Then - Logger.Warn("Profile Processes is empty!") + Dim oMessage As String = "Profile Processes are empty!" + Logger.Info(oMessage) + MsgBox(oMessage, MsgBoxStyle.Critical, Text) + Exit Sub End If If oState.ProfileProcesses Is Nothing OrElse oState.ProfileProcesses.Rows.Count = 0 Then - Logger.Warn("Profile Processes is empty!") + Dim oMessage As String = "Profile Processes are empty!" + Logger.Info(oMessage) + MsgBox(oMessage, MsgBoxStyle.Critical, Text) + Exit Sub End If @@ -894,7 +909,7 @@ Public Class frmFlowForm oState.MatchTreeView) Catch ex As Exception Logger.Error(ex) - MsgBox("Fehler beim Laden der Profile. Möglicherweise liegt ein Konfigurationsfehler vor. Mehr Informationen im Log.", MsgBoxStyle.Critical, Text) + MsgBox("Fehler beim Laden der Profile. Möglicherweise liegt ein Konfigurationsfehler vor. Fehlermeldung: " & ex.Message, MsgBoxStyle.Critical, Text) End Try Try diff --git a/Modules.EDMIAPI/DatabaseWithFallback.vb b/Modules.EDMIAPI/DatabaseWithFallback.vb index e630308a..afa45129 100644 --- a/Modules.EDMIAPI/DatabaseWithFallback.vb +++ b/Modules.EDMIAPI/DatabaseWithFallback.vb @@ -23,10 +23,18 @@ Public Class DatabaseWithFallback Dim oResult As DataTable = Nothing If ForceFallback = False Then - Dim oTableResult As TableResult = _Client.GetDatatableByName(DataTable, FilterExpression, SortByColumn) + Dim oTableResult As TableResult + + Try + oTableResult = _Client.GetDatatableByName(DataTable, FilterExpression, SortByColumn) + Catch ex As Exception + _Logger.Error(ex) + oTableResult = Nothing + End Try If oTableResult Is Nothing OrElse oTableResult.OK = False Then _Logger.Warn("Datatable [{0}] could not be fetched from AppServer Cache. Falling back to direct Database Access.") + Return GetDatatableFromDatabase(FallbackSQL, FallbackType) End If Return oTableResult.Table diff --git a/Modules.EDMIAPI/My Project/AssemblyInfo.vb b/Modules.EDMIAPI/My Project/AssemblyInfo.vb index 06681627..d369d531 100644 --- a/Modules.EDMIAPI/My Project/AssemblyInfo.vb +++ b/Modules.EDMIAPI/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Service.EDMIService/EDMIService.vb b/Service.EDMIService/EDMIService.vb index 2a1629f3..fbae51ff 100644 --- a/Service.EDMIService/EDMIService.vb +++ b/Service.EDMIService/EDMIService.vb @@ -658,10 +658,14 @@ Public Class EDMIService Return AccessRight.VIEW_ONLY End If + _Logger.Debug("Getting AccessRights for ObjectId [{0}]", ObjectId) Dim oTable As DataTable = GlobalState.TableStore.Tables.Item(TBIDB_ACCESSRIGHT) Dim oRows As List(Of DataRow) = oTable.Select($"IDB_OBJ_ID = {ObjectId} AND USR_ID = {UserId}").ToList() Dim oRight As AccessRight + _Logger.Debug("Successfully got AccessRights for ObjectId [{0}]", ObjectId) + _Logger.Debug("Parsing AccessRights for ObjectId [{0}]", ObjectId) + If oRows.Count = 0 Then _Logger.Warn("GetAccessRightForObjectId: Access right assignment does not exist for user [{0}] on object [{1}]", UserId, ObjectId) Return AccessRight.VIEW_ONLY @@ -676,6 +680,9 @@ Public Class EDMIService oRight = Utils.ToEnum(Of AccessRight)(oRightAsInt) End If + _Logger.Debug("Successfully parsed AccessRights for ObjectId [{0}]", ObjectId) + _Logger.Debug("AccessRight for ObjectId [{0}] is [{1}]", ObjectId, oRight.ToString) + Return oRight Catch ex As Exception _Logger.Warn("GetAccessRightForObjectId: Unexpected Error while getting access right for object [{0}].", ObjectId) diff --git a/Service.EDMIService/My Project/AssemblyInfo.vb b/Service.EDMIService/My Project/AssemblyInfo.vb index a9325cf9..2d234bfa 100644 --- a/Service.EDMIService/My Project/AssemblyInfo.vb +++ b/Service.EDMIService/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - - + + diff --git a/Service.EDMIService/Scheduler/DatatableJob.vb b/Service.EDMIService/Scheduler/DatatableJob.vb index 8a09c2d5..934ffffa 100644 --- a/Service.EDMIService/Scheduler/DatatableJob.vb +++ b/Service.EDMIService/Scheduler/DatatableJob.vb @@ -36,6 +36,7 @@ Public Class DatatableJob Dim oConnectionId As Integer = NotNull(oRow.Item("CON_ID"), String.Empty) Dim oTitle As String = NotNull(oRow.Item("TITLE"), String.Empty) Dim oSQL As String = NotNull(oRow.Item("COMMAND"), String.Empty) + Dim oIndexColumns As String = NotNull(oRow.Item("INDEX_COLUMNS"), String.Empty) Try oLogger.Debug("Running Command-Job [{0}]", oTitle) @@ -46,10 +47,22 @@ Public Class DatatableJob Dim oTable = oMSSQL.GetDatatableWithConnection(oSQL, oConnectionString, COMMAND_SQL_TIMEOUT) oTable.TableName = oDatatableName + + Dim oView As DataView = Nothing + + ' This creates an Index for the columns specified in INDEX_COLUMNS to speed up calls to 'Table.Select'! + If oIndexColumns <> String.Empty Then + oLogger.Debug("Adding indexes for Table: [{0}]", oIndexColumns) + oView = New DataView(oTable) With { + .Sort = oIndexColumns + } + End If + oLogger.Debug("Result Datatable [{0}] contains [{1}] rows", oTable.TableName, oTable.Rows.Count) Dim oResultTable = New JobResult.ResultTable() With { .Table = oTable, + .View = oView, .DetailRow = oRow } diff --git a/Service.EDMIService/Scheduler/JobResult.vb b/Service.EDMIService/Scheduler/JobResult.vb index a9736f69..8f40cafd 100644 --- a/Service.EDMIService/Scheduler/JobResult.vb +++ b/Service.EDMIService/Scheduler/JobResult.vb @@ -3,6 +3,7 @@ Public Class ResultTable Public Table As DataTable + Public View As DataView Public ChildTable As DataTable Public TableRelationColumn As String Public ChildRelationColumn As String