diff --git a/GUIs.ZooFlow/Search/SearchRunner.vb b/GUIs.ZooFlow/Search/SearchRunner.vb index 45a8d919..2c50a74b 100644 --- a/GUIs.ZooFlow/Search/SearchRunner.vb +++ b/GUIs.ZooFlow/Search/SearchRunner.vb @@ -52,11 +52,13 @@ Public Class SearchRunner Private ReadOnly Environment As Environment Private ReadOnly SearchTitle As String + Public ReadOnly Property UserId As Integer Public Sub New(pLogConfig As LogConfig, pEnvironment As Environment, pSearchTitle As String) MyBase.New(pLogConfig) Environment = pEnvironment SearchTitle = pSearchTitle + UserId = My.Application.User.UserId End Sub Public Function RunWithDataTable(pDatatable As DataTable) As SearchResult @@ -98,44 +100,13 @@ Public Class SearchRunner End Function Public Async Function RunWithSearchTerm(pSearchTerm As String, pDateFrom As Date, pDateTo As Date, pSearchTokens As IEnumerable(Of Search.SearchToken.AttributeValueToken), pSearchTitle As String) As Task(Of SearchResult) - If pDateFrom.Equals(Date.MinValue) = False Then - ExplicitDate = True - End If - - Dim oSearchTerm = pSearchTerm Dim oWindowTitle = GetResultWindowString(pSearchTerm, pSearchTitle) Dim oParams = GetParams(oWindowTitle) - Dim oDateConstraint = $"{_ActiveDateAttribute}~{_ActiveDateConstraint}" - Dim oUserId = My.Application.User.UserId + Dim oDateConstraint = GetDateConstraint(pDateFrom, pDateTo) - If ExplicitDate Then - Dim oDate2 As Date - If pDateTo.Equals(Date.MinValue) Then - oDate2 = pDateTo - Else - oDate2 = pDateFrom - End If - Dim oProc = $"EXEC PRIDB_SEARCH_ADD_USR_DATE {oUserId},'{pDateFrom}','{oDate2}'" - If Await My.Database.ExecuteNonQueryIDBAsync(oProc) = True Then - oDateConstraint = $"{_ActiveDateAttribute}~DATEPART" - End If - End If + Await InsertSearchTokens(pSearchTokens) - Await My.Database.ExecuteNonQueryIDBAsync($"DELETE FROM TBIDB_SEARCH_INPUT_USER WHERE USR_ID = {oUserId}") - - If pSearchTokens IsNot Nothing AndAlso pSearchTokens.Count > 0 Then - - For Each oToken In pSearchTokens - Dim oSQLInsert As String = $" - INSERT INTO [dbo].[TBIDB_SEARCH_INPUT_USER] ([USR_ID], [ATTR_ID], [ATTR_TITLE], [TERM_ID], [OPERATOR]) - VALUES ({oUserId}, {oToken.AttributeId}, '{oToken.AttributeTitle}', {oToken.TermId}, 'AND')" - - Dim oResult = Await My.Database.ExecuteNonQueryIDBAsync(oSQLInsert) - Next - - End If - - Dim oSQL = $"EXEC PRIDB_SEARCH_TEXT_GET_RESULTS {oUserId},'{oSearchTerm}','{oDateConstraint}'" + Dim oSQL = $"EXEC PRIDB_SEARCH_TEXT_GET_RESULTS {UserId},'{pSearchTerm}','{oDateConstraint}'" If Await My.Database.ExecuteNonQueryIDBAsync(oSQL) = True Then Dim oDTDocResult = Await My.Database.GetDatatableIDBAsync(BaseSearchSQL) @@ -169,6 +140,63 @@ Public Class SearchRunner End If End Function + Private Async Function GetDateConstraint(pDateFrom As Date, pDateTo As Date) As Task(Of String) + Dim oSimpleDateConstraint = $"{_ActiveDateAttribute}~{_ActiveDateConstraint}" + Dim oExplicitConstraint = Await MaybeSetExplicitDateConstraint(pDateFrom, pDateTo) + + If IsNothing(oExplicitConstraint) Then + Return oSimpleDateConstraint + Else + Return oExplicitConstraint + End If + End Function + + Private Async Function InsertSearchTokens(pTokens As IEnumerable(Of Search.SearchToken.AttributeValueToken)) As Task + Logger.Debug("Deleting previous user tokens..") + Await My.Database.ExecuteNonQueryIDBAsync($"DELETE FROM TBIDB_SEARCH_INPUT_USER WHERE USR_ID = {UserId}") + + If pTokens Is Nothing Then + Logger.Warn("Token Object was nothing!") + Exit Function + End If + + If pTokens.Count = 0 Then + Logger.Warn("Token Object was empty!") + Exit Function + End If + + For Each oToken In pTokens + Dim oSQLInsert As String = $" + INSERT INTO [dbo].[TBIDB_SEARCH_INPUT_USER] ([USR_ID], [ATTR_ID], [ATTR_TITLE], [TERM_ID], [OPERATOR]) + VALUES ({UserId}, {oToken.AttributeId}, '{oToken.AttributeTitle}', {oToken.TermId}, 'AND')" + + Dim oResult = Await My.Database.ExecuteNonQueryIDBAsync(oSQLInsert) + Logger.Warn("Inserting Tokens failed!") + Next + End Function + + + Private Async Function MaybeSetExplicitDateConstraint(pDateFrom As Date, pDateTo As Date) As Task(Of String) + If pDateFrom.Equals(Date.MinValue) = False Then + ExplicitDate = True + + Dim oDateTo As Date + If pDateTo.Equals(Date.MinValue) Then + oDateTo = pDateTo + Else + oDateTo = pDateFrom + End If + Dim oProc = $"EXEC PRIDB_SEARCH_ADD_USR_DATE {UserId},'{pDateFrom}','{oDateTo}'" + If Await My.Database.ExecuteNonQueryIDBAsync(oProc) = True Then + Return $"{_ActiveDateAttribute}~DATEPART" + Else + Return Nothing + End If + End If + + Return Nothing + End Function + Private Sub Form_Closed(sender As Object, e As EventArgs) RaiseEvent Closed(sender, 0) End Sub diff --git a/GUIs.ZooFlow/Search/frmFlowSearch2.Designer.vb b/GUIs.ZooFlow/Search/frmFlowSearch2.Designer.vb index 423423f7..d4aa66a6 100644 --- a/GUIs.ZooFlow/Search/frmFlowSearch2.Designer.vb +++ b/GUIs.ZooFlow/Search/frmFlowSearch2.Designer.vb @@ -53,14 +53,15 @@ Partial Class frmFlowSearch2 Me.LayoutControl1 = New DevExpress.XtraLayout.LayoutControl() Me.TokenEditEx1 = New DigitalData.GUIs.ZooFlow.TokenEditEx() Me.TextEdit1 = New DevExpress.XtraEditors.ButtonEdit() - Me.GridControl1 = New DevExpress.XtraGrid.GridControl() + Me.GridPredefinedSearches = New DevExpress.XtraGrid.GridControl() Me.TileView1 = New DevExpress.XtraGrid.Views.Tile.TileView() Me.colCount = New DevExpress.XtraGrid.Columns.TileViewColumn() Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView() - Me.RadioGroup1 = New DevExpress.XtraEditors.RadioGroup() + Me.RadioGroupDateConstraints = New DevExpress.XtraEditors.RadioGroup() Me.DateEditFrom = New DevExpress.XtraEditors.DateEdit() Me.DateEditTo = New DevExpress.XtraEditors.DateEdit() Me.CheckEdit1 = New DevExpress.XtraEditors.ToggleSwitch() + Me.ComboBoxDateAttributes = New DevExpress.XtraEditors.ComboBoxEdit() Me.Root = New DevExpress.XtraLayout.LayoutControlGroup() Me.LayoutControlGroupDate1 = New DevExpress.XtraLayout.LayoutControlGroup() Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem() @@ -69,11 +70,14 @@ Partial Class frmFlowSearch2 Me.LayoutControlItem4 = New DevExpress.XtraLayout.LayoutControlItem() Me.EmptySpaceItem1 = New DevExpress.XtraLayout.EmptySpaceItem() Me.LayoutControlItem6 = New DevExpress.XtraLayout.LayoutControlItem() + Me.LayoutControlItem8 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlGroup3 = New DevExpress.XtraLayout.LayoutControlGroup() Me.LayoutControlItem3 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem5 = New DevExpress.XtraLayout.LayoutControlItem() Me.LayoutControlItem7 = New DevExpress.XtraLayout.LayoutControlItem() Me.SvgImageCollection1 = New DevExpress.Utils.SvgImageCollection(Me.components) + Me.chkIgnoreAttributes = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.BarToggleSwitchItem1 = New DevExpress.XtraBars.BarToggleSwitchItem() CType(Me.RibbonControl1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.RepositoryItemMarqueeProgressBar1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.PanelControl1, System.ComponentModel.ISupportInitialize).BeginInit() @@ -84,15 +88,16 @@ Partial Class frmFlowSearch2 Me.LayoutControl1.SuspendLayout() CType(Me.TokenEditEx1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TextEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.GridPredefinedSearches, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.TileView1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit() - CType(Me.RadioGroup1.Properties, 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, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.DateEditTo.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.DateEditTo.Properties, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.CheckEdit1.Properties, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.ComboBoxDateAttributes.Properties, 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() @@ -101,6 +106,7 @@ Partial Class frmFlowSearch2 CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.EmptySpaceItem1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).BeginInit() + CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlGroup3, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).BeginInit() @@ -137,15 +143,18 @@ Partial Class frmFlowSearch2 Me.RibbonControl1.ColorScheme = DevExpress.XtraBars.Ribbon.RibbonControlColorScheme.Green Me.RibbonControl1.CommandLayout = DevExpress.XtraBars.Ribbon.CommandLayout.Simplified Me.RibbonControl1.ExpandCollapseItem.Id = 0 - Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.chkFulltext, Me.lblResults, Me.chkDateFilter}) + Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.chkFulltext, Me.lblResults, Me.chkDateFilter, Me.BarToggleSwitchItem1}) Me.RibbonControl1.Location = New System.Drawing.Point(0, 0) - Me.RibbonControl1.MaxItemId = 5 + Me.RibbonControl1.MaxItemId = 6 Me.RibbonControl1.Name = "RibbonControl1" Me.RibbonControl1.Pages.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPage() {Me.RibbonPage1}) Me.RibbonControl1.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.RepositoryItemMarqueeProgressBar1}) Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False] + Me.RibbonControl1.ShowDisplayOptionsMenuButton = DevExpress.Utils.DefaultBoolean.[False] + Me.RibbonControl1.ShowExpandCollapseButton = DevExpress.Utils.DefaultBoolean.[False] + Me.RibbonControl1.ShowPageHeadersMode = DevExpress.XtraBars.Ribbon.ShowPageHeadersMode.Hide Me.RibbonControl1.ShowToolbarCustomizeItem = False - Me.RibbonControl1.Size = New System.Drawing.Size(954, 89) + Me.RibbonControl1.Size = New System.Drawing.Size(954, 63) Me.RibbonControl1.StatusBar = Me.RibbonStatusBar1 Me.RibbonControl1.Toolbar.ShowCustomizeItem = False ' @@ -172,7 +181,7 @@ Partial Class frmFlowSearch2 ' 'RibbonPage1 ' - Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup2, Me.RibbonPageGroup1}) + Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup2, Me.RibbonPageGroup1, Me.chkIgnoreAttributes}) Me.RibbonPage1.Name = "RibbonPage1" Me.RibbonPage1.Text = "Start" ' @@ -210,10 +219,10 @@ Partial Class frmFlowSearch2 ' Me.PanelControl1.Controls.Add(Me.PanelControl2) Me.PanelControl1.Dock = System.Windows.Forms.DockStyle.Fill - Me.PanelControl1.Location = New System.Drawing.Point(0, 89) + Me.PanelControl1.Location = New System.Drawing.Point(0, 63) Me.PanelControl1.Name = "PanelControl1" Me.PanelControl1.Padding = New System.Windows.Forms.Padding(30) - Me.PanelControl1.Size = New System.Drawing.Size(954, 550) + Me.PanelControl1.Size = New System.Drawing.Size(954, 576) Me.PanelControl1.TabIndex = 3 ' 'PanelControl2 @@ -223,7 +232,7 @@ Partial Class frmFlowSearch2 Me.PanelControl2.Location = New System.Drawing.Point(32, 32) Me.PanelControl2.Margin = New System.Windows.Forms.Padding(0) Me.PanelControl2.Name = "PanelControl2" - Me.PanelControl2.Size = New System.Drawing.Size(890, 486) + Me.PanelControl2.Size = New System.Drawing.Size(890, 512) Me.PanelControl2.TabIndex = 3 ' 'LayoutControl1 @@ -231,18 +240,19 @@ 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.Controls.Add(Me.TokenEditEx1) Me.LayoutControl1.Controls.Add(Me.TextEdit1) - Me.LayoutControl1.Controls.Add(Me.GridControl1) - Me.LayoutControl1.Controls.Add(Me.RadioGroup1) + Me.LayoutControl1.Controls.Add(Me.GridPredefinedSearches) + Me.LayoutControl1.Controls.Add(Me.RadioGroupDateConstraints) Me.LayoutControl1.Controls.Add(Me.DateEditFrom) Me.LayoutControl1.Controls.Add(Me.DateEditTo) Me.LayoutControl1.Controls.Add(Me.CheckEdit1) + Me.LayoutControl1.Controls.Add(Me.ComboBoxDateAttributes) Me.LayoutControl1.Dock = System.Windows.Forms.DockStyle.Fill Me.LayoutControl1.Location = New System.Drawing.Point(2, 2) Me.LayoutControl1.Name = "LayoutControl1" Me.LayoutControl1.OptionsView.GroupStyle = DevExpress.Utils.GroupStyle.Title Me.LayoutControl1.OptionsView.ItemBorderColor = System.Drawing.Color.Transparent Me.LayoutControl1.Root = Me.Root - Me.LayoutControl1.Size = New System.Drawing.Size(886, 482) + Me.LayoutControl1.Size = New System.Drawing.Size(886, 508) Me.LayoutControl1.TabIndex = 0 Me.LayoutControl1.Text = "LayoutControl1" ' @@ -277,20 +287,20 @@ Partial Class frmFlowSearch2 Me.TextEdit1.StyleController = Me.LayoutControl1 Me.TextEdit1.TabIndex = 2 ' - 'GridControl1 + 'GridPredefinedSearches ' - Me.GridControl1.Location = New System.Drawing.Point(14, 110) - Me.GridControl1.MainView = Me.TileView1 - Me.GridControl1.MenuManager = Me.RibbonControl1 - Me.GridControl1.Name = "GridControl1" - Me.GridControl1.Size = New System.Drawing.Size(858, 160) - Me.GridControl1.TabIndex = 1 - Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.TileView1, Me.GridView1}) + Me.GridPredefinedSearches.Location = New System.Drawing.Point(14, 92) + Me.GridPredefinedSearches.MainView = Me.TileView1 + Me.GridPredefinedSearches.MenuManager = Me.RibbonControl1 + Me.GridPredefinedSearches.Name = "GridPredefinedSearches" + Me.GridPredefinedSearches.Size = New System.Drawing.Size(858, 178) + Me.GridPredefinedSearches.TabIndex = 1 + Me.GridPredefinedSearches.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.TileView1, Me.GridView1}) ' 'TileView1 ' Me.TileView1.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colName, Me.colDescription, Me.colCount, Me.colImage}) - Me.TileView1.GridControl = Me.GridControl1 + Me.TileView1.GridControl = Me.GridPredefinedSearches Me.TileView1.Name = "TileView1" Me.TileView1.OptionsTiles.AllowItemHover = True Me.TileView1.OptionsTiles.ItemSize = New System.Drawing.Size(190, 80) @@ -341,44 +351,44 @@ Partial Class frmFlowSearch2 ' 'GridView1 ' - Me.GridView1.GridControl = Me.GridControl1 + Me.GridView1.GridControl = Me.GridPredefinedSearches Me.GridView1.Name = "GridView1" ' - 'RadioGroup1 + 'RadioGroupDateConstraints ' - Me.RadioGroup1.Location = New System.Drawing.Point(4, 372) - Me.RadioGroup1.MenuManager = Me.RibbonControl1 - Me.RadioGroup1.Name = "RadioGroup1" - Me.RadioGroup1.Properties.Appearance.BackColor = System.Drawing.SystemColors.Control - Me.RadioGroup1.Properties.Appearance.Options.UseBackColor = True - Me.RadioGroup1.Properties.Columns = 2 - Me.RadioGroup1.Properties.ItemHorzAlignment = DevExpress.XtraEditors.RadioItemHorzAlignment.Near - Me.RadioGroup1.Properties.ItemsLayout = DevExpress.XtraEditors.RadioGroupItemsLayout.Flow - Me.RadioGroup1.Size = New System.Drawing.Size(615, 106) - Me.RadioGroup1.StyleController = Me.LayoutControl1 - Me.RadioGroup1.TabIndex = 4 + Me.RadioGroupDateConstraints.Location = New System.Drawing.Point(4, 372) + 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, 132) + Me.RadioGroupDateConstraints.StyleController = Me.LayoutControl1 + Me.RadioGroupDateConstraints.TabIndex = 4 ' 'DateEditFrom ' Me.DateEditFrom.EditValue = Nothing - Me.DateEditFrom.Location = New System.Drawing.Point(700, 375) + Me.DateEditFrom.Location = New System.Drawing.Point(724, 375) 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)}) 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(179, 20) + Me.DateEditFrom.Size = New System.Drawing.Size(155, 20) Me.DateEditFrom.StyleController = Me.LayoutControl1 Me.DateEditFrom.TabIndex = 5 ' 'DateEditTo ' Me.DateEditTo.EditValue = Nothing - Me.DateEditTo.Location = New System.Drawing.Point(700, 428) + Me.DateEditTo.Location = New System.Drawing.Point(724, 428) 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)}) 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(179, 20) + Me.DateEditTo.Size = New System.Drawing.Size(155, 20) Me.DateEditTo.StyleController = Me.LayoutControl1 Me.DateEditTo.TabIndex = 7 ' @@ -393,6 +403,16 @@ Partial Class frmFlowSearch2 Me.CheckEdit1.StyleController = Me.LayoutControl1 Me.CheckEdit1.TabIndex = 8 ' + 'ComboBoxDateAttributes + ' + Me.ComboBoxDateAttributes.Location = New System.Drawing.Point(724, 458) + 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)}) + Me.ComboBoxDateAttributes.Size = New System.Drawing.Size(155, 20) + Me.ComboBoxDateAttributes.StyleController = Me.LayoutControl1 + Me.ComboBoxDateAttributes.TabIndex = 9 + ' 'Root ' Me.Root.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True] @@ -400,7 +420,7 @@ Partial Class frmFlowSearch2 Me.Root.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlGroupDate1, Me.LayoutControlGroupDate2, Me.LayoutControlGroup3, Me.LayoutControlItem5, Me.LayoutControlItem7}) Me.Root.Name = "Root" Me.Root.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0) - Me.Root.Size = New System.Drawing.Size(886, 482) + Me.Root.Size = New System.Drawing.Size(886, 508) Me.Root.TextVisible = False ' 'LayoutControlGroupDate1 @@ -416,17 +436,17 @@ Partial Class frmFlowSearch2 Me.LayoutControlGroupDate1.Location = New System.Drawing.Point(0, 328) Me.LayoutControlGroupDate1.Name = "LayoutControlGroupDate1" Me.LayoutControlGroupDate1.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0) - Me.LayoutControlGroupDate1.Size = New System.Drawing.Size(623, 154) + Me.LayoutControlGroupDate1.Size = New System.Drawing.Size(623, 180) Me.LayoutControlGroupDate1.Spacing = New DevExpress.XtraLayout.Utils.Padding(2, 2, 20, 2) Me.LayoutControlGroupDate1.Text = "Datums Einschränkung" Me.LayoutControlGroupDate1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never ' 'LayoutControlItem1 ' - Me.LayoutControlItem1.Control = Me.RadioGroup1 + 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, 110) + Me.LayoutControlItem1.Size = New System.Drawing.Size(619, 136) Me.LayoutControlItem1.TextSize = New System.Drawing.Size(0, 0) Me.LayoutControlItem1.TextVisible = False ' @@ -437,11 +457,11 @@ Partial Class frmFlowSearch2 Me.LayoutControlGroupDate2.AppearanceGroup.Options.UseBackColor = True 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.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, 328) Me.LayoutControlGroupDate2.Name = "LayoutControlGroupDate2" Me.LayoutControlGroupDate2.Padding = New DevExpress.XtraLayout.Utils.Padding(0, 0, 0, 0) - Me.LayoutControlGroupDate2.Size = New System.Drawing.Size(263, 154) + Me.LayoutControlGroupDate2.Size = New System.Drawing.Size(263, 180) Me.LayoutControlGroupDate2.Spacing = New DevExpress.XtraLayout.Utils.Padding(2, 2, 20, 2) Me.LayoutControlGroupDate2.Text = "Eigenes Datum" Me.LayoutControlGroupDate2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never @@ -454,7 +474,7 @@ Partial Class frmFlowSearch2 Me.LayoutControlItem2.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) Me.LayoutControlItem2.Size = New System.Drawing.Size(259, 30) Me.LayoutControlItem2.Text = "Datum Von" - Me.LayoutControlItem2.TextSize = New System.Drawing.Size(58, 13) + Me.LayoutControlItem2.TextSize = New System.Drawing.Size(82, 13) ' 'LayoutControlItem4 ' @@ -465,14 +485,14 @@ Partial Class frmFlowSearch2 Me.LayoutControlItem4.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) Me.LayoutControlItem4.Size = New System.Drawing.Size(259, 30) Me.LayoutControlItem4.Text = "Datum Bis" - Me.LayoutControlItem4.TextSize = New System.Drawing.Size(58, 13) + Me.LayoutControlItem4.TextSize = New System.Drawing.Size(82, 13) ' 'EmptySpaceItem1 ' Me.EmptySpaceItem1.AllowHotTrack = False - Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 83) + Me.EmptySpaceItem1.Location = New System.Drawing.Point(0, 113) Me.EmptySpaceItem1.Name = "EmptySpaceItem1" - Me.EmptySpaceItem1.Size = New System.Drawing.Size(259, 27) + Me.EmptySpaceItem1.Size = New System.Drawing.Size(259, 23) Me.EmptySpaceItem1.TextSize = New System.Drawing.Size(0, 0) ' 'LayoutControlItem6 @@ -484,6 +504,16 @@ Partial Class frmFlowSearch2 Me.LayoutControlItem6.TextSize = New System.Drawing.Size(0, 0) Me.LayoutControlItem6.TextVisible = False ' + 'LayoutControlItem8 + ' + Me.LayoutControlItem8.Control = Me.ComboBoxDateAttributes + Me.LayoutControlItem8.Location = New System.Drawing.Point(0, 83) + Me.LayoutControlItem8.Name = "LayoutControlItem8" + Me.LayoutControlItem8.Padding = New DevExpress.XtraLayout.Utils.Padding(5, 5, 5, 5) + Me.LayoutControlItem8.Size = New System.Drawing.Size(259, 30) + Me.LayoutControlItem8.Text = "Datums Attribut" + Me.LayoutControlItem8.TextSize = New System.Drawing.Size(82, 13) + ' 'LayoutControlGroup3 ' Me.LayoutControlGroup3.AppearanceGroup.BorderColor = System.Drawing.Color.FromArgb(CType(CType(165, Byte), Integer), CType(CType(36, Byte), Integer), CType(CType(19, Byte), Integer)) @@ -492,15 +522,14 @@ Partial Class frmFlowSearch2 Me.LayoutControlGroup3.Location = New System.Drawing.Point(0, 56) Me.LayoutControlGroup3.Name = "LayoutControlGroup3" Me.LayoutControlGroup3.Size = New System.Drawing.Size(886, 228) - Me.LayoutControlGroup3.Spacing = New DevExpress.XtraLayout.Utils.Padding(2, 2, 20, 2) Me.LayoutControlGroup3.Text = "Meine Suchen" ' 'LayoutControlItem3 ' - Me.LayoutControlItem3.Control = Me.GridControl1 + 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, 164) + Me.LayoutControlItem3.Size = New System.Drawing.Size(862, 182) Me.LayoutControlItem3.TextSize = New System.Drawing.Size(0, 0) Me.LayoutControlItem3.TextVisible = False ' @@ -532,6 +561,18 @@ Partial Class frmFlowSearch2 Me.SvgImageCollection1.Add("month", "image://svgimages/scheduling/monthview.svg") Me.SvgImageCollection1.Add("week", "image://svgimages/scheduling/next7days.svg") ' + 'chkIgnoreAttributes + ' + Me.chkIgnoreAttributes.ItemLinks.Add(Me.BarToggleSwitchItem1) + Me.chkIgnoreAttributes.Name = "chkIgnoreAttributes" + Me.chkIgnoreAttributes.Text = "RibbonPageGroup3" + ' + 'BarToggleSwitchItem1 + ' + Me.BarToggleSwitchItem1.Caption = "Prozessübergreifend suchen" + Me.BarToggleSwitchItem1.Id = 5 + Me.BarToggleSwitchItem1.Name = "BarToggleSwitchItem1" + ' 'frmFlowSearch2 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) @@ -555,15 +596,16 @@ Partial Class frmFlowSearch2 Me.LayoutControl1.ResumeLayout(False) CType(Me.TokenEditEx1.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TextEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.GridPredefinedSearches, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.TileView1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit() - CType(Me.RadioGroup1.Properties, 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, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.DateEditTo.Properties.CalendarTimeProperties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.DateEditTo.Properties, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.CheckEdit1.Properties, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.ComboBoxDateAttributes.Properties, 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() @@ -572,6 +614,7 @@ Partial Class frmFlowSearch2 CType(Me.LayoutControlItem4, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.EmptySpaceItem1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem6, System.ComponentModel.ISupportInitialize).EndInit() + CType(Me.LayoutControlItem8, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlGroup3, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem3, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.LayoutControlItem5, System.ComponentModel.ISupportInitialize).EndInit() @@ -590,10 +633,10 @@ Partial Class frmFlowSearch2 Friend WithEvents PanelControl2 As DevExpress.XtraEditors.PanelControl Friend WithEvents LayoutControl1 As DevExpress.XtraLayout.LayoutControl Friend WithEvents Root As DevExpress.XtraLayout.LayoutControlGroup - Friend WithEvents RadioGroup1 As DevExpress.XtraEditors.RadioGroup + Friend WithEvents RadioGroupDateConstraints As DevExpress.XtraEditors.RadioGroup Friend WithEvents LayoutControlItem1 As DevExpress.XtraLayout.LayoutControlItem Friend WithEvents TextEdit1 As DevExpress.XtraEditors.ButtonEdit - Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl + Friend WithEvents GridPredefinedSearches As DevExpress.XtraGrid.GridControl Friend WithEvents TileView1 As DevExpress.XtraGrid.Views.Tile.TileView Friend WithEvents colName As DevExpress.XtraGrid.Columns.TileViewColumn Friend WithEvents colDescription As DevExpress.XtraGrid.Columns.TileViewColumn @@ -621,4 +664,8 @@ Partial Class frmFlowSearch2 Friend WithEvents colImage As DevExpress.XtraGrid.Columns.TileViewColumn Friend WithEvents TokenEditEx1 As TokenEditEx Friend WithEvents LayoutControlItem7 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents ComboBoxDateAttributes As DevExpress.XtraEditors.ComboBoxEdit + Friend WithEvents LayoutControlItem8 As DevExpress.XtraLayout.LayoutControlItem + Friend WithEvents BarToggleSwitchItem1 As DevExpress.XtraBars.BarToggleSwitchItem + Friend WithEvents chkIgnoreAttributes As DevExpress.XtraBars.Ribbon.RibbonPageGroup End Class diff --git a/GUIs.ZooFlow/Search/frmFlowSearch2.vb b/GUIs.ZooFlow/Search/frmFlowSearch2.vb index 571de6d5..97cffeb3 100644 --- a/GUIs.ZooFlow/Search/frmFlowSearch2.vb +++ b/GUIs.ZooFlow/Search/frmFlowSearch2.vb @@ -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 \ No newline at end of file diff --git a/GUIs.ZooFlow/ZooFlow.vbproj b/GUIs.ZooFlow/ZooFlow.vbproj index 1b54dba1..4f40c730 100644 --- a/GUIs.ZooFlow/ZooFlow.vbproj +++ b/GUIs.ZooFlow/ZooFlow.vbproj @@ -812,6 +812,7 @@ +