6 Commits

Author SHA1 Message Date
Jonathan Jenne
7051a71e01 ClipboardWatcher: Version 1.0.0.4 2020-10-20 12:33:45 +02:00
Jonathan Jenne
425c4be388 use correct connectionstring when querying for documents 2020-10-20 12:33:13 +02:00
Jonathan Jenne
a6b9e5c8c1 Common: Version 1.0.0.2 2020-10-20 12:32:22 +02:00
Jonathan Jenne
3050cd6fe8 correctly show columns datatypes 2020-10-20 12:31:45 +02:00
Jonathan Jenne
921422cd57 Database: Version 1.2.0.1 2020-10-20 11:47:29 +02:00
Jonathan Jenne
ffa3159c43 use connectiong string in getscalarvaluewithconnection 2020-10-20 11:46:52 +02:00
6 changed files with 128 additions and 105 deletions

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("1.0.0.3")> <Assembly: AssemblyVersion("1.0.0.4")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.4")>

View File

@@ -362,48 +362,58 @@ Public Class ProfileFilter
For Each oRow As DataRow In oDTDataSearches.Rows For Each oRow As DataRow In oDTDataSearches.Rows
Dim oCountCommand = String.Empty Dim oCountCommand = String.Empty
Dim oCountConnectionId = String.Empty Dim oCountConnectionId = String.Empty
Try Try
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty) oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
oCountConnectionId = NotNull(oRow.Item("CONN_ID"), 0) oCountConnectionId = NotNull(oRow.Item("CONN_ID"), 0)
If oCountCommand = String.Empty Then If oCountCommand = String.Empty Then
_Logger.Debug("oCountCommand = String.Empty ==> Continue for") _Logger.Debug("Data SQL Query is empty. Skipping.")
Continue For Continue For
End If End If
_Logger.Debug("Count-Command DATA BEFORE Replace: [{0}]", oCountCommand)
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand) oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User) oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents) oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
_Logger.Debug($"Count-Command DATA before execute: [{oCountCommand}]") _Logger.Debug("Count-Command DATA before execute: [{0}]", oCountCommand)
Dim oConnectionString = ProfileUtils.GetConnectionString(Database, oCountConnectionId) Dim oConnectionString = ProfileUtils.GetConnectionString(Database, oCountConnectionId)
oResultData += NotNull(Of Integer)(Database.GetScalarValueWithConnection(oCountCommand, oConnectionString), 0) oResultData += NotNull(Of Integer)(Database.GetScalarValueWithConnection(oCountCommand, oConnectionString), 0)
_Logger.Debug("Datarows returned from search: [{0}]", oResultData)
Catch ex As Exception Catch ex As Exception
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) _Logger.Error(ex)
_Logger.Warn("Invalid SQL Query for Counting Data in Profile [{0}]: [{1}]", oProfile.Guid, oCountCommand)
End Try End Try
Next Next
For Each oRow As DataRow In oDTDocSearches.Rows For Each oRow As DataRow In oDTDocSearches.Rows
Dim oCountCommand = String.Empty Dim oCountCommand = String.Empty
Dim oCountConnectionId = String.Empty
Try Try
oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty) oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty)
oCountConnectionId = NotNull(oRow.Item("CONN_ID"), 0)
If oCountCommand = String.Empty Then If oCountCommand = String.Empty Then
_Logger.Debug("Document SQL Query is empty. Skipping.")
Continue For Continue For
End If End If
_Logger.Debug($"Count-Command DOCS BEFORE Replace: {oCountCommand}")
_Logger.Debug("Count-Command for Documents BEFORE Replace: [{0}]", oCountCommand)
oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand) oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand)
' _Logger.Debug($"Count-Command DOCS AFTER ReplaceInternalValues: {oCountCommand}")
oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User) oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User)
' _Logger.Debug($"Count-Command DOCS AFTER ReplaceUserValues: {oCountCommand}")
oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents) oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents)
_Logger.Debug($"Count-Command DOCS BEFORE execute: {oCountCommand}")
oResultDocs += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0) _Logger.Debug("Count-Command for Documents BEFORE execute: [{0}]", oCountCommand)
_Logger.Debug($"oResultDocs: {oResultDocs}") Dim oConnectionString = ProfileUtils.GetConnectionString(Database, oCountConnectionId)
oResultDocs += NotNull(Of Integer)(Database.GetScalarValueWithConnection(oCountCommand, oConnectionString), 0)
_Logger.Debug("Documents returned from search: [{0}]", oResultDocs)
Catch ex As Exception Catch ex As Exception
_Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) _Logger.Error(ex)
_Logger.Warn("Invalid SQL Query for Counting Data in Profile [{0}]: [{1}]", oProfile.Guid, oCountCommand)
End Try End Try
Next Next
@@ -414,7 +424,7 @@ Public Class ProfileFilter
For Each oProfile In Profiles For Each oProfile In Profiles
If oProfile.CountData > 0 Or oProfile.CountDocs > 0 Then If oProfile.CountData > 0 Or oProfile.CountDocs > 0 Then
oProfiles.Add(oProfile) oProfiles.Add(oProfile)
_Logger.Info("Profile {0} matched in FilterProfilesBySearchResults!", oProfile.Name) _Logger.Info("Profile [{0}] matched in FilterProfilesBySearchResults!", oProfile.Name)
End If End If
Next Next

