This commit is contained in:
SchreiberM 2022-05-19 17:24:18 +02:00
commit 90e31c01b5
5 changed files with 244 additions and 203 deletions

View File

@ -58,14 +58,14 @@ Public Class SearchRunner
Public Property ExplicitDate As Boolean = False Public Property ExplicitDate As Boolean = False
Private ReadOnly Environment As Environment Private ReadOnly Environment As Environment
Private ReadOnly SearchTitle As String Private ReadOnly SearchId As String
Private ReadOnly UserId As Integer Private ReadOnly UserId As Integer
Private ReadOnly UserLanguage As String Private ReadOnly UserLanguage As String
Public Sub New(pLogConfig As LogConfig, pEnvironment As Environment, pSearchTitle As String) Public Sub New(pLogConfig As LogConfig, pEnvironment As Environment, pSearchId As String)
MyBase.New(pLogConfig) MyBase.New(pLogConfig)
Environment = pEnvironment Environment = pEnvironment
SearchTitle = pSearchTitle SearchId = pSearchId
UserId = My.Application.User.UserId UserId = My.Application.User.UserId
UserLanguage = My.Application.User.Language UserLanguage = My.Application.User.Language
End Sub End Sub
@ -96,28 +96,42 @@ Public Class SearchRunner
Return New SearchResult(pDatatable.Rows.Count) Return New SearchResult(pDatatable.Rows.Count)
End Function End Function
''' <summary>
''' Only search for Term. Used for sidebar quicksearch.
''' </summary>
Public Async Function RunWithSearchTerm(pSearchTerm As String) As Task(Of SearchResult) Public Async Function RunWithSearchTerm(pSearchTerm As String) As Task(Of SearchResult)
Return Await RunWithSearchTerm(pSearchTerm, Nothing, Nothing, Nothing, Nothing) Return Await RunWithSearchTerm(New SearchOptions With {.SearchString = pSearchTerm})
End Function End Function
Public Async Function RunWithSearchTerm(pSearchTerm As String, pSearchTitle As String) As Task(Of SearchResult) Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date, pSearchTitle As String) As Task(Of SearchResult)
Return Await RunWithSearchTerm(pSearchTerm, Nothing, Nothing, Nothing, pSearchTitle) Return Await RunWithSearchTerm(New SearchOptions With {.SearchString = pSearchTerm, .SearchTitle = pSearchTitle})
End Function End Function
Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date) As Task(Of SearchResult) Public Async Function RunWithTokens(pTokens As IEnumerable(Of Search.SearchToken.Token)) As Task(Of SearchResult)
Return Await RunWithSearchTerm(pSearchTerm, pDateFrom, pDateTo, Nothing, Nothing) Return Await RunWithSearchTerm(New SearchOptions With {.SearchTokens = pTokens})
End Function End Function
Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date, pSearchTokens As IEnumerable(Of Search.SearchToken.Token), pSearchTitle As String) As Task(Of SearchResult)
Dim oWindowTitle = GetResultWindowString(pSearchTerm, pSearchTitle) 'Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date) As Task(Of SearchResult)
' Return Await RunWithSearchTerm(pSearchTerm, pDateFrom, pDateTo, Nothing, Nothing)
'End Function
Private Async Function RunWithSearchTerm(pOptions As SearchOptions) As Task(Of SearchResult)
Dim oDateConstraint = Await GetDateConstraint(pOptions.DateFrom, pOptions.DateTo)
Dim oWindowTitle = GetResultWindowString(pOptions.SearchString, pOptions.SearchTitle)
Dim oParams = GetParams(oWindowTitle) Dim oParams = GetParams(oWindowTitle)
Dim oDateConstraint = Await GetDateConstraint(pDateFrom, pDateTo) Dim oTokens = pOptions.SearchTokens
Dim oSearchTerm = pOptions.SearchString
Await InsertSearchTokens(pSearchTokens) Dim oSQL
Dim oSQL = $"EXEC PRIDB_SEARCH_GET_TEXT_RESULTS {UserId},'{pSearchTerm}','{oDateConstraint}', '{UserLanguage}'" If oTokens.Count > 0 Then
If pSearchTokens IsNot Nothing AndAlso pSearchTokens.Count > 0 Then Await InsertSearchTokens(oTokens)
oSQL = $"EXEC PRIDB_SEARCH_GET_TOKEN_RESULT_DOCS {UserId}, '{oDateConstraint}', '{UserLanguage}'" oSQL = $"EXEC PRIDB_SEARCH_GET_TOKEN_RESULT_DOCS {UserId}, '{oDateConstraint}', '{UserLanguage}'"
ElseIf oSearchTerm IsNot Nothing Then
oSQL = $"EXEC PRIDB_SEARCH_GET_TEXT_RESULTS {UserId},'{pOptions.SearchString}','{oDateConstraint}', '{UserLanguage}'"
Else
oSQL = $"EXEC PRIDB_SEARCH_GET_TEXT_RESULTS {UserId},'{String.Empty}','{oDateConstraint}', '{UserLanguage}'"
End If End If
If Await My.Database.ExecuteNonQueryIDBAsync(oSQL) = True Then If Await My.Database.ExecuteNonQueryIDBAsync(oSQL) = True Then
@ -130,7 +144,7 @@ Public Class SearchRunner
Dim oRowCount = oDTDocResult.Rows.Count Dim oRowCount = oDTDocResult.Rows.Count
If oRowCount > 0 Then If oRowCount > 0 Then
oParams.Results.Add(New DocumentResultList.DocumentResult() With { oParams.Results.Add(New DocumentResultList.DocumentResult() With {
.Title = SearchTitle, .Title = SearchId,
.Datatable = oDTDocResult .Datatable = oDTDocResult
}) })
@ -157,6 +171,8 @@ Public Class SearchRunner
End If End If
End Function End Function
Private Async Function GetDateConstraint(pDateFrom As Date, pDateTo As Date) As Task(Of String) Private Async Function GetDateConstraint(pDateFrom As Date, pDateTo As Date) As Task(Of String)
Dim oSimpleDateConstraint = $"{_ActiveDateAttribute}~{_ActiveDateConstraint}" Dim oSimpleDateConstraint = $"{_ActiveDateAttribute}~{_ActiveDateConstraint}"
Dim oExplicitConstraint = Await MaybeSetExplicitDateConstraint(pDateFrom, pDateTo) Dim oExplicitConstraint = Await MaybeSetExplicitDateConstraint(pDateFrom, pDateTo)
@ -230,7 +246,7 @@ Public Class SearchRunner
Private Function GetParams(pWindowTitle As String) As DocumentResultList.Params Private Function GetParams(pWindowTitle As String) As DocumentResultList.Params
Dim oParams = New DocumentResultList.Params() With { Dim oParams = New DocumentResultList.Params() With {
.WindowGuid = SearchTitle, .WindowGuid = SearchId,
.WindowTitle = pWindowTitle, .WindowTitle = pWindowTitle,
.OperationModeOverride = Modules.ZooFlow.Constants.OperationMode.ZooFlow, .OperationModeOverride = Modules.ZooFlow.Constants.OperationMode.ZooFlow,
.ProfileGuid = 35452, .ProfileGuid = 35452,
@ -242,25 +258,31 @@ Public Class SearchRunner
Return oParams Return oParams
End Function End Function
Private Function GetResultWindowString(SearchContent As String, pWindowTitle As String) As String Private Function GetResultWindowString(pSearchContent As String, pWindowTitle As String) As String
Dim oWindowString
' This is the default title
If UserLanguage = State.UserState.LANG_DE_DE Then
oWindowString = $"Suche"
Else
oWindowString = $"Search"
End If
' If a Search String is given, we might take this
If pSearchContent <> String.Empty Then
If UserLanguage = State.UserState.LANG_DE_DE Then
Return $"Suche Nach '{pSearchContent}'"
Else
Return $"Search For '{pSearchContent}'"
End If
End If
' Window Title overrides everything
If pWindowTitle IsNot Nothing Then If pWindowTitle IsNot Nothing Then
Return pWindowTitle oWindowString = pWindowTitle
End If End If
If SearchContent <> String.Empty Then Return oWindowString
If My.Application.User.Language = State.UserState.LANG_DE_DE Then
Return $"Suche Nach '{SearchContent}'"
Else
Return $"Search For '{SearchContent}'"
End If
Else
If My.Application.User.Language = State.UserState.LANG_DE_DE Then
Return $"Suche Datumsbegrenzt"
Else
Return $"Search via date"
End If
End If
End Function End Function
Public Sub SetDateConstraint() Public Sub SetDateConstraint()
@ -341,6 +363,16 @@ Public Class SearchRunner
_ActiveDateAttribute = SEARCH_FACT_DATE_DEFAULT _ActiveDateAttribute = SEARCH_FACT_DATE_DEFAULT
End Sub End Sub
Public Class SearchOptions
Public SearchTitle As String
Public SearchString As String
Public SearchTokens As IEnumerable(Of Search.SearchToken.Token)
Public DateFrom As Date
Public DateTo As Date
End Class
Public Class SearchResult Public Class SearchResult
Public OK As Boolean = True Public OK As Boolean = True
Public Count As Integer = 0 Public Count As Integer = 0

View File

@ -220,18 +220,18 @@ Public Class frmFlowSearch1
RunSearch() RunSearch()
End Sub End Sub
Private Async Sub RunSearch() Private Async Sub RunSearch()
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me) 'Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
Try 'Try
Dim oResult = Await SearchRunner.RunWithSearchTerm(TextEditSearch.Text, DateEditFrom.EditValue, DateEditTill.EditValue) ' Dim oResult = Await SearchRunner.RunWithSearchTerm(TextEditSearch.Text, DateEditFrom.EditValue, DateEditTill.EditValue)
If oResult.OK = False Then ' If oResult.OK = False Then
bsiStatus.Caption = oResult.ErrorMessage ' bsiStatus.Caption = oResult.ErrorMessage
End If ' End If
Catch ex As Exception 'Catch ex As Exception
Logger.Error(ex) ' Logger.Error(ex)
Finally 'Finally
SplashScreenManager.CloseOverlayForm(oHandle) ' SplashScreenManager.CloseOverlayForm(oHandle)
End Try 'End Try
End Sub End Sub
Private Sub TextEditSearch_KeyUp(sender As Object, e As KeyEventArgs) Handles TextEditSearch.KeyUp Private Sub TextEditSearch_KeyUp(sender As Object, e As KeyEventArgs) Handles TextEditSearch.KeyUp
@ -249,17 +249,17 @@ Public Class frmFlowSearch1
End Sub End Sub
Private Async Function BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) As Threading.Tasks.Task Handles BarButtonStartSearch.ItemClick Private Async Function BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) As Threading.Tasks.Task Handles BarButtonStartSearch.ItemClick
Dim oHandle = SplashScreenManager.ShowOverlayForm(Me) 'Dim oHandle = SplashScreenManager.ShowOverlayForm(Me)
Try 'Try
Dim oResult = Await SearchRunner.RunWithSearchTerm(TextEditSearch.Text, DateEditFrom.EditValue, DateEditTill.EditValue) ' Dim oResult = Await SearchRunner.RunWithSearchTerm(TextEditSearch.Text, DateEditFrom.EditValue, DateEditTill.EditValue)
If oResult.OK = False Then ' If oResult.OK = False Then
bsiStatus.Caption = oResult.ErrorMessage ' bsiStatus.Caption = oResult.ErrorMessage
End If ' End If
Catch ex As Exception 'Catch ex As Exception
Logger.Error(ex) ' Logger.Error(ex)
Finally 'Finally
SplashScreenManager.CloseOverlayForm(oHandle) ' SplashScreenManager.CloseOverlayForm(oHandle)
End Try 'End Try
End Function End Function
End Class End Class

View File

@ -54,14 +54,11 @@ Partial Class frmFlowSearch2
Me.TileView1 = New DevExpress.XtraGrid.Views.Tile.TileView() Me.TileView1 = New DevExpress.XtraGrid.Views.Tile.TileView()
Me.colCount = New DevExpress.XtraGrid.Columns.TileViewColumn() Me.colCount = New DevExpress.XtraGrid.Columns.TileViewColumn()
Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.RadioGroupDateConstraints = New DevExpress.XtraEditors.RadioGroup()
Me.DateEditFrom = New DevExpress.XtraEditors.DateEdit() Me.DateEditFrom = New DevExpress.XtraEditors.DateEdit()
Me.DateEditTo = New DevExpress.XtraEditors.DateEdit() Me.DateEditTo = New DevExpress.XtraEditors.DateEdit()
Me.CheckEdit1 = New DevExpress.XtraEditors.ToggleSwitch() Me.CheckEdit1 = New DevExpress.XtraEditors.ToggleSwitch()
Me.ComboBoxDateAttributes = New DevExpress.XtraEditors.ComboBoxEdit() Me.ComboBoxDateAttributes = New DevExpress.XtraEditors.ComboBoxEdit()
Me.Root = New DevExpress.XtraLayout.LayoutControlGroup() Me.Root = New DevExpress.XtraLayout.LayoutControlGroup()
Me.LayoutControlGroupDate1 = New DevExpress.XtraLayout.LayoutControlGroup()
Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem()
Me.LayoutControlGroupDate2 = New DevExpress.XtraLayout.LayoutControlGroup() Me.LayoutControlGroupDate2 = New DevExpress.XtraLayout.LayoutControlGroup()
Me.LayoutControlItem2 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem2 = New DevExpress.XtraLayout.LayoutControlItem()
Me.LayoutControlItem4 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem4 = New DevExpress.XtraLayout.LayoutControlItem()
@ -84,7 +81,6 @@ Partial Class frmFlowSearch2
CType(Me.GridPredefinedSearches, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridPredefinedSearches, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TileView1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TileView1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RadioGroupDateConstraints.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DateEditFrom.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.DateEditFrom.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DateEditFrom.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.DateEditFrom.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.DateEditTo.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.DateEditTo.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).BeginInit()
@ -92,8 +88,6 @@ Partial Class frmFlowSearch2
CType(Me.CheckEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.CheckEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.ComboBoxDateAttributes.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.ComboBoxDateAttributes.Properties, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Root, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlGroupDate1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlGroupDate2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlGroupDate2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).BeginInit()
@ -260,7 +254,6 @@ Partial Class frmFlowSearch2
Me.LayoutControl1.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer)) Me.LayoutControl1.BackColor = System.Drawing.Color.FromArgb(CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer), CType(CType(240, Byte), Integer))
Me.LayoutControl1.Controls.Add(Me.TokenEditEx1) Me.LayoutControl1.Controls.Add(Me.TokenEditEx1)
Me.LayoutControl1.Controls.Add(Me.GridPredefinedSearches) Me.LayoutControl1.Controls.Add(Me.GridPredefinedSearches)
Me.LayoutControl1.Controls.Add(Me.RadioGroupDateConstraints)
Me.LayoutControl1.Controls.Add(Me.DateEditFrom) Me.LayoutControl1.Controls.Add(Me.DateEditFrom)
Me.LayoutControl1.Controls.Add(Me.DateEditTo) Me.LayoutControl1.Controls.Add(Me.DateEditTo)
Me.LayoutControl1.Controls.Add(Me.CheckEdit1) Me.LayoutControl1.Controls.Add(Me.CheckEdit1)
@ -357,62 +350,48 @@ Partial Class frmFlowSearch2
Me.GridView1.GridControl = Me.GridPredefinedSearches Me.GridView1.GridControl = Me.GridPredefinedSearches
Me.GridView1.Name = "GridView1" Me.GridView1.Name = "GridView1"
' '
'RadioGroupDateConstraints
'
Me.RadioGroupDateConstraints.Location = New System.Drawing.Point(4, 228)
Me.RadioGroupDateConstraints.MenuManager = Me.RibbonControl1
Me.RadioGroupDateConstraints.Name = "RadioGroupDateConstraints"
Me.RadioGroupDateConstraints.Properties.Appearance.BackColor = System.Drawing.SystemColors.Control
Me.RadioGroupDateConstraints.Properties.Appearance.Options.UseBackColor = True
Me.RadioGroupDateConstraints.Properties.Columns = 2
Me.RadioGroupDateConstraints.Properties.ItemHorzAlignment = DevExpress.XtraEditors.RadioItemHorzAlignment.Near
Me.RadioGroupDateConstraints.Properties.ItemsLayout = DevExpress.XtraEditors.RadioGroupItemsLayout.Flow
Me.RadioGroupDateConstraints.Size = New System.Drawing.Size(615, 181)
Me.RadioGroupDateConstraints.StyleController = Me.LayoutControl1
Me.RadioGroupDateConstraints.TabIndex = 4
'
'DateEditFrom 'DateEditFrom
' '
Me.DateEditFrom.EditValue = Nothing Me.DateEditFrom.EditValue = Nothing
Me.DateEditFrom.Location = New System.Drawing.Point(724, 231) Me.DateEditFrom.Location = New System.Drawing.Point(101, 231)
Me.DateEditFrom.MenuManager = Me.RibbonControl1 Me.DateEditFrom.MenuManager = Me.RibbonControl1
Me.DateEditFrom.Name = "DateEditFrom" Me.DateEditFrom.Name = "DateEditFrom"
Me.DateEditFrom.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.DateEditFrom.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.DateEditFrom.Properties.CalendarTimeProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.DateEditFrom.Properties.CalendarTimeProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.DateEditFrom.Size = New System.Drawing.Size(155, 20) Me.DateEditFrom.Size = New System.Drawing.Size(778, 20)
Me.DateEditFrom.StyleController = Me.LayoutControl1 Me.DateEditFrom.StyleController = Me.LayoutControl1
Me.DateEditFrom.TabIndex = 5 Me.DateEditFrom.TabIndex = 5
' '
'DateEditTo 'DateEditTo
' '
Me.DateEditTo.EditValue = Nothing Me.DateEditTo.EditValue = Nothing
Me.DateEditTo.Location = New System.Drawing.Point(724, 284) Me.DateEditTo.Location = New System.Drawing.Point(101, 284)
Me.DateEditTo.MenuManager = Me.RibbonControl1 Me.DateEditTo.MenuManager = Me.RibbonControl1
Me.DateEditTo.Name = "DateEditTo" Me.DateEditTo.Name = "DateEditTo"
Me.DateEditTo.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.DateEditTo.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.DateEditTo.Properties.CalendarTimeProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.DateEditTo.Properties.CalendarTimeProperties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.DateEditTo.Size = New System.Drawing.Size(155, 20) Me.DateEditTo.Size = New System.Drawing.Size(778, 20)
Me.DateEditTo.StyleController = Me.LayoutControl1 Me.DateEditTo.StyleController = Me.LayoutControl1
Me.DateEditTo.TabIndex = 7 Me.DateEditTo.TabIndex = 7
' '
'CheckEdit1 'CheckEdit1
' '
Me.CheckEdit1.Location = New System.Drawing.Point(627, 258) Me.CheckEdit1.Location = New System.Drawing.Point(4, 258)
Me.CheckEdit1.MenuManager = Me.RibbonControl1 Me.CheckEdit1.MenuManager = Me.RibbonControl1
Me.CheckEdit1.Name = "CheckEdit1" Me.CheckEdit1.Name = "CheckEdit1"
Me.CheckEdit1.Properties.OffText = "Datum bis deaktiviert" Me.CheckEdit1.Properties.OffText = "Datum bis deaktiviert"
Me.CheckEdit1.Properties.OnText = "Datum bis aktiviert" Me.CheckEdit1.Properties.OnText = "Datum bis aktiviert"
Me.CheckEdit1.Size = New System.Drawing.Size(255, 19) Me.CheckEdit1.Size = New System.Drawing.Size(878, 19)
Me.CheckEdit1.StyleController = Me.LayoutControl1 Me.CheckEdit1.StyleController = Me.LayoutControl1
Me.CheckEdit1.TabIndex = 8 Me.CheckEdit1.TabIndex = 8
' '
'ComboBoxDateAttributes 'ComboBoxDateAttributes
' '
Me.ComboBoxDateAttributes.Location = New System.Drawing.Point(724, 314) Me.ComboBoxDateAttributes.Location = New System.Drawing.Point(101, 314)
Me.ComboBoxDateAttributes.MenuManager = Me.RibbonControl1 Me.ComboBoxDateAttributes.MenuManager = Me.RibbonControl1
Me.ComboBoxDateAttributes.Name = "ComboBoxDateAttributes" Me.ComboBoxDateAttributes.Name = "ComboBoxDateAttributes"
Me.ComboBoxDateAttributes.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.ComboBoxDateAttributes.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.ComboBoxDateAttributes.Size = New System.Drawing.Size(155, 20) Me.ComboBoxDateAttributes.Size = New System.Drawing.Size(778, 20)
Me.ComboBoxDateAttributes.StyleController = Me.LayoutControl1 Me.ComboBoxDateAttributes.StyleController = Me.LayoutControl1
Me.ComboBoxDateAttributes.TabIndex = 9 Me.ComboBoxDateAttributes.TabIndex = 9
' '
@ -420,38 +399,12 @@ Partial Class frmFlowSearch2
' '
Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True] Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True]
Me.Root.GroupBordersVisible = False Me.Root.GroupBordersVisible = False
Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlGroupDate1, Me.LayoutControlGroupDate2, Me.LayoutControlGroup3, Me.LayoutControlItem7}) Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlGroupDate2, Me.LayoutControlGroup3, Me.LayoutControlItem7})
Me.Root.Name = "Root" Me.Root.Name = "Root"
Me.Root.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0) Me.Root.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0)
Me.Root.Size = New System.Drawing.Size(886, 413) Me.Root.Size = New System.Drawing.Size(886, 413)
Me.Root.TextVisible = False Me.Root.TextVisible = False
' '
'LayoutControlGroupDate1
'
Me.LayoutControlGroupDate1.AppearanceGroup.BackColor = System.Drawing.Color.FromArgb(CType(CType(165, Byte), Integer), CType(CType(36, Byte), Integer), CType(CType(19, Byte), Integer))
Me.LayoutControlGroupDate1.AppearanceGroup.BackColor2 = System.Drawing.Color.FromArgb(CType(CType(165, Byte), Integer), CType(CType(36, Byte), Integer), CType(CType(19, Byte), Integer))
Me.LayoutControlGroupDate1.AppearanceGroup.BorderColor = System.Drawing.Color.FromArgb(CType(CType(165, Byte), Integer), CType(CType(36, Byte), Integer), CType(CType(19, Byte), Integer))
Me.LayoutControlGroupDate1.AppearanceGroup.Options.UseBackColor = True
Me.LayoutControlGroupDate1.AppearanceGroup.Options.UseBorderColor = True
Me.LayoutControlGroupDate1.BestFitWeight = 0
Me.LayoutControlGroupDate1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[False]
Me.LayoutControlGroupDate1.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem1})
Me.LayoutControlGroupDate1.Location = New System.Drawing.Point(0, 202)
Me.LayoutControlGroupDate1.Name = "LayoutControlGroupDate1"
Me.LayoutControlGroupDate1.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0)
Me.LayoutControlGroupDate1.Size = New System.Drawing.Size(623, 211)
Me.LayoutControlGroupDate1.Text = "Datums Einschränkung"
Me.LayoutControlGroupDate1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never
'
'LayoutControlItem1
'
Me.LayoutControlItem1.Control = Me.RadioGroupDateConstraints
Me.LayoutControlItem1.Location = New System.Drawing.Point(0, 0)
Me.LayoutControlItem1.Name = "LayoutControlItem1"
Me.LayoutControlItem1.Size = New System.Drawing.Size(619, 185)
Me.LayoutControlItem1.TextSize = New System.Drawing.Size(0, 0)
Me.LayoutControlItem1.TextVisible = False
'
'LayoutControlGroupDate2 'LayoutControlGroupDate2
' '
Me.LayoutControlGroupDate2.AppearanceGroup.BackColor = System.Drawing.Color.FromArgb(CType(CType(165, Byte), Integer), CType(CType(36, Byte), Integer), CType(CType(19, Byte), Integer)) Me.LayoutControlGroupDate2.AppearanceGroup.BackColor = System.Drawing.Color.FromArgb(CType(CType(165, Byte), Integer), CType(CType(36, Byte), Integer), CType(CType(19, Byte), Integer))
@ -460,10 +413,10 @@ Partial Class frmFlowSearch2
Me.LayoutControlGroupDate2.AppearanceGroup.Options.UseBorderColor = True Me.LayoutControlGroupDate2.AppearanceGroup.Options.UseBorderColor = True
Me.LayoutControlGroupDate2.BestFitWeight = 0 Me.LayoutControlGroupDate2.BestFitWeight = 0
Me.LayoutControlGroupDate2.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem2, Me.LayoutControlItem4, Me.EmptySpaceItem1, Me.LayoutControlItem6, Me.LayoutControlItem8}) Me.LayoutControlGroupDate2.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem2, Me.LayoutControlItem4, Me.EmptySpaceItem1, Me.LayoutControlItem6, Me.LayoutControlItem8})
Me.LayoutControlGroupDate2.Location = New System.Drawing.Point(623, 202) Me.LayoutControlGroupDate2.Location = New System.Drawing.Point(0, 202)
Me.LayoutControlGroupDate2.Name = "LayoutControlGroupDate2" Me.LayoutControlGroupDate2.Name = "LayoutControlGroupDate2"
Me.LayoutControlGroupDate2.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0) Me.LayoutControlGroupDate2.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0)
Me.LayoutControlGroupDate2.Size = New System.Drawing.Size(263, 211) Me.LayoutControlGroupDate2.Size = New System.Drawing.Size(886, 211)
Me.LayoutControlGroupDate2.Text = "Eigenes Datum" Me.LayoutControlGroupDate2.Text = "Eigenes Datum"
Me.LayoutControlGroupDate2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never Me.LayoutControlGroupDate2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never
' '
@ -473,7 +426,7 @@ Partial Class frmFlowSearch2
Me.LayoutControlItem2.Location = New System.Drawing.Point(0, 0) Me.LayoutControlItem2.Location = New System.Drawing.Point(0, 0)
Me.LayoutControlItem2.Name = "LayoutControlItem2" Me.LayoutControlItem2.Name = "LayoutControlItem2"
Me.LayoutControlItem2.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) Me.LayoutControlItem2.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem2.Size = New System.Drawing.Size(259, 30) Me.LayoutControlItem2.Size = New System.Drawing.Size(882, 30)
Me.LayoutControlItem2.Text = "Datum Von" Me.LayoutControlItem2.Text = "Datum Von"
Me.LayoutControlItem2.TextSize = New System.Drawing.Size(82, 13) Me.LayoutControlItem2.TextSize = New System.Drawing.Size(82, 13)
' '
@ -484,7 +437,7 @@ Partial Class frmFlowSearch2
Me.LayoutControlItem4.Location = New System.Drawing.Point(0, 53) Me.LayoutControlItem4.Location = New System.Drawing.Point(0, 53)
Me.LayoutControlItem4.Name = "LayoutControlItem4" Me.LayoutControlItem4.Name = "LayoutControlItem4"
Me.LayoutControlItem4.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) Me.LayoutControlItem4.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem4.Size = New System.Drawing.Size(259, 30) Me.LayoutControlItem4.Size = New System.Drawing.Size(882, 30)
Me.LayoutControlItem4.Text = "Datum Bis" Me.LayoutControlItem4.Text = "Datum Bis"
Me.LayoutControlItem4.TextSize = New System.Drawing.Size(82, 13) Me.LayoutControlItem4.TextSize = New System.Drawing.Size(82, 13)
' '
@ -493,7 +446,7 @@ Partial Class frmFlowSearch2
Me.EmptySpaceItem1.AllowHotTrack = False Me.EmptySpaceItem1.AllowHotTrack = False
Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 113) Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 113)
Me.EmptySpaceItem1.Name = "EmptySpaceItem1" Me.EmptySpaceItem1.Name = "EmptySpaceItem1"
Me.EmptySpaceItem1.Size = New System.Drawing.Size(259, 72) Me.EmptySpaceItem1.Size = New System.Drawing.Size(882, 72)
Me.EmptySpaceItem1.TextSize = New System.Drawing.Size(0, 0) Me.EmptySpaceItem1.TextSize = New System.Drawing.Size(0, 0)
' '
'LayoutControlItem6 'LayoutControlItem6
@ -501,7 +454,7 @@ Partial Class frmFlowSearch2
Me.LayoutControlItem6.Control = Me.CheckEdit1 Me.LayoutControlItem6.Control = Me.CheckEdit1
Me.LayoutControlItem6.Location = New System.Drawing.Point(0, 30) Me.LayoutControlItem6.Location = New System.Drawing.Point(0, 30)
Me.LayoutControlItem6.Name = "LayoutControlItem6" Me.LayoutControlItem6.Name = "LayoutControlItem6"
Me.LayoutControlItem6.Size = New System.Drawing.Size(259, 23) Me.LayoutControlItem6.Size = New System.Drawing.Size(882, 23)
Me.LayoutControlItem6.TextSize = New System.Drawing.Size(0, 0) Me.LayoutControlItem6.TextSize = New System.Drawing.Size(0, 0)
Me.LayoutControlItem6.TextVisible = False Me.LayoutControlItem6.TextVisible = False
' '
@ -511,7 +464,7 @@ Partial Class frmFlowSearch2
Me.LayoutControlItem8.Location = New System.Drawing.Point(0, 83) Me.LayoutControlItem8.Location = New System.Drawing.Point(0, 83)
Me.LayoutControlItem8.Name = "LayoutControlItem8" Me.LayoutControlItem8.Name = "LayoutControlItem8"
Me.LayoutControlItem8.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) Me.LayoutControlItem8.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5)
Me.LayoutControlItem8.Size = New System.Drawing.Size(259, 30) Me.LayoutControlItem8.Size = New System.Drawing.Size(882, 30)
Me.LayoutControlItem8.Text = "Datums Attribut" Me.LayoutControlItem8.Text = "Datums Attribut"
Me.LayoutControlItem8.TextSize = New System.Drawing.Size(82, 13) Me.LayoutControlItem8.TextSize = New System.Drawing.Size(82, 13)
' '
@ -577,7 +530,6 @@ Partial Class frmFlowSearch2
CType(Me.GridPredefinedSearches, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridPredefinedSearches, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TileView1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TileView1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.RadioGroupDateConstraints.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DateEditFrom.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.DateEditFrom.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DateEditFrom.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.DateEditFrom.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DateEditTo.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.DateEditTo.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).EndInit()
@ -585,8 +537,6 @@ Partial Class frmFlowSearch2
CType(Me.CheckEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.CheckEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.ComboBoxDateAttributes.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.ComboBoxDateAttributes.Properties, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Root, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Root, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlGroupDate1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlGroupDate2, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlGroupDate2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).EndInit()
@ -610,8 +560,6 @@ Partial Class frmFlowSearch2
Friend WithEvents PanelControl2 As DevExpress.XtraEditors.PanelControl Friend WithEvents PanelControl2 As DevExpress.XtraEditors.PanelControl
Friend WithEvents LayoutControl1 As DevExpress.XtraLayout.LayoutControl Friend WithEvents LayoutControl1 As DevExpress.XtraLayout.LayoutControl
Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup
Friend WithEvents RadioGroupDateConstraints As DevExpress.XtraEditors.RadioGroup
Friend WithEvents LayoutControlItem1 As DevExpress.XtraLayout.LayoutControlItem
Friend WithEvents GridPredefinedSearches As DevExpress.XtraGrid.GridControl Friend WithEvents GridPredefinedSearches As DevExpress.XtraGrid.GridControl
Friend WithEvents TileView1 As DevExpress.XtraGrid.Views.Tile.TileView Friend WithEvents TileView1 As DevExpress.XtraGrid.Views.Tile.TileView
Friend WithEvents colName As DevExpress.XtraGrid.Columns.TileViewColumn Friend WithEvents colName As DevExpress.XtraGrid.Columns.TileViewColumn
@ -619,7 +567,6 @@ Partial Class frmFlowSearch2
Friend WithEvents colCount As DevExpress.XtraGrid.Columns.TileViewColumn Friend WithEvents colCount As DevExpress.XtraGrid.Columns.TileViewColumn
Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents DateEditFrom As DevExpress.XtraEditors.DateEdit Friend WithEvents DateEditFrom As DevExpress.XtraEditors.DateEdit
Friend WithEvents LayoutControlGroupDate1 As DevExpress.XtraLayout.LayoutControlGroup
Friend WithEvents LayoutControlGroupDate2 As DevExpress.XtraLayout.LayoutControlGroup Friend WithEvents LayoutControlGroupDate2 As DevExpress.XtraLayout.LayoutControlGroup
Friend WithEvents LayoutControlItem2 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents LayoutControlItem2 As DevExpress.XtraLayout.LayoutControlItem
Friend WithEvents DateEditTo As DevExpress.XtraEditors.DateEdit Friend WithEvents DateEditTo As DevExpress.XtraEditors.DateEdit

View File

@ -3,6 +3,7 @@ Imports DevExpress.Skins
Imports DevExpress.Utils.Svg Imports DevExpress.Utils.Svg
Imports DevExpress.XtraEditors Imports DevExpress.XtraEditors
Imports DevExpress.XtraEditors.Controls Imports DevExpress.XtraEditors.Controls
Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Tile Imports DevExpress.XtraGrid.Views.Tile
Imports DevExpress.XtraSplashScreen Imports DevExpress.XtraSplashScreen
Imports DigitalData.GUIs.ZooFlow.ClassConstants Imports DigitalData.GUIs.ZooFlow.ClassConstants
@ -30,13 +31,14 @@ Public Class frmFlowSearch2
} }
TokenTable = GetTokenTable() TokenTable = GetTokenTable()
RadioGroupDateConstraints.Properties.Items.AddRange(LoadDateConstraints().ToArray)
ComboBoxDateAttributes.Properties.Items.AddRange(LoadDateAttributes()) ComboBoxDateAttributes.Properties.Items.AddRange(LoadDateAttributes())
GridPredefinedSearches.DataSource = LoadPredefinedSearches() GridPredefinedSearches.DataSource = LoadPredefinedSearches()
Dim oTokens = GetTokensFromTable(Of AttributeValueToken)(TokenTable) Dim oTokens = GetTokensFromTable(Of AttributeValueToken)(TokenTable)
AddTokens(TokenEditEx1, oTokens) AddTokens(TokenEditEx1, oTokens)
TileView1.FocusedRowHandle = GridControl.InvalidRowHandle
FormLoading = False FormLoading = False
End Sub End Sub
@ -63,21 +65,24 @@ Public Class frmFlowSearch2
}) })
Next Next
Return oTokens.Distinct().ToList() Return oTokens.
OrderBy(Function(token) token.TermValue).
Distinct().
ToList()
End Function End Function
Private Function LoadDateConstraints() As List(Of RadioGroupItem) 'Private Function LoadDateConstraints() As List(Of RadioGroupItem)
Return New List(Of RadioGroupItem) From { ' Return New List(Of RadioGroupItem) From {
New RadioGroupItem(SearchRunner.CREATED_TODAY, "Heute"), ' New RadioGroupItem(SearchRunner.CREATED_TODAY, "Heute"),
New RadioGroupItem(SearchRunner.CREATED_TOMORROW, "Gestern"), ' New RadioGroupItem(SearchRunner.CREATED_TOMORROW, "Gestern"),
New RadioGroupItem(SearchRunner.CREATED_LAST_7_DAYS, "Letzte 7 Tage"), ' New RadioGroupItem(SearchRunner.CREATED_LAST_7_DAYS, "Letzte 7 Tage"),
New RadioGroupItem(SearchRunner.CREATED_MONTH_CURR, "Dieser Monat"), ' New RadioGroupItem(SearchRunner.CREATED_MONTH_CURR, "Dieser Monat"),
New RadioGroupItem(SearchRunner.CREATED_LAST_7_DAYS, "Letzter Monat"), ' New RadioGroupItem(SearchRunner.CREATED_LAST_7_DAYS, "Letzter Monat"),
New RadioGroupItem(SearchRunner.CREATED_YEAR_CURRENT, "Dieses Jahr"), ' New RadioGroupItem(SearchRunner.CREATED_YEAR_CURRENT, "Dieses Jahr"),
New RadioGroupItem(SearchRunner.CREATED_YEAR_LAST, "Letztes Jahr"), ' New RadioGroupItem(SearchRunner.CREATED_YEAR_LAST, "Letztes Jahr"),
New RadioGroupItem("NOTHING", "Keine Einschränkung") ' New RadioGroupItem("NOTHING", "Keine Einschränkung")
} ' }
End Function 'End Function
Private Function LoadDateAttributes() As List(Of String) Private Function LoadDateAttributes() As List(Of String)
Return My.Tables.DTIDB_ATTRIBUTE. Return My.Tables.DTIDB_ATTRIBUTE.
@ -105,7 +110,7 @@ Public Class frmFlowSearch2
.Image = SvgImageCollection1.Item("yesterday") .Image = SvgImageCollection1.Item("yesterday")
}, },
New PredefinedDateSearch() With { New PredefinedDateSearch() With {
.Name = "Letzte Woche", .Name = "Letzte 7 Tage",
.Description = "Dokumente, die in den letzten 7 Tagen abgelegt wurden", .Description = "Dokumente, die in den letzten 7 Tagen abgelegt wurden",
.DateConstraint = SearchRunner.DateConstraint.Last7Days, .DateConstraint = SearchRunner.DateConstraint.Last7Days,
.Image = SvgImageCollection1.Item("week") .Image = SvgImageCollection1.Item("week")
@ -142,72 +147,52 @@ Public Class frmFlowSearch2
Return oTokens.Select(Of Token)(Function(token) token.Value).ToList() Return oTokens.Select(Of Token)(Function(token) token.Value).ToList()
End Function End Function
Private Async Sub TextEdit1_KeyUp(sender As Object, e As KeyEventArgs)
If e.KeyCode = Keys.Enter Then
Await RunSearch(GetTokens())
End If
End Sub
Private Async Sub SearchControl2_KeyUp(sender As Object, e As KeyEventArgs) Handles TokenEditEx1.KeyUp Private Async Sub SearchControl2_KeyUp(sender As Object, e As KeyEventArgs) Handles TokenEditEx1.KeyUp
If e.KeyCode = Keys.Enter And TokenEditEx1.IsPopupOpen = False Then If e.KeyCode = Keys.Enter And TokenEditEx1.IsPopupOpen = False Then
Await RunSearch(GetTokens()) Await RunSearch2(GetTokens())
End If End If
End Sub End Sub
Private Async Sub TextEdit1_ButtonClick(sender As Object, e As DevExpress.XtraEditors.Controls.ButtonPressedEventArgs) Private Async Function RunSearch2(pTokens As IEnumerable(Of Token)) As Threading.Tasks.Task
If e.Button.Tag = "SEARCH" Then
Await RunSearch(GetTokens())
End If
End Sub
Private Async Function RunSearch(pTokens As IEnumerable(Of Token)) As Threading.Tasks.Task
Dim oHandle = StartUpdateUI() Dim oHandle = StartUpdateUI()
If pTokens.Count = 0 Then
Exit Function
End If
Try
Dim oDateFrom = DateEditFrom.EditValue
Dim oDateTo = DateEditTo.EditValue
If CheckEdit1.IsOn = False Then
oDateTo = Nothing
End If
SearchRunner.SetDateConstraint()
Dim oResult = Await SearchRunner.RunWithSearchTerm(String.Empty, oDateFrom, oDateTo, pTokens, "")
If oResult.OK = False Then
SetStatusBarColor(Color.OrangeRed, Color.White)
End If
lblResults.Caption = $"{oResult.Count} Ergebnisse"
Catch ex As Exception
MsgBox(ex.Message)
Finally
StopUpdateUI(oHandle)
End Try
End Function
Private Async Sub TileView1_ItemClick(sender As Object, e As TileViewItemClickEventArgs) Handles TileView1.ItemClick
Dim oHandle = StartUpdateUI()
Try
Dim oSearch = TileView1.GetRow(TileView1.FocusedRowHandle)
Dim oSearchTitle As String = "Suche" Dim oSearchTitle As String = "Suche"
If TypeOf oSearch Is PredefinedDateSearch Then Try
' If the user clicked on a Search Tile, it will set the date constraint for this search
Dim oSearch = TileView1.GetRow(TileView1.FocusedRowHandle)
If oSearch IsNot Nothing AndAlso TypeOf oSearch Is PredefinedDateSearch Then
Dim oDateSearch As PredefinedDateSearch = oSearch Dim oDateSearch As PredefinedDateSearch = oSearch
oSearchTitle = oDateSearch.DisplayName oSearchTitle = oDateSearch.DisplayName
SearchRunner.SetDateConstraint(oDateSearch.DateConstraint) SearchRunner.SetDateConstraint(oDateSearch.DateConstraint)
Else
SearchRunner.SetDateConstraint()
End If End If
Dim oResult = Await SearchRunner.RunWithSearchTerm("", oSearchTitle) ' If the user selected a custom date range, process it including the 'with end date' toggle
Dim oDateFrom, oDateTo As Date
If chkDatefilter2.Checked Then
oDateFrom = DateEditFrom.EditValue
oDateTo = DateEditTo.EditValue
If CheckEdit1.IsOn = False Then
oDateTo = Nothing
End If
Else
oDateFrom = Nothing
oDateTo = Nothing
End If
' Run the actual search
Dim oResult As SearchRunner.SearchResult
If chkSearchEverywhere.Checked Then
Dim oToken = pTokens.First()
oResult = Await SearchRunner.RunWithSearchTerm(oToken.TermValue, oDateFrom, oDateTo, oSearchTitle)
Else
oResult = Await SearchRunner.RunWithTokens(pTokens)
End If
' If there was an error, show the message
' otherwise just show the count of results and color it
' if none were found
If oResult.OK = False Then If oResult.OK = False Then
SetStatusBarColor(Color.OrangeRed, Color.White) SetStatusBarColor(Color.OrangeRed, Color.White)
lblResults.Caption = oResult.ErrorMessage lblResults.Caption = oResult.ErrorMessage
@ -221,11 +206,86 @@ Public Class frmFlowSearch2
End If End If
' Reset the clicked tile
TileView1.FocusedRowHandle = GridControl.InvalidRowHandle
Catch ex As Exception Catch ex As Exception
MsgBox(ex.Message) MsgBox(ex.Message)
Finally Finally
StopUpdateUI(oHandle) StopUpdateUI(oHandle)
End Try End Try
End Function
'Private Async Function RunSearch(pTokens As IEnumerable(Of Token)) As Threading.Tasks.Task
' Dim oHandle = StartUpdateUI()
' If pTokens.Count = 0 Then
' Exit Function
' End If
' Try
' Dim oDateFrom = DateEditFrom.EditValue
' Dim oDateTo = DateEditTo.EditValue
' If CheckEdit1.IsOn = False Then
' oDateTo = Nothing
' End If
' SearchRunner.SetDateConstraint()
' Dim oResult = Await SearchRunner.RunWithSearchTerm(String.Empty, oDateFrom, oDateTo, pTokens, "")
' If oResult.OK = False Then
' SetStatusBarColor(Color.OrangeRed, Color.White)
' End If
' lblResults.Caption = $"{oResult.Count} Ergebnisse"
' Catch ex As Exception
' MsgBox(ex.Message)
' Finally
' StopUpdateUI(oHandle)
' End Try
'End Function
Private Async Sub TileView1_ItemClick(sender As Object, e As TileViewItemClickEventArgs) Handles TileView1.ItemClick
Await RunSearch2(GetTokens())
'Dim oHandle = StartUpdateUI()
'TokenEditEx1.Properties.Tokens.Clear()
'Try
' Dim oSearch = TileView1.GetRow(TileView1.FocusedRowHandle)
' Dim oSearchTitle As String = "Suche"
' If TypeOf oSearch Is PredefinedDateSearch Then
' Dim oDateSearch As PredefinedDateSearch = oSearch
' oSearchTitle = oDateSearch.DisplayName
' SearchRunner.SetDateConstraint(oDateSearch.DateConstraint)
' End If
' Dim oResult = Await SearchRunner.RunWithSearchTerm("", oSearchTitle)
' If oResult.OK = False Then
' SetStatusBarColor(Color.OrangeRed, Color.White)
' lblResults.Caption = oResult.ErrorMessage
' ElseIf oResult.Count = 0 Then
' SetStatusBarColor(Color.OrangeRed, Color.White)
' lblResults.Caption = $"Keine Ergebnisse"
' Else
' lblResults.Caption = $"{oResult.Count} Ergebnisse"
' End If
'Catch ex As Exception
' MsgBox(ex.Message)
'Finally
' StopUpdateUI(oHandle)
'End Try
End Sub End Sub
Private Function StartUpdateUI() As IOverlaySplashScreenHandle Private Function StartUpdateUI() As IOverlaySplashScreenHandle
@ -255,17 +315,6 @@ Public Class frmFlowSearch2
LookAndFeelHelper.ForceDefaultLookAndFeelChanged() LookAndFeelHelper.ForceDefaultLookAndFeelChanged()
End Sub End Sub
Private Sub RadioGroup1_EditValueChanged(sender As Object, e As EventArgs) Handles RadioGroupDateConstraints.EditValueChanged
Dim oIndex = RadioGroupDateConstraints.SelectedIndex
Dim oItem As RadioGroupItem = RadioGroupDateConstraints.Properties.Items.Item(oIndex)
Dim oSearchConstraintString As String = oItem.Value
Dim oDateConstraint = SearchRunner.ConstantToDateConstraint(oSearchConstraintString)
If oDateConstraint <> SearchRunner.DateConstraint.Undefined Then
SearchRunner.SetDateConstraint(oDateConstraint)
End If
End Sub
Friend Class PredefinedSearch Friend Class PredefinedSearch
Public Property Name As String Public Property Name As String
Public Property Description As String Public Property Description As String
@ -299,6 +348,12 @@ Public Class frmFlowSearch2
AddTokens(Editor, Tokens) AddTokens(Editor, Tokens)
End Sub End Sub
Private Sub ClearTokens(Editor As TokenEdit)
'Editor.Properties.Tokens.Clear()
'TODO
End Sub
Private Sub AddTokens(Editor As TokenEdit, Tokens As IEnumerable(Of Token)) Private Sub AddTokens(Editor As TokenEdit, Tokens As IEnumerable(Of Token))
For Each oToken In Tokens For Each oToken In Tokens
Dim oTokenEditToken = New TokenEditToken With { Dim oTokenEditToken = New TokenEditToken With {
@ -314,7 +369,9 @@ Public Class frmFlowSearch2
Select Case e.Value.GetType() Select Case e.Value.GetType()
Case GetType(AttributeValueToken) Case GetType(AttributeValueToken)
e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 255, 214, 49)), e.Bounds) e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 255, 214, 49)), e.Bounds)
Case Else
Case GetType(ValueOnlyToken)
e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 255, 214, 49)), e.Bounds)
End Select End Select
' Draw the glyph on top ' Draw the glyph on top
@ -339,10 +396,8 @@ Public Class frmFlowSearch2
Private Sub BarCheckItem3_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles chkDatefilter2.CheckedChanged Private Sub BarCheckItem3_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles chkDatefilter2.CheckedChanged
If chkDatefilter2.Checked Then If chkDatefilter2.Checked Then
LayoutControlGroupDate1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always
LayoutControlGroupDate2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always LayoutControlGroupDate2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always
Else Else
LayoutControlGroupDate1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never
LayoutControlGroupDate2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never LayoutControlGroupDate2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never
End If End If
End Sub End Sub
@ -354,13 +409,14 @@ Public Class frmFlowSearch2
' Create a list of tokens that only contains every term once, ' Create a list of tokens that only contains every term once,
' without caring about attribute names. ' without caring about attribute names.
oTokens = GetTokensFromTable(Of ValueOnlyToken)(TokenTable) oTokens = GetTokensFromTable(Of ValueOnlyToken)(TokenTable)
RibbonPageGroup5.Enabled = False
Else Else
' Create a list of tokens where every term - attribute value is present once. ' Create a list of tokens where every term - attribute value is present once.
oTokens = GetTokensFromTable(Of AttributeValueToken)(TokenTable) oTokens = GetTokensFromTable(Of AttributeValueToken)(TokenTable)
RibbonPageGroup5.Enabled = True
End If End If
ClearTokens(TokenEditEx1)
SetTokens(TokenEditEx1, oTokens) SetTokens(TokenEditEx1, oTokens)
End Sub End Sub

View File

@ -40,6 +40,12 @@ Public Class TokenEditViewInfoEx
MyBase.New(item) MyBase.New(item)
End Sub End Sub
Protected Overrides ReadOnly Property IndentBetweenItems As Integer
Get
Return 10
End Get
End Property
Protected Overrides Function CalcItemSizeCore(token As TokenEditToken) As Size Protected Overrides Function CalcItemSizeCore(token As TokenEditToken) As Size
Dim oSize = MyBase.CalcItemSizeCore(token) Dim oSize = MyBase.CalcItemSizeCore(token)
oSize.Width += 15 oSize.Width += 15