From 77ee9012335f2a299353d26efdb00765f074a996 Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Thu, 31 Oct 2019 10:17:21 +0100 Subject: [PATCH] Bugfixing CountDocs --- .../DesignTimeBuild/.dtbcache | Bin 242 -> 242 bytes app/DD_Clipboard_Searcher/frmStart.vb | 119 +++++++++--------- 2 files changed, 63 insertions(+), 56 deletions(-) diff --git a/app/.vs/DD_Clipboard_Watcher/DesignTimeBuild/.dtbcache b/app/.vs/DD_Clipboard_Watcher/DesignTimeBuild/.dtbcache index fde4aa0fc606d77a3efa91faa4c53cf9396702d0..91d9f172090463caf57078d9ca7334b34d5fa95b 100644 GIT binary patch delta 48 zcmeyw_=$0Xh-?-E1A{Ar6+;X|Fhep!215};Dnlki5|Aun@SUhB&+5+L$q+KpbuIu9 CybA^Z delta 51 zcmeyw_=$0Xh-eZ61A{Ar6+;Yz7egvT9uTH7cuh2vpBOPqpn#!>A)g_O;f{P=AP55h DOdAc_ diff --git a/app/DD_Clipboard_Searcher/frmStart.vb b/app/DD_Clipboard_Searcher/frmStart.vb index 67c0652..2a68507 100644 --- a/app/DD_Clipboard_Searcher/frmStart.vb +++ b/app/DD_Clipboard_Searcher/frmStart.vb @@ -189,66 +189,73 @@ Public Class frmStart End If End Sub Sub CHECK_PROFILE_MATCH() + Logger.Debug("...now CHECK_PROFILE_MATCH...") Dim oProfiles = CURRENT_MATCHING_PROFILES - Dim oInvalidDocumentSQL = False - Dim oInvalidDataSQL = False + 'Dim oInvalidDocumentSQL = False + 'Dim oInvalidDataSQL = False - Dim oPatterns As New ClassPatterns(LogConfig) + 'Dim oPatterns As New ClassPatterns(LogConfig) Dim oEnv = GetEnvironment() - For Each oProfile In oProfiles - Dim oResultDocs As Integer = 0 - Dim oResultData As Integer = 0 - - Dim oDataSearches As DataTable = Database.GetDatatable($"SELECT COUNT_COMMAND FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {oProfile.Guid}") - Dim oDocSearches As DataTable = Database.GetDatatable($"SELECT COUNT_COMMAND FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {oProfile.Guid}") - - For Each oRow As DataRow In oDataSearches.Rows - Dim oCountCommand = String.Empty - Try - oCountCommand = oRow.Item("COUNT_COMMAND") - - If oCountCommand = String.Empty Then - Continue For - End If - - oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, oEnv.User) - oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand) - - oResultData += Database.GetScalarValue(oCountCommand) - Catch ex As Exception - Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) - oInvalidDataSQL = True - End Try - Next - - For Each oRow As DataRow In oDocSearches.Rows - Dim oCountCommand = String.Empty - Try - oCountCommand = oRow.Item("COUNT_COMMAND") - - If oCountCommand = String.Empty Then - Continue For - End If - - oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, oEnv.User) - oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand) - - oResultDocs += Database.GetScalarValue(oCountCommand) - Catch ex As Exception - Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) - oInvalidDocumentSQL = True - End Try - Next - - oProfile.CountData = oResultData - oProfile.CountDocs = oResultDocs - Next - - If oInvalidDocumentSQL Or oInvalidDataSQL Then - MsgBox("Ein oder mehrere Abfragen konnten nicht ausgeführt werden. Bitte überprüfen Sie das Log.", MsgBoxStyle.Exclamation, "Warnung") - Exit Sub - End If + 'For Each oProfile In oProfiles + ' Dim oResultDocs As Integer = 0 + ' Dim oResultData As Integer = 0 + + ' Dim oDataSearches As DataTable = Database.GetDatatable($"SELECT COUNT_COMMAND FROM TBCW_PROF_DATA_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {oProfile.Guid}") + ' Dim oDocSearches As DataTable = Database.GetDatatable($"SELECT COUNT_COMMAND FROM TBCW_PROF_DOC_SEARCH WHERE ACTIVE = 1 AND PROFILE_ID = {oProfile.Guid}") + + ' For Each oRow As DataRow In oDataSearches.Rows + ' Dim oCountCommand = String.Empty + ' Try + ' oCountCommand = oRow.Item("COUNT_COMMAND") + + ' If oCountCommand = String.Empty Then + ' Continue For + ' End If + + ' oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, oEnv.User) + ' oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand) + + ' oResultData += Database.GetScalarValue(oCountCommand) + ' Catch ex As Exception + ' Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) + ' oInvalidDataSQL = True + ' End Try + ' Next + + ' For Each oRow As DataRow In oDocSearches.Rows + ' Dim oCountCommand = String.Empty + ' Try + ' oCountCommand = oRow.Item("COUNT_COMMAND") + + ' If oCountCommand = String.Empty Then + ' Continue For + ' End If + + ' oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, oEnv.User) + ' oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand) + ' Logger.Debug($"Now again checking countDocs: sql so far: {oCountCommand}") + ' oResultDocs += Database.GetScalarValue(oCountCommand) + ' Logger.Debug($"Now oResultDocs is: {oResultDocs}") + ' Catch ex As Exception + ' Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) + ' oInvalidDocumentSQL = True + ' End Try + ' Next + + ' oProfile.CountData = oResultData + ' If oProfile.CountDocs > 0 Then + ' Logger.Debug($"For hell no replacing JJ as CountDocs already has a result > 0!!!") + ' Else + ' oProfile.CountDocs = oResultDocs + ' End If + + 'Next + + 'If oInvalidDocumentSQL Or oInvalidDataSQL Then + ' MsgBox("Ein oder mehrere Abfragen konnten nicht ausgeführt werden. Bitte überprüfen Sie das Log.", MsgBoxStyle.Exclamation, "Warnung") + ' Exit Sub + 'End If Dim oParams = New ClipboardWatcherParams() With { .ClipboardContents = CURRENT_CLIPBOARD_CONTENTS,