Zooflow: Search tweaks

This commit is contained in:
Jonathan Jenne 2022-05-20 16:31:59 +02:00
parent a0f99ba5a4
commit 4f04ef9cc8
6 changed files with 95 additions and 128 deletions

View File

@ -104,11 +104,26 @@ Public Class SearchRunner
End Function
Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date, pSearchTitle As String) As Task(Of SearchResult)
Return Await RunWithSearchTerm(New SearchOptions With {.SearchString = pSearchTerm, .SearchTitle = pSearchTitle})
Return Await RunWithSearchTerm(New SearchOptions With {
.SearchString = pSearchTerm,
.SearchTitle = pSearchTitle,
.DateFrom = pDateFrom,
.DateTo = pDateTo
})
End Function
Public Async Function RunWithTokens(pTokens As IEnumerable(Of Search.SearchToken.Token)) As Task(Of SearchResult)
Return Await RunWithSearchTerm(New SearchOptions With {.SearchTokens = pTokens})
Return Await RunWithSearchTerm(New SearchOptions With {
.SearchTokens = pTokens
})
End Function
Public Async Function RunWithTokens(pTokens As IEnumerable(Of Search.SearchToken.Token), pDateFrom As Date, pDateTo As Date, pSearchTitle As String) As Task(Of SearchResult)
Return Await RunWithSearchTerm(New SearchOptions With {
.SearchTokens = pTokens,
.DateFrom = pDateFrom,
.DateTo = pDateTo
})
End Function
@ -125,7 +140,7 @@ Public Class SearchRunner
Dim oSQL
If oTokens.Count > 0 Then
If oTokens IsNot Nothing AndAlso oTokens.Count > 0 Then
Await InsertSearchTokens(oTokens)
oSQL = $"EXEC PRIDB_SEARCH_GET_TOKEN_RESULT_DOCS {UserId}, '{oDateConstraint}', '{UserLanguage}'"
ElseIf oSearchTerm IsNot Nothing Then
@ -225,9 +240,9 @@ Public Class SearchRunner
Dim oDateTo As Date
If pDateTo.Equals(Date.MinValue) Then
oDateTo = pDateTo
Else
oDateTo = pDateFrom
Else
oDateTo = pDateTo
End If
Dim oProc = $"EXEC PRIDB_SEARCH_ADD_USR_DATE {UserId},'{pDateFrom}','{oDateTo}'"
If Await My.Database.ExecuteNonQueryIDBAsync(oProc) = True Then

View File

