Zooflow: Refactor Search for

This commit is contained in:
Jonathan Jenne
2022-05-19 10:32:08 +02:00
parent bd5d63c234
commit 26a82f4af0
4 changed files with 192 additions and 96 deletions

View File

@@ -26,9 +26,10 @@ Public Class frmFlowSearch2
}
RadioGroup1.Properties.Items.AddRange(LoadDateConstraints.ToArray)
RadioGroupDateConstraints.Properties.Items.AddRange(LoadDateConstraints().ToArray)
ComboBoxDateAttributes.Properties.Items.AddRange(LoadDateAttributes())
GridPredefinedSearches.DataSource = LoadPredefinedSearches()
GridControl1.DataSource = LoadPredefinedSearches()
Dim oTokens = GetValueTokensForAttribute()
AddTokens(TokenEditEx1, oTokens)
@@ -83,6 +84,17 @@ Public Class frmFlowSearch2
}
End Function
Private Function LoadDateAttributes() As List(Of String)
Return 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()
End Function
Private Function LoadPredefinedSearches() As List(Of PredefinedSearch)
Return New List(Of PredefinedSearch) From {
New PredefinedDateSearch() With {
@@ -230,9 +242,9 @@ Public Class frmFlowSearch2
End Sub
Private Sub RadioGroup1_EditValueChanged(sender As Object, e As EventArgs) Handles RadioGroup1.EditValueChanged
Dim oIndex = RadioGroup1.SelectedIndex
Dim oItem As RadioGroupItem = RadioGroup1.Properties.Items.Item(oIndex)
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)
@@ -306,4 +318,12 @@ Public Class frmFlowSearch2
' This fixes: https://supportcenter.devexpress.com/ticket/details/t215578/tokenedit-glyph-is-not-visible-when-customdrawtokentext-is-used
e.DefaultDraw()
End Sub
Private Sub ComboBoxDateAttributes_EditValueChanged(sender As Object, e As EventArgs) Handles ComboBoxDateAttributes.EditValueChanged
SearchRunner.SetDateAttribute(ComboBoxDateAttributes.EditValue)
End Sub
Private Sub BarToggleSwitchItem1_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarToggleSwitchItem1.CheckedChanged
End Sub
End Class