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

View File

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

View File

@@ -155,6 +155,8 @@ Public Class frmDocumentResultList
Private Sub GridView_FocusedRowChanged(sender As GridView, e As FocusedRowChangedEventArgs)
_ActiveRowHandle = e.FocusedRowHandle
DocumentViewer1.CloseDocument()
If e.FocusedRowHandle >= 0 Then
Dim oRow = sender.GetDataRow(e.FocusedRowHandle)
Dim oFullPath = oRow.Item(COLUMN_FILEPATH)
@@ -163,89 +165,54 @@ Public Class frmDocumentResultList
End Sub
Private Sub CreateDocumentGrid(GridView As GridView, Datatable As DataTable)
Dim oMyDocDatatable As New DataTable
Dim oDocDatatable As New DataTable
Try
'Die Icon Colum erstellen und konfigurieren
oMyDocDatatable.Columns.Add(New DataColumn() With {
oDocDatatable.Columns.Add(New DataColumn() With {
.DataType = GetType(Image),
.ColumnName = COLUMN_ICON,
.Caption = ""
})
oMyDocDatatable.Columns.Add(New DataColumn() With {
oDocDatatable.Columns.Add(New DataColumn() With {
.DataType = GetType(String),
.ColumnName = COLUMN_FILEPATH,
.Caption = "Fullpath"
})
oMyDocDatatable.Columns.Add(New DataColumn() With {
oDocDatatable.Columns.Add(New DataColumn() With {
.DataType = GetType(Int32),
.ColumnName = "DocID",
.ColumnName = COLUMN_DOCID,
.Caption = "DocID"
})
oMyDocDatatable.Columns.Add(New DataColumn() With {
oDocDatatable.Columns.Add(New DataColumn() With {
.DataType = GetType(String),
.ColumnName = "Filename",
.Caption = "Filename"
})
Dim oRestColArray As New List(Of String)
For Each oCol As DataColumn In Datatable.Columns
Dim onewColumn As New DataColumn()
If oCol.ColumnName <> "DocID" And oCol.ColumnName <> COLUMN_FILEPATH And oCol.ColumnName <> "Filename" Then
onewColumn.DataType = GetType(String)
onewColumn.ColumnName = oCol.ColumnName
onewColumn.Caption = oCol.Caption
oMyDocDatatable.Columns.Add(onewColumn)
oRestColArray.Add(onewColumn.ColumnName)
End If
For Each oColumn As DataColumn In Datatable.Columns
If oColumn.ColumnName <> COLUMN_DOCID And oColumn.ColumnName <> COLUMN_FILEPATH And oColumn.ColumnName <> COLUMN_FILENAME Then
Dim oNewColumn As New DataColumn() With {
.DataType = oColumn.DataType,
.ColumnName = oColumn.ColumnName,
.Caption = oColumn.Caption
}
oDocDatatable.Columns.Add(oNewColumn)
oRestColArray.Add(oNewColumn.ColumnName)
End If
Next
For Each oRow As DataRow In Datatable.Rows
Dim oFullpath = oRow.Item(COLUMN_FILEPATH)
Dim oDocID = oRow.Item("DocID")
'Dim Folderpath = Path.GetDirectoryName(fullpath)
Dim oFilename = IO.Path.GetFileName(oFullpath)
Dim oFileextension = IO.Path.GetExtension(oFullpath)
Dim oDocID = oRow.Item(COLUMN_DOCID)
Dim oFilename = Path.GetFileName(oFullpath)
Dim oNewRow As DataRow
oNewRow = oMyDocDatatable.NewRow()
oNewRow = oDocDatatable.NewRow()
'Icon zuweisen
Select Case oFileextension.ToUpper
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
oNewRow.Item(0) = GetIconByExtension(oFullpath)
'Den Filepath mitgeben
oNewRow.Item(1) = oFullpath
oNewRow.Item(2) = oDocID
@@ -255,23 +222,16 @@ Public Class frmDocumentResultList
For Each oColumnName As String In oRestColArray
Dim oRowValue
oRowValue = oRow.Item(oColumnName)
oNewRow.Item(oIndex) = oRowValue.ToString
oNewRow.Item(oIndex) = oRowValue
oIndex += 1
Next
oMyDocDatatable.Rows.Add(oNewRow)
oDocDatatable.Rows.Add(oNewRow)
Next
Dim oGridControl As GridControl = GridView.GridControl
oGridControl.DataSource = oMyDocDatatable
oGridControl.DataSource = oDocDatatable
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
If _Environment.User.Language <> "de-DE" Then
@@ -282,25 +242,32 @@ Public Class frmDocumentResultList
oCreated = "Erstellt"
End If
Dim oCreatedColumn = GridView.Columns(oCreated)
If Not IsNothing(oCreatedColumn) Then
oCreatedColumn.DisplayFormat.FormatType = FormatType.DateTime
oCreatedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
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 oChangedColumn = GridView.Columns(oChanged)
If Not IsNothing(oChangedColumn) Then
oChangedColumn.DisplayFormat.FormatType = FormatType.DateTime
oChangedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
End If
Dim oCreatedColumn = GridView.Columns(oCreated)
If Not IsNothing(oCreatedColumn) Then
oCreatedColumn.DisplayFormat.FormatType = FormatType.DateTime
oCreatedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
End If
' Alle Spalten aus ReadOnly setzen, danach werden alle passenden auf nicht ReadOnly gesetzt
For Each oColumn As GridColumn In GridView.Columns
oColumn.OptionsColumn.AllowEdit = False
Next
Dim oChangedColumn = GridView.Columns(oChanged)
If Not IsNothing(oChangedColumn) Then
oChangedColumn.DisplayFormat.FormatType = FormatType.DateTime
oChangedColumn.DisplayFormat.FormatString = _Environment.User.DateFormat & " HH:MM:ss"
End If
' Alle Spalten aus ReadOnly setzen, danach werden alle passenden auf nicht ReadOnly gesetzt
For Each oColumn As GridColumn In GridView.Columns
oColumn.OptionsColumn.AllowEdit = False
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.BestFitColumns(True)
Catch ex As Exception
@@ -308,6 +275,50 @@ Public Class frmDocumentResultList
End Try
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
SplitContainerControl1.Horizontal = SwitchMainContainerHorizontal.Checked
@@ -501,6 +512,8 @@ Public Class frmDocumentResultList
_Config.Config.WindowLocation = Location
_Config.Config.WindowSize = Size
_Config.Save()
DocumentViewer1.Done()
Catch ex As Exception
_Logger.Error(ex)
End Try

View File

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

View File

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

View File

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