@ -279,17 +279,17 @@ Partial Class frmFlowSearch2
Me.TokenEditEx1.Properties.Appearance.Options.UseFont = True
Me.TokenEditEx1.Properties.NullText = "Suchbegriff eingeben.."
Me.TokenEditEx1.Properties.Separators.AddRange(New String() {","})
Me.TokenEditEx1.Size = New System.Drawing.Size(866, 36)
Me.TokenEditEx1.Size = New System.Drawing.Size(866, 44)
Me.TokenEditEx1.StyleController = Me.LayoutControl1
Me.TokenEditEx1.TabIndex = 4
'
'GridPredefinedSearches
'
Me.GridPredefinedSearches.Location = New System.Drawing.Point(14, 92)
Me.GridPredefinedSearches.Location = New System.Drawing.Point(14, 100)
Me.GridPredefinedSearches.MainView = Me.TileView1
Me.GridPredefinedSearches.MenuManager = Me.RibbonControl1
Me.GridPredefinedSearches.Name = "GridPredefinedSearches"
Me.GridPredefinedSearches.Size = New System.Drawing.Size(858, 96)
Me.GridPredefinedSearches.Size = New System.Drawing.Size(858, 93)
Me.GridPredefinedSearches.TabIndex = 1
Me.GridPredefinedSearches.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.TileView1, Me.GridView1})
'
@ -353,7 +353,7 @@ Partial Class frmFlowSearch2
'DateEditFrom
'
Me.DateEditFrom.EditValue = Nothing
Me.DateEditFrom.Location = New System.Drawing.Point(101, 231)
Me.DateEditFrom.Location = New System.Drawing.Point(101, 236)
Me.DateEditFrom.MenuManager = Me.RibbonControl1
Me.DateEditFrom.Name = "DateEditFrom"
Me.DateEditFrom.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
@ -365,7 +365,7 @@ Partial Class frmFlowSearch2
'DateEditTo
'
Me.DateEditTo.EditValue = Nothing
Me.DateEditTo.Location = New System.Drawing.Point(101, 284)
Me.DateEditTo.Location = New System.Drawing.Point(101, 289)
Me.DateEditTo.MenuManager = Me.RibbonControl1
Me.DateEditTo.Name = "DateEditTo"
Me.DateEditTo.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
@ -376,7 +376,7 @@ Partial Class frmFlowSearch2
'
'CheckEdit1
'
Me.CheckEdit1.Location = New System.Drawing.Point(4, 258)
Me.CheckEdit1.Location = New System.Drawing.Point(4, 263)
Me.CheckEdit1.MenuManager = Me.RibbonControl1
Me.CheckEdit1.Name = "CheckEdit1"
Me.CheckEdit1.Properties.OffText = "Datum bis deaktiviert"
@ -387,7 +387,7 @@ Partial Class frmFlowSearch2
'
'ComboBoxDateAttributes
'
Me.ComboBoxDateAttributes.Location = New System.Drawing.Point(101, 314)
Me.ComboBoxDateAttributes.Location = New System.Drawing.Point(101, 319)
Me.ComboBoxDateAttributes.MenuManager = Me.RibbonControl1
Me.ComboBoxDateAttributes.Name = "ComboBoxDateAttributes"
Me.ComboBoxDateAttributes.Properties.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
@ -413,10 +413,10 @@ Partial Class frmFlowSearch2
Me.LayoutControlGroupDate2.AppearanceGroup.Options.UseBorderColor = True
Me.LayoutControlGroupDate2.BestFitWeight = 0
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(0, 202)
Me.LayoutControlGroupDate2.Location = New System.Drawing.Point(0, 207)
Me.LayoutControlGroupDate2.Name = "LayoutControlGroupDate2"
Me.LayoutControlGroupDate2.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0)
Me.LayoutControlGroupDate2.Size = New System.Drawing.Size(886, 211)
Me.LayoutControlGroupDate2.Size = New System.Drawing.Size(886, 206)
Me.LayoutControlGroupDate2.Text = "Eigenes Datum"
Me.LayoutControlGroupDate2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never
'
@ -446,7 +446,7 @@ Partial Class frmFlowSearch2
Me.EmptySpaceItem1.AllowHotTrack = False
Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 113)
Me.EmptySpaceItem1.Name = "EmptySpaceItem1"
Me.EmptySpaceItem1.Size = New System.Drawing.Size(882, 72)
Me.EmptySpaceItem1.Size = New System.Drawing.Size(882, 67)
Me.EmptySpaceItem1.TextSize = New System.Drawing.Size(0, 0)
'
'LayoutControlItem6
@ -473,9 +473,9 @@ Partial Class frmFlowSearch2
Me.LayoutControlGroup3.AppearanceGroup.BorderColor = System.Drawing.Color.FromArgb(CType(CType(165, Byte), Integer), CType(CType(36, Byte), Integer), CType(CType(19, Byte), Integer))
Me.LayoutControlGroup3.AppearanceGroup.Options.UseBorderColor = True
Me.LayoutControlGroup3.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem3})
Me.LayoutControlGroup3.Location = New System.Drawing.Point(0, 56)
Me.LayoutControlGroup3.Location = New System.Drawing.Point(0, 64)
Me.LayoutControlGroup3.Name = "LayoutControlGroup3"
Me.LayoutControlGroup3.Size = New System.Drawing.Size(886, 146)
Me.LayoutControlGroup3.Size = New System.Drawing.Size(886, 143)
Me.LayoutControlGroup3.Text = "Meine Suchen"
'
'LayoutControlItem3
@ -483,7 +483,7 @@ Partial Class frmFlowSearch2
Me.LayoutControlItem3.Control = Me.GridPredefinedSearches
Me.LayoutControlItem3.Location = New System.Drawing.Point(0, 0)
Me.LayoutControlItem3.Name = "LayoutControlItem3"
Me.LayoutControlItem3.Size = New System.Drawing.Size(862, 100)
Me.LayoutControlItem3.Size = New System.Drawing.Size(862, 97)
Me.LayoutControlItem3.TextSize = New System.Drawing.Size(0, 0)
Me.LayoutControlItem3.TextVisible = False
'
@ -493,7 +493,7 @@ Partial Class frmFlowSearch2
Me.LayoutControlItem7.Location = New System.Drawing.Point(0, 0)
Me.LayoutControlItem7.Name = "LayoutControlItem7"
Me.LayoutControlItem7.Padding = New DevExpress.XtraLayout.Utils.Padding(10, 10, 10, 10)
Me.LayoutControlItem7.Size = New System.Drawing.Size(886, 56)
Me.LayoutControlItem7.Size = New System.Drawing.Size(886, 64)
Me.LayoutControlItem7.TextSize = New System.Drawing.Size(0, 0)
Me.LayoutControlItem7.TextVisible = False
'

