ZooFlow: WIP Search
This commit is contained in:
@@ -1,41 +1,28 @@
|
||||
Imports System.Collections
|
||||
Imports System.ComponentModel
|
||||
Imports DevExpress.XtraEditors
|
||||
Imports DigitalData.GUIs.ZooFlow.SearchToken
|
||||
Imports DigitalData.GUIs.ZooFlow.Search
|
||||
Imports DigitalData.GUIs.ZooFlow.Search.SearchToken
|
||||
Imports DigitalData.Modules.EDMI.API
|
||||
|
||||
Public Class frmSearchNeu
|
||||
Private ReadOnly TokenListAttributes As New Dictionary(Of String, Object) From {
|
||||
{"Rechnungsnummer", New SearchToken.AttributeKeyToken("InvoiceNo")},
|
||||
{"Rechnungsdatum", New SearchToken.AttributeKeyToken("InvoiceDate")},
|
||||
{"Kundennummer", New SearchToken.AttributeKeyToken("CustNo")}
|
||||
}
|
||||
Private ReadOnly TokenListAttrValues As New Dictionary(Of String, Object) From {
|
||||
{"1233", New SearchToken.AttributeValueToken(1233)},
|
||||
{"1234", New SearchToken.AttributeValueToken(1234)},
|
||||
{"1235", New SearchToken.AttributeValueToken(1235)},
|
||||
{"4711", New SearchToken.AttributeValueToken(4711)},
|
||||
{"4712", New SearchToken.AttributeValueToken(4712)}
|
||||
}
|
||||
Private ReadOnly TokenListDate As New Dictionary(Of String, Object) From {
|
||||
{"heute", New SearchToken.DateToken(Date.Now)},
|
||||
{"gestern", New SearchToken.DateToken(Date.Now.AddDays(-1))},
|
||||
{"letzte Woche", New SearchToken.DateToken(TimeSpan.FromDays(-7))},
|
||||
{"letzter Monat", New SearchToken.DateToken(TimeSpan.FromDays(-30))}
|
||||
}
|
||||
Private ReadOnly TokenListOperands As New Dictionary(Of String, Object) From {
|
||||
{"gleich", New AttributeOperatorToken(OperatorToken.Equals)},
|
||||
{"nicht gleich", New AttributeOperatorToken(OperatorToken.NotEquals)}
|
||||
}
|
||||
Private TokenListDefault As Dictionary(Of String, Object)
|
||||
Private Search As Search.Search
|
||||
Private Database As DatabaseWithFallback
|
||||
|
||||
Private TokenListDefault As New Dictionary(Of String, Object)
|
||||
Private TokenListOperands As New Dictionary(Of String, Object)
|
||||
Private TokenListAttrValues As New Dictionary(Of String, Object)
|
||||
|
||||
|
||||
Private InputMode As InputMode = InputMode.Default
|
||||
Private SearchQuery As New BindingList(Of SearchCriteria)
|
||||
|
||||
Private Sub XtraForm1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
TokenListDefault = TokenListAttributes
|
||||
AddTokens(SearchControl2, TokenListDefault)
|
||||
Database = New DatabaseWithFallback(My.LogConfig, My.Application.Service.Client, My.DatabaseECM, My.DatabaseIDB)
|
||||
Search = New Search.Search(My.LogConfig, My.Application.User, Database)
|
||||
|
||||
GridControl1.DataSource = SearchQuery
|
||||
Dim oTokens = Search.GetAttributeTokens()
|
||||
AddTokens(SearchControl2, oTokens)
|
||||
|
||||
GridControl1.DataSource = Search.Query
|
||||
cmbSelect.SelectedIndex = 0
|
||||
End Sub
|
||||
|
||||
@@ -73,27 +60,27 @@ Public Class frmSearchNeu
|
||||
|
||||
Case GetType(AttributeKeyToken)
|
||||
' After the attribute key comes an operator
|
||||
SetTokens(pEditor, TokenListOperands)
|
||||
InputMode = InputMode.Operator
|
||||
SetTokens(pEditor, Search.GetOperatorTokens(GetType(String)))
|
||||
Search.InputMode = InputMode.Operator
|
||||
|
||||
Case GetType(AttributeOperatorToken)
|
||||
' After the attribute operator comes a value
|
||||
SetTokens(pEditor, TokenListAttrValues)
|
||||
InputMode = InputMode.Value
|
||||
Search.InputMode = InputMode.Value
|
||||
|
||||
Case GetType(AttributeValueToken)
|
||||
' After the attribute value comes another value
|
||||
SetTokens(pEditor, TokenListAttrValues)
|
||||
InputMode = InputMode.Value
|
||||
Search.InputMode = InputMode.Value
|
||||
|
||||
Case Else
|
||||
SetTokens(pEditor, TokenListDefault)
|
||||
InputMode = InputMode.Default
|
||||
Search.InputMode = InputMode.Default
|
||||
|
||||
End Select
|
||||
Else
|
||||
SetTokens(pEditor, TokenListDefault)
|
||||
InputMode = InputMode.Default
|
||||
Search.InputMode = InputMode.Default
|
||||
End If
|
||||
|
||||
pEditor.Properties.EndUpdate()
|
||||
@@ -119,8 +106,8 @@ Public Class frmSearchNeu
|
||||
End Sub
|
||||
|
||||
Private Sub SearchControl2_KeyUp(sender As Object, e As KeyEventArgs) Handles SearchControl2.KeyUp
|
||||
If InputMode = InputMode.Value And e.KeyCode = Keys.Enter And e.Control = True Then
|
||||
SearchQuery.Add(New SearchCriteria With {
|
||||
If Search.InputMode = InputMode.Value And e.KeyCode = Keys.Enter And SearchControl2.IsPopupOpen Then
|
||||
Search.Query.Add(New SearchCriteria With {
|
||||
.ParenLeft = False,
|
||||
.Key = "test",
|
||||
.Op = OperatorToken.Equals,
|
||||
@@ -129,4 +116,8 @@ Public Class frmSearchNeu
|
||||
})
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub RibbonControl1_Click(sender As Object, e As EventArgs) Handles RibbonControl1.Click
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user