View File

@@ -155,6 +155,8 @@ Public Class frmDocumentResultList
Private Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs) Private Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs)
_ActiveRowHandle = e.FocusedRowHandle _ActiveRowHandle = e.FocusedRowHandle
DocumentViewer1.CloseDocument()
If e.FocusedRowHandle >= 0 Then If e.FocusedRowHandle >= 0 Then
Dim oRow = sender.GetDataRow(e.FocusedRowHandle) Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
Dim oFullPath = oRow.Item(COLUMN_FILEPATH) Dim oFullPath = oRow.Item(COLUMN_FILEPATH)
@@ -163,89 +165,54 @@ Public Class frmDocumentResultList
End Sub End Sub
Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable) Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable)
Dim oMyDocDatatable As New DataTable Dim oDocDatatable As New DataTable
Try Try
'Die Icon Colum erstellen und konfigurieren 'Die Icon Colum erstellen und konfigurieren
oMyDocDatatable.Columns.Add(New DataColumn() With { oDocDatatable.Columns.Add(New DataColumn() With {
.DataType = GetType(Image), .DataType = GetType(Image),
.ColumnName = COLUMN_ICON, .ColumnName = COLUMN_ICON,
.Caption = "" .Caption = ""
}) })
oMyDocDatatable.Columns.Add(New DataColumn() With { oDocDatatable.Columns.Add(New DataColumn() With {
.DataType = GetType(String), .DataType = GetType(String),
.ColumnName = COLUMN_FILEPATH, .ColumnName = COLUMN_FILEPATH,
.Caption = "Fullpath" .Caption = "Fullpath"
}) })
oMyDocDatatable.Columns.Add(New DataColumn() With { oDocDatatable.Columns.Add(New DataColumn() With {
.DataType = GetType(Int32), .DataType = GetType(Int32),
.ColumnName = "DocID", .ColumnName = COLUMN_DOCID,
.Caption = "DocID" .Caption = "DocID"
}) })
oMyDocDatatable.Columns.Add(New DataColumn() With { oDocDatatable.Columns.Add(New DataColumn() With {
.DataType = GetType(String), .DataType = GetType(String),
.ColumnName = "Filename", .ColumnName = "Filename",
.Caption = "Filename" .Caption = "Filename"
}) })
Dim oRestColArray As New List(Of String) Dim oRestColArray As New List(Of String)
For Each oCol As DataColumn In Datatable.Columns For Each oColumn As DataColumn In Datatable.Columns
Dim onewColumn As New DataColumn() If oColumn.ColumnName <> COLUMN_DOCID And oColumn.ColumnName <> COLUMN_FILEPATH And oColumn.ColumnName <> COLUMN_FILENAME Then
If oCol.ColumnName <> "DocID" And oCol.ColumnName <> COLUMN_FILEPATH And oCol.ColumnName <> "Filename" Then Dim oNewColumn As New DataColumn() With {
onewColumn.DataType = GetType(String) .DataType = oColumn.DataType,
onewColumn.ColumnName = oCol.ColumnName .ColumnName = oColumn.ColumnName,
onewColumn.Caption = oCol.Caption .Caption = oColumn.Caption
oMyDocDatatable.Columns.Add(onewColumn) }
oRestColArray.Add(onewColumn.ColumnName)
End If
oDocDatatable.Columns.Add(oNewColumn)
oRestColArray.Add(oNewColumn.ColumnName)
End If
Next Next
For Each oRow As DataRow In Datatable.Rows For Each oRow As DataRow In Datatable.Rows
Dim oFullpath = oRow.Item(COLUMN_FILEPATH) Dim oFullpath = oRow.Item(COLUMN_FILEPATH)
Dim oDocID = oRow.Item("DocID") Dim oDocID = oRow.Item(COLUMN_DOCID)
'Dim Folderpath = Path.GetDirectoryName(fullpath) Dim oFilename = Path.GetFileName(oFullpath)
Dim oFilename = IO.Path.GetFileName(oFullpath)
Dim oFileextension = IO.Path.GetExtension(oFullpath)
Dim oNewRow As DataRow Dim oNewRow As DataRow
oNewRow = oMyDocDatatable.NewRow() oNewRow = oDocDatatable.NewRow()
'Icon zuweisen 'Icon zuweisen
Select Case oFileextension.ToUpper oNewRow.Item(0) = GetIconByExtension(oFullpath)
Case ".csv".ToUpper
oNewRow.Item(0) = My.Resources.xls
Case ".txt".ToUpper
oNewRow.Item(0) = My.Resources.txt
Case ".pdf".ToUpper
oNewRow.Item(0) = My.Resources.pdf
Case ".doc".ToUpper
oNewRow.Item(0) = My.Resources.doc
Case ".docx".ToUpper
oNewRow.Item(0) = My.Resources.doc
Case ".xls".ToUpper
oNewRow.Item(0) = My.Resources.xls
Case ".xlsx".ToUpper
oNewRow.Item(0) = My.Resources.xls
Case ".xlsm".ToUpper
oNewRow.Item(0) = My.Resources.xls
Case ".ppt".ToUpper
oNewRow.Item(0) = My.Resources.ppt
Case ".pptx".ToUpper
oNewRow.Item(0) = My.Resources.ppt
Case ".dwg".ToUpper
oNewRow.Item(0) = My.Resources.dwg
Case ".dxf".ToUpper
oNewRow.Item(0) = My.Resources.dxf
Case ".msg".ToUpper
oNewRow.Item(0) = My.Resources._page
Case ".msg".ToUpper
oNewRow.Item(0) = My.Resources._page
Case ".tif".ToUpper
oNewRow.Item(0) = My.Resources.tiff
Case ".tiff".ToUpper
oNewRow.Item(0) = My.Resources.tiff
Case ".jpg".ToUpper
oNewRow.Item(0) = My.Resources.jpg
Case Else
oNewRow.Item(0) = My.Resources._blank
End Select
'Den Filepath mitgeben 'Den Filepath mitgeben
oNewRow.Item(1) = oFullpath oNewRow.Item(1) = oFullpath
oNewRow.Item(2) = oDocID oNewRow.Item(2) = oDocID
@@ -255,23 +222,16 @@ Public Class frmDocumentResultList
For Each oColumnName As String In oRestColArray For Each oColumnName As String In oRestColArray
Dim oRowValue Dim oRowValue
oRowValue = oRow.Item(oColumnName) oRowValue = oRow.Item(oColumnName)
oNewRow.Item(oIndex) = oRowValue.ToString oNewRow.Item(oIndex) = oRowValue
oIndex += 1 oIndex += 1
Next Next
oMyDocDatatable.Rows.Add(oNewRow)
oDocDatatable.Rows.Add(oNewRow)
Next Next
Dim oGridControl As GridControl = GridView.GridControl Dim oGridControl As GridControl = GridView.GridControl
oGridControl.DataSource = oMyDocDatatable oGridControl.DataSource = oDocDatatable
oGridControl.ForceInitialize() oGridControl.ForceInitialize()
Try
GridView.Columns.Item("DocID").Visible = False
Catch ex As Exception
End Try
Try
GridView.Columns.Item(COLUMN_FILEPATH).Visible = False
Catch ex As Exception
End Try
Dim oCreated, oChanged As String Dim oCreated, oChanged As String
If _Environment.User.Language <> "de-DE" Then If _Environment.User.Language <> "de-DE" Then
@@ -282,6 +242,12 @@ Public Class frmDocumentResultList
oCreated = "Erstellt" oCreated = "Erstellt"
End If End If
Try
GridView.Columns.Item(COLUMN_DOCID).Visible = False
GridView.Columns.Item(COLUMN_FILEPATH).Visible = False
GridView.Columns.Item(COLUMN_ICON).MaxWidth = 24
GridView.Columns.Item(COLUMN_ICON).MinWidth = 24
Dim oCreatedColumn = GridView.Columns(oCreated) Dim oCreatedColumn = GridView.Columns(oCreated)
If Not IsNothing(oCreatedColumn) Then If Not IsNothing(oCreatedColumn) Then
oCreatedColumn.DisplayFormat.FormatType = FormatType.DateTime oCreatedColumn.DisplayFormat.FormatType = FormatType.DateTime
@@ -298,9 +264,10 @@ Public Class frmDocumentResultList
For Each oColumn As GridColumn In GridView.Columns For Each oColumn As GridColumn In GridView.Columns
oColumn.OptionsColumn.AllowEdit = False oColumn.OptionsColumn.AllowEdit = False
Next Next
Catch ex As Exception
_Logger.Error(ex)
End Try
GridView.Columns.Item(COLUMN_ICON).MaxWidth = 24
GridView.Columns.Item(COLUMN_ICON).MinWidth = 24
GridView.OptionsView.BestFitMaxRowCount = -1 GridView.OptionsView.BestFitMaxRowCount = -1
GridView.BestFitColumns(True) GridView.BestFitColumns(True)
Catch ex As Exception Catch ex As Exception
@@ -308,6 +275,50 @@ Public Class frmDocumentResultList
End Try End Try
End Sub End Sub
Private Function GetIconByExtension(FilePath As String) As Bitmap
Dim oFileextension = Path.GetExtension(FilePath)
Select Case oFileextension.ToUpper
Case ".csv".ToUpper
Return My.Resources.xls
Case ".txt".ToUpper
Return My.Resources.txt
Case ".pdf".ToUpper
Return My.Resources.pdf
Case ".doc".ToUpper
Return My.Resources.doc
Case ".docx".ToUpper
Return My.Resources.doc
Case ".xls".ToUpper
Return My.Resources.xls
Case ".xlsx".ToUpper
Return My.Resources.xls
Case ".xlsm".ToUpper
Return My.Resources.xls
Case ".ppt".ToUpper
Return My.Resources.ppt
Case ".pptx".ToUpper
Return My.Resources.ppt
Case ".dwg".ToUpper
Return My.Resources.dwg
Case ".dxf".ToUpper
Return My.Resources.dxf
Case ".msg".ToUpper
Return My.Resources._page
Case ".msg".ToUpper
Return My.Resources._page
Case ".tif".ToUpper
Return My.Resources.tiff
Case ".tiff".ToUpper
Return My.Resources.tiff
Case ".jpg".ToUpper
Return My.Resources.jpg
Case Else
Return My.Resources._blank
End Select
End Function
Private Sub SwitchMainContainerHorizontal_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SwitchMainContainerHorizontal.CheckedChanged Private Sub SwitchMainContainerHorizontal_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles SwitchMainContainerHorizontal.CheckedChanged
SplitContainerControl1.Horizontal = SwitchMainContainerHorizontal.Checked SplitContainerControl1.Horizontal = SwitchMainContainerHorizontal.Checked
@@ -501,6 +512,8 @@ Public Class frmDocumentResultList
_Config.Config.WindowLocation = Location _Config.Config.WindowLocation = Location
_Config.Config.WindowSize = Size _Config.Config.WindowSize = Size
_Config.Save() _Config.Save()
DocumentViewer1.Done()
Catch ex As Exception Catch ex As Exception
_Logger.Error(ex) _Logger.Error(ex)
End Try End 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("1.0.0.1")> <Assembly: AssemblyVersion("1.0.0.2")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.2")>

View File

@@ -242,7 +242,7 @@ Public Class MSSQLServer
_Logger.Debug("GetScalarValue: Running Query [{0}]", SQLCommand) _Logger.Debug("GetScalarValue: Running Query [{0}]", SQLCommand)
Using oConnection As SqlConnection = GetSQLConnection() Using oConnection As SqlConnection = GetSQLConnection(ConnectionString)
Using oSQLCOmmand = oConnection.CreateCommand() Using oSQLCOmmand = oConnection.CreateCommand()
oSQLCOmmand.CommandText = SQLCommand oSQLCOmmand.CommandText = SQLCommand
oSQLCOmmand.CommandTimeout = _Timeout oSQLCOmmand.CommandTimeout = _Timeout

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("1.2.0.0")> <Assembly: AssemblyVersion("1.2.0.1")>
<Assembly: AssemblyFileVersion("1.2.0.0")> <Assembly: AssemblyFileVersion("1.2.0.1")>