View File

@ -71,27 +71,22 @@ Public Class frmFlowSearch2
ToList()
End Function
'Private Function LoadDateConstraints() As List(Of RadioGroupItem)
' Return New List(Of RadioGroupItem) From {
' New RadioGroupItem(SearchRunner.CREATED_TODAY, "Heute"),
' New RadioGroupItem(SearchRunner.CREATED_TOMORROW, "Gestern"),
' New RadioGroupItem(SearchRunner.CREATED_LAST_7_DAYS, "Letzte 7 Tage"),
' New RadioGroupItem(SearchRunner.CREATED_MONTH_CURR, "Dieser Monat"),
' New RadioGroupItem(SearchRunner.CREATED_LAST_7_DAYS, "Letzter Monat"),
' New RadioGroupItem(SearchRunner.CREATED_YEAR_CURRENT, "Dieses Jahr"),
' New RadioGroupItem(SearchRunner.CREATED_YEAR_LAST, "Letztes Jahr"),
' New RadioGroupItem("NOTHING", "Keine Einschränkung")
' }
'End Function
Private Function LoadDateAttributes() As List(Of String)
Return My.Tables.DTIDB_ATTRIBUTE.
Dim oAttributes = My.Tables.DTIDB_ATTRIBUTE.
AsEnumerable().
Where(Function(row) CBool(row.Item("SYS_ATTRIBUTE")) = False).
Where(Function(row) row.Item("TYP_ID") = 5 Or row.Item("TYP_ID") = 6).
Select(Function(row) row.Item("ATTR_TITLE")).
Cast(Of String).
ToList()
If My.Application.User.Language = "de-DE" Then
oAttributes.Add(IDB_ADDED_WHEN_String_German)
Else
oAttributes.Add(IDB_ADDED_WHEN_String_Englisch)
End If
Return oAttributes
End Function
@ -153,6 +148,10 @@ Public Class frmFlowSearch2
End If
End Sub
Private Async Sub TileView1_ItemClick(sender As Object, e As TileViewItemClickEventArgs) Handles TileView1.ItemClick
Await RunSearch2(GetTokens())
End Sub
Private Async Function RunSearch2(pTokens As IEnumerable(Of Token)) As Threading.Tasks.Task
Dim oHandle = StartUpdateUI()
Dim oSearchTitle As String = "Suche"
@ -187,7 +186,7 @@ Public Class frmFlowSearch2
Dim oToken = pTokens.First()
oResult = Await SearchRunner.RunWithSearchTerm(oToken.TermValue, oDateFrom, oDateTo, oSearchTitle)
Else
oResult = Await SearchRunner.RunWithTokens(pTokens)
oResult = Await SearchRunner.RunWithTokens(pTokens, oDateFrom, oDateTo, oSearchTitle)
End If
' If there was an error, show the message
@ -216,77 +215,7 @@ Public Class frmFlowSearch2
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
Private Function StartUpdateUI() As IOverlaySplashScreenHandle
SetStatusBarColor(Color.FromArgb(255, 240, 240, 240), Color.Black)
@ -343,24 +272,22 @@ Public Class frmFlowSearch2
DateEditTo.Enabled = CheckEdit1.IsOn
End Sub
Private Sub SetTokens(Editor As TokenEdit, Tokens As IEnumerable(Of Token))
Editor.Properties.Tokens.Clear()
AddTokens(Editor, Tokens)
Private Sub SetTokens(pEditor As TokenEdit, Tokens As IEnumerable(Of Token))
pEditor.Properties.Tokens.Clear()
AddTokens(pEditor, Tokens)
End Sub
Private Sub ClearTokens(Editor As TokenEdit)
'Editor.Properties.Tokens.Clear()
'TODO
Private Sub ClearTokens(pEditor As TokenEdit)
pEditor.EditValue = Nothing
End Sub
Private Sub AddTokens(Editor As TokenEdit, Tokens As IEnumerable(Of Token))
Private Sub AddTokens(pEditor As TokenEdit, Tokens As IEnumerable(Of Token))
For Each oToken In Tokens
Dim oTokenEditToken = New TokenEditToken With {
.Description = oToken.ToString,
.Value = oToken
}
Editor.Properties.Tokens.Add(oTokenEditToken)
pEditor.Properties.Tokens.Add(oTokenEditToken)
Next
End Sub
@ -380,7 +307,13 @@ Public Class frmFlowSearch2
End Sub
Private Sub ComboBoxDateAttributes_EditValueChanged(sender As Object, e As EventArgs) Handles ComboBoxDateAttributes.EditValueChanged
SearchRunner.SetDateAttribute(ComboBoxDateAttributes.EditValue)
Dim oEditValue As String = ComboBoxDateAttributes.EditValue
If oEditValue = IDB_ADDED_WHEN_String_German Or oEditValue = IDB_ADDED_WHEN_String_Englisch Then
SearchRunner.SetDateAttribute()
Else
SearchRunner.SetDateAttribute(oEditValue)
End If
End Sub
Private Sub TokenEditEx1_Properties_TokenAdding(sender As Object, e As TokenEditTokenAddingEventArgs) Handles TokenEditEx1.Properties.TokenAdding
@ -431,4 +364,8 @@ Public Class frmFlowSearch2
SearchRunner.SetTokenOperator(SearchRunner.TokenOperator.Or)
End If
End Sub
Private Sub TokenEditEx1_Properties_TokenAdded(sender As Object, e As TokenEditTokenAddedEventArgs) Handles TokenEditEx1.Properties.TokenAdded
End Sub
End Class

View File

@ -36,21 +36,31 @@ End Class
Public Class TokenEditViewInfoEx
Inherits TokenEditViewInfo
Const InnerMargin = 3
Public Sub New(item As RepositoryItem)
MyBase.New(item)
End Sub
Protected Overrides ReadOnly Property IndentBetweenItems As Integer
Get
Return 10
Return InnerMargin
End Get
End Property
Protected Overrides Function CalcItemSizeCore(token As TokenEditToken) As Size
Dim oSize = MyBase.CalcItemSizeCore(token)
oSize.Width += 15
Return oSize
End Function
Protected Overrides ReadOnly Property ContentRectMargin As Integer
Get
Return InnerMargin
End Get
End Property
Protected Overrides ReadOnly Property IndentBetweenRows As Integer
Get
Return InnerMargin
End Get
End Property
End Class
@ -62,9 +72,7 @@ Public Class TokenEditEx
RepositoryItemTokenEditEx.RegisterTokenEditEx()
End Sub
Public Sub New()
End Sub
Public Overrides ReadOnly Property EditorTypeName() As String
Get

View File

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

View File

@ -51,10 +51,6 @@
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WMCNNCTDLLLib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Interop.WMOBRWSLib">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WMOBRWSLib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Interop.WMOSRCHLib">
<HintPath>P:\Visual Studio Projekte\Bibliotheken\windream\Interop.WMOSRCHLib.dll</HintPath>
<EmbedInteropTypes>True</EmbedInteropTypes>
@ -149,5 +145,16 @@
<Name>Logging</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<COMReference Include="WMOBRWSLib">
<Guid>{25B51999-6DCA-11D4-B815-00104BB52DEA}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
</Project>