diff --git a/GUIs.Common/Base/BaseResult.vb b/GUIs.Common/Base/BaseResult.vb new file mode 100644 index 00000000..02469439 --- /dev/null +++ b/GUIs.Common/Base/BaseResult.vb @@ -0,0 +1,4 @@ +Public Class BaseResult + Property Title As String + Property Datatable As DataTable +End Class diff --git a/GUIs.Common/Common.vbproj b/GUIs.Common/Common.vbproj index a92abdc9..0d9f0d9b 100644 --- a/GUIs.Common/Common.vbproj +++ b/GUIs.Common/Common.vbproj @@ -54,9 +54,6 @@ - - ..\Controls.DocumentViewer\bin\Debug\DigitalData.Controls.DocumentViewer.dll - D:\ProgramFiles\GdPicture.NET 14\Redist\GdPicture.NET (.NET Framework 4.5)\GdPicture.NET.14.dll @@ -92,6 +89,7 @@ + Form @@ -167,6 +165,10 @@ + + {0958cddf-4a16-41f6-8837-8335f71d599c} + DocumentViewer + {3DCD6D1A-C830-4241-B7E4-27430E7EA483} LookupControl diff --git a/GUIs.Common/DataResultList/DataResultParams.vb b/GUIs.Common/DataResultList/DataResultParams.vb index e80a9762..737519fb 100644 --- a/GUIs.Common/DataResultList/DataResultParams.vb +++ b/GUIs.Common/DataResultList/DataResultParams.vb @@ -7,6 +7,5 @@ End Class Public Class DataResult - Public Title As String - Public Datatable As DataTable + Inherits BaseResult End Class diff --git a/GUIs.Common/DataResultList/frmDataResultList.vb b/GUIs.Common/DataResultList/frmDataResultList.vb index 7ccbf02c..cb158cbe 100644 --- a/GUIs.Common/DataResultList/frmDataResultList.vb +++ b/GUIs.Common/DataResultList/frmDataResultList.vb @@ -283,4 +283,8 @@ Public Class frmDataResultList _Logger.Error(ex) End Try End Sub + + Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults + 'TODO: Implement + End Function End Class \ No newline at end of file diff --git a/GUIs.Common/DocumentResultList/DocumentResultParams.vb b/GUIs.Common/DocumentResultList/DocumentResultParams.vb index 9a3d04a2..ea57ccb0 100644 --- a/GUIs.Common/DocumentResultList/DocumentResultParams.vb +++ b/GUIs.Common/DocumentResultList/DocumentResultParams.vb @@ -8,6 +8,5 @@ End Class Public Class DocumentResult - Public Title As String - Public Datatable As DataTable + Inherits BaseResult End Class diff --git a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb index 62b155b6..dda7bc31 100644 --- a/GUIs.Common/DocumentResultList/frmDocumentResultList.vb +++ b/GUIs.Common/DocumentResultList/frmDocumentResultList.vb @@ -90,65 +90,8 @@ Public Class frmDocumentResultList AddHandler GridView2.FocusedRowChanged, AddressOf GridView_FocusedRowChanged AddHandler GridView3.FocusedRowChanged, AddressOf GridView_FocusedRowChanged - Dim oTotalResults = 0 - - For Each oList In _ResultLists - oTotalResults += oList.Datatable.Rows.Count - Next - - labelResultCount.Caption = String.Format(labelResultCount.Caption, oTotalResults) - - ' Load Grids - For index = 0 To _ResultLists.Count - 1 - Select Case index - Case 0 - Dim oResult As DocumentResult = _ResultLists.Item(0) - CreateDocumentGrid(GridView1, oResult.Datatable) - UpdateGridHeader(index, oResult.Datatable.Rows.Count) - Case 1 - Dim oResult As DocumentResult = _ResultLists.Item(1) - CreateDocumentGrid(GridView2, oResult.Datatable) - UpdateGridHeader(index, oResult.Datatable.Rows.Count) - - Case 2 - Dim oResult As DocumentResult = _ResultLists.Item(2) - CreateDocumentGrid(GridView3, oResult.Datatable) - UpdateGridHeader(index, oResult.Datatable.Rows.Count) - - Case Else - MessageBox.Show(Constants.MESSAGE_TOO_MANY_SEARCHES, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) - Exit For - End Select - Next - - ' Hide Grids depending on Result count - Select Case _ResultLists.Count - Case 0 - - SplitContainerControl1.SetPanelCollapsed(True) - SplitContainerControl2.SetPanelCollapsed(True) - - SwitchMainContainerHorizontal.Enabled = False - SwitchDetailContainerHorizontal.Enabled = False - - MessageBox.Show(Constants.MESSAGE_ERROR_IN_SEARCHES, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) - Case 1 - SplitContainerControl1.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1 - SplitContainerControl2.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1 - - SplitContainerControl1.SetPanelCollapsed(True) - SplitContainerControl2.SetPanelCollapsed(True) - - SwitchMainContainerHorizontal.Enabled = False - SwitchDetailContainerHorizontal.Enabled = False - Case 2 - SplitContainerControl1.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Both - SplitContainerControl2.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1 - - SplitContainerControl2.SetPanelCollapsed(True) - - SwitchDetailContainerHorizontal.Enabled = False - End Select + UpdateTotalResults(_ResultLists) + UpdateGridData(_ResultLists) Catch ex As Exception _Logger.Error(ex) MessageBox.Show("Error while loading results:" & vbNewLine & vbNewLine & ex.Message, Text) @@ -157,19 +100,99 @@ Public Class frmDocumentResultList End Try End Sub - Private Sub UpdateGridHeader(Index As Integer, Count As Integer) - Select Case Index + Public Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean Implements IResultForm.RefreshResults + _IsLoading = True + Try + UpdateTotalResults(_ResultLists) + UpdateGridData(_ResultLists) + + Return True + Catch ex As Exception + _Logger.Error(ex) + MessageBox.Show("Error while loading results:" & vbNewLine & vbNewLine & ex.Message, Text) + Return False + Finally + _IsLoading = False + End Try + End Function + + Private Sub UpdateGridData(pResultList As List(Of DocumentResult)) + ' Load Grids + For index = 0 To _ResultLists.Count - 1 + Select Case index + Case 0 + Dim oResult As DocumentResult = _ResultLists.Item(0) + CreateDocumentGrid(GridView1, oResult.Datatable) + UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count) + Case 1 + Dim oResult As DocumentResult = _ResultLists.Item(1) + CreateDocumentGrid(GridView2, oResult.Datatable) + UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count) + + Case 2 + Dim oResult As DocumentResult = _ResultLists.Item(2) + CreateDocumentGrid(GridView3, oResult.Datatable) + UpdateGridHeader(_ResultLists, index, oResult.Datatable.Rows.Count) + + Case Else + MessageBox.Show(Constants.MESSAGE_TOO_MANY_SEARCHES, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) + Exit For + End Select + Next + + ' Hide Grids depending on Result count + Select Case _ResultLists.Count Case 0 - Dim oResult = _ResultLists.Item(0) - GridBand1.Caption = $"{oResult.Title} ({Count})" + + SplitContainerControl1.SetPanelCollapsed(True) + SplitContainerControl2.SetPanelCollapsed(True) + + SwitchMainContainerHorizontal.Enabled = False + SwitchDetailContainerHorizontal.Enabled = False + + MessageBox.Show(Constants.MESSAGE_ERROR_IN_SEARCHES, Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation) + Case 1 + SplitContainerControl1.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1 + SplitContainerControl2.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1 + + SplitContainerControl1.SetPanelCollapsed(True) + SplitContainerControl2.SetPanelCollapsed(True) + + SwitchMainContainerHorizontal.Enabled = False + SwitchDetailContainerHorizontal.Enabled = False + Case 2 + SplitContainerControl1.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Both + SplitContainerControl2.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1 + + SplitContainerControl2.SetPanelCollapsed(True) + + SwitchDetailContainerHorizontal.Enabled = False + End Select + End Sub + + Private Sub UpdateTotalResults(pResultList As List(Of DocumentResult)) + Dim oTotalResults = 0 + + For Each oList In pResultList + oTotalResults += oList.Datatable.Rows.Count + Next + + labelResultCount.Caption = String.Format(labelResultCount.Caption, oTotalResults) + End Sub + + Private Sub UpdateGridHeader(pResultList As List(Of DocumentResult), pIndex As Integer, pCount As Integer) + Select Case pIndex + Case 0 + Dim oResult = pResultList.Item(0) + GridBand1.Caption = $"{oResult.Title} ({pCount})" Case 1 - Dim oResult = _ResultLists.Item(1) - GridBand2.Caption = $"{oResult.Title} ({Count})" + Dim oResult = pResultList.Item(1) + GridBand2.Caption = $"{oResult.Title} ({pCount})" Case 2 - Dim oResult = _ResultLists.Item(2) - GridBand3.Caption = $"{oResult.Title} ({Count})" + Dim oResult = pResultList.Item(2) + GridBand3.Caption = $"{oResult.Title} ({pCount})" End Select End Sub @@ -533,17 +556,17 @@ Public Class frmDocumentResultList Private Sub GridView1_ColumnFilterChanged(sender As GridView, e As EventArgs) Handles GridView1.ColumnFilterChanged Dim oRowCount = sender.RowCount - UpdateGridHeader(0, oRowCount) + UpdateGridHeader(_ResultLists, 0, oRowCount) End Sub Private Sub GridView2_ColumnFilterChanged(sender As GridView, e As EventArgs) Handles GridView2.ColumnFilterChanged Dim oRowCount = sender.RowCount - UpdateGridHeader(1, oRowCount) + UpdateGridHeader(_ResultLists, 1, oRowCount) End Sub Private Sub GridView3_ColumnFilterChanged(sender As GridView, e As EventArgs) Handles GridView3.ColumnFilterChanged Dim oRowCount = sender.RowCount - UpdateGridHeader(2, oRowCount) + UpdateGridHeader(_ResultLists, 2, oRowCount) End Sub Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick @@ -584,4 +607,6 @@ Public Class frmDocumentResultList Next End If End Sub + + End Class \ No newline at end of file diff --git a/GUIs.Common/IResultForm.vb b/GUIs.Common/IResultForm.vb index 16a73b45..5ca3172b 100644 --- a/GUIs.Common/IResultForm.vb +++ b/GUIs.Common/IResultForm.vb @@ -1,3 +1,4 @@ Public Interface IResultForm Property ShouldReturnToPreviousForm As Boolean + Function RefreshResults(pResults As IEnumerable(Of BaseResult)) As Boolean End Interface diff --git a/GUIs.ZooFlow/frmSearchStart.Designer.vb b/GUIs.ZooFlow/frmSearchStart.Designer.vb index d5a5c3dd..0fe64577 100644 --- a/GUIs.ZooFlow/frmSearchStart.Designer.vb +++ b/GUIs.ZooFlow/frmSearchStart.Designer.vb @@ -26,17 +26,17 @@ Partial Class frmSearchStart Dim SplashScreenManager As DevExpress.XtraSplashScreen.SplashScreenManager = New DevExpress.XtraSplashScreen.SplashScreenManager(Me, Nothing, true, true) Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmSearchStart)) Me.RibbonControl1 = New DevExpress.XtraBars.Ribbon.RibbonControl() - Me.BarButtonItemNewSearch = New DevExpress.XtraBars.BarButtonItem() - Me.BarButtonItem2 = New DevExpress.XtraBars.BarButtonItem() + Me.BarButtonNewSearch = New DevExpress.XtraBars.BarButtonItem() + Me.BarButtonSaveSearch = New DevExpress.XtraBars.BarButtonItem() Me.BarHeaderItem1 = New DevExpress.XtraBars.BarHeaderItem() Me.BarEditItem1 = New DevExpress.XtraBars.BarEditItem() Me.RepositoryItemRadioGroup1 = New DevExpress.XtraEditors.Repository.RepositoryItemRadioGroup() - Me.BarButtonItem1 = New DevExpress.XtraBars.BarButtonItem() + Me.BarButtonClearSearch = New DevExpress.XtraBars.BarButtonItem() Me.BarButtonItem3 = New DevExpress.XtraBars.BarButtonItem() Me.BarEditItem2 = New DevExpress.XtraBars.BarEditItem() Me.RepositoryItemComboBox1 = New DevExpress.XtraEditors.Repository.RepositoryItemComboBox() Me.BarStaticItemInfo = New DevExpress.XtraBars.BarStaticItem() - Me.BarButtonItem4 = New DevExpress.XtraBars.BarButtonItem() + Me.BarButtonStartSearch = New DevExpress.XtraBars.BarButtonItem() Me.BarStaticItem1 = New DevExpress.XtraBars.BarStaticItem() Me.txtFilterFrom = New DevExpress.XtraBars.BarEditItem() Me.RepositoryItemDateEdit1 = New DevExpress.XtraEditors.Repository.RepositoryItemDateEdit() @@ -44,8 +44,10 @@ Partial Class frmSearchStart Me.RepositoryItemDateEdit2 = New DevExpress.XtraEditors.Repository.RepositoryItemDateEdit() Me.cmbFilterTimeframe = New DevExpress.XtraBars.BarEditItem() Me.RepositoryItemComboBox2 = New DevExpress.XtraEditors.Repository.RepositoryItemComboBox() + Me.BarCheckboxOpenSearchInSameWindow = New DevExpress.XtraBars.BarCheckItem() Me.RibbonPage1 = New DevExpress.XtraBars.Ribbon.RibbonPage() Me.RibbonPageGroup1 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() + Me.RibbonPageGroup2 = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroupProfiles = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RibbonPageGroupFilter = New DevExpress.XtraBars.Ribbon.RibbonPageGroup() Me.RepositoryItemTextEdit1 = New DevExpress.XtraEditors.Repository.RepositoryItemTextEdit() @@ -97,29 +99,29 @@ Partial Class frmSearchStart ' Me.RibbonControl1.AutoSizeItems = True Me.RibbonControl1.ExpandCollapseItem.Id = 0 - Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.BarButtonItemNewSearch, Me.BarButtonItem2, Me.BarHeaderItem1, Me.BarEditItem1, Me.BarButtonItem1, Me.BarButtonItem3, Me.BarEditItem2, Me.BarStaticItemInfo, Me.BarButtonItem4, Me.BarStaticItem1, Me.txtFilterFrom, Me.txtFilterTo, Me.cmbFilterTimeframe}) + Me.RibbonControl1.Items.AddRange(New DevExpress.XtraBars.BarItem() {Me.RibbonControl1.ExpandCollapseItem, Me.RibbonControl1.SearchEditItem, Me.BarButtonNewSearch, Me.BarButtonSaveSearch, Me.BarHeaderItem1, Me.BarEditItem1, Me.BarButtonClearSearch, Me.BarButtonItem3, Me.BarEditItem2, Me.BarStaticItemInfo, Me.BarButtonStartSearch, Me.BarStaticItem1, Me.txtFilterFrom, Me.txtFilterTo, Me.cmbFilterTimeframe, Me.BarCheckboxOpenSearchInSameWindow}) Me.RibbonControl1.Location = New System.Drawing.Point(0, 0) - Me.RibbonControl1.MaxItemId = 20 + Me.RibbonControl1.MaxItemId = 22 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.RepositoryItemRadioGroup1, Me.RepositoryItemComboBox1, Me.RepositoryItemTextEdit1, Me.RepositoryItemDateEdit1, Me.RepositoryItemDateEdit2, Me.RepositoryItemComboBox2, Me.RepositoryItemTimeSpanEdit1}) Me.RibbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.[False] - Me.RibbonControl1.Size = New System.Drawing.Size(1070, 159) + Me.RibbonControl1.Size = New System.Drawing.Size(1070, 158) Me.RibbonControl1.StatusBar = Me.RibbonStatusBar1 ' - 'BarButtonItemNewSearch + 'BarButtonNewSearch ' - Me.BarButtonItemNewSearch.Caption = "Neue Suche" - Me.BarButtonItemNewSearch.Id = 1 - Me.BarButtonItemNewSearch.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItemNewSearch.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) - Me.BarButtonItemNewSearch.Name = "BarButtonItemNewSearch" + Me.BarButtonNewSearch.Caption = "Neue Suche" + Me.BarButtonNewSearch.Id = 1 + Me.BarButtonNewSearch.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonNewSearch.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarButtonNewSearch.Name = "BarButtonNewSearch" ' - 'BarButtonItem2 + 'BarButtonSaveSearch ' - Me.BarButtonItem2.Caption = "Suchprofil speichern" - Me.BarButtonItem2.Id = 2 - Me.BarButtonItem2.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem2.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) - Me.BarButtonItem2.Name = "BarButtonItem2" + Me.BarButtonSaveSearch.Caption = "Suchprofil speichern" + Me.BarButtonSaveSearch.Id = 2 + Me.BarButtonSaveSearch.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonSaveSearch.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarButtonSaveSearch.Name = "BarButtonSaveSearch" ' 'BarHeaderItem1 ' @@ -138,12 +140,12 @@ Partial Class frmSearchStart ' Me.RepositoryItemRadioGroup1.Name = "RepositoryItemRadioGroup1" ' - 'BarButtonItem1 + 'BarButtonClearSearch ' - Me.BarButtonItem1.Caption = "Suche leeren" - Me.BarButtonItem1.Id = 5 - Me.BarButtonItem1.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) - Me.BarButtonItem1.Name = "BarButtonItem1" + Me.BarButtonClearSearch.Caption = "Suche leeren" + Me.BarButtonClearSearch.Id = 5 + Me.BarButtonClearSearch.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonClearSearch.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarButtonClearSearch.Name = "BarButtonClearSearch" ' 'BarButtonItem3 ' @@ -169,12 +171,12 @@ Partial Class frmSearchStart Me.BarStaticItemInfo.Id = 8 Me.BarStaticItemInfo.Name = "BarStaticItemInfo" ' - 'BarButtonItem4 + 'BarButtonStartSearch ' - Me.BarButtonItem4.Caption = "Suche starten (F2)" - Me.BarButtonItem4.Id = 9 - Me.BarButtonItem4.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonItem4.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) - Me.BarButtonItem4.Name = "BarButtonItem4" + Me.BarButtonStartSearch.Caption = "Suche starten (F2)" + Me.BarButtonStartSearch.Id = 9 + Me.BarButtonStartSearch.ImageOptions.SvgImage = CType(resources.GetObject("BarButtonStartSearch.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarButtonStartSearch.Name = "BarButtonStartSearch" ' 'BarStaticItem1 ' @@ -230,21 +232,34 @@ Partial Class frmSearchStart Me.RepositoryItemComboBox2.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)}) Me.RepositoryItemComboBox2.Name = "RepositoryItemComboBox2" ' + 'BarCheckboxOpenSearchInSameWindow + ' + Me.BarCheckboxOpenSearchInSameWindow.Caption = "Suche in gleichem Fenster öffnen" + Me.BarCheckboxOpenSearchInSameWindow.Id = 21 + Me.BarCheckboxOpenSearchInSameWindow.ImageOptions.SvgImage = CType(resources.GetObject("BarCheckItem1.ImageOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) + Me.BarCheckboxOpenSearchInSameWindow.Name = "BarCheckboxOpenSearchInSameWindow" + ' 'RibbonPage1 ' - Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroupProfiles, Me.RibbonPageGroupFilter}) + Me.RibbonPage1.Groups.AddRange(New DevExpress.XtraBars.Ribbon.RibbonPageGroup() {Me.RibbonPageGroup1, Me.RibbonPageGroup2, Me.RibbonPageGroupProfiles, Me.RibbonPageGroupFilter}) Me.RibbonPage1.Name = "RibbonPage1" Me.RibbonPage1.Text = "Start" ' 'RibbonPageGroup1 ' - Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonItem4) - Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonItem1) - Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonItemNewSearch) - Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonItem2) + Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonStartSearch) + Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonClearSearch) + Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonNewSearch) + Me.RibbonPageGroup1.ItemLinks.Add(Me.BarButtonSaveSearch) Me.RibbonPageGroup1.Name = "RibbonPageGroup1" Me.RibbonPageGroup1.Text = "Suchfunktionen" ' + 'RibbonPageGroup2 + ' + Me.RibbonPageGroup2.ItemLinks.Add(Me.BarCheckboxOpenSearchInSameWindow) + Me.RibbonPageGroup2.Name = "RibbonPageGroup2" + Me.RibbonPageGroup2.Text = "Sucheinstellungen" + ' 'RibbonPageGroupProfiles ' Me.RibbonPageGroupProfiles.ItemLinks.Add(Me.BarStaticItem1) @@ -274,10 +289,10 @@ Partial Class frmSearchStart 'RibbonStatusBar1 ' Me.RibbonStatusBar1.ItemLinks.Add(Me.BarStaticItemInfo) - Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 579) + Me.RibbonStatusBar1.Location = New System.Drawing.Point(0, 577) Me.RibbonStatusBar1.Name = "RibbonStatusBar1" Me.RibbonStatusBar1.Ribbon = Me.RibbonControl1 - Me.RibbonStatusBar1.Size = New System.Drawing.Size(1070, 22) + Me.RibbonStatusBar1.Size = New System.Drawing.Size(1070, 24) ' 'pnlProfileChoose ' @@ -286,7 +301,7 @@ Partial Class frmSearchStart Me.pnlProfileChoose.Controls.Add(Me.Label1) Me.pnlProfileChoose.Dock = System.Windows.Forms.DockStyle.Top Me.pnlProfileChoose.Font = New System.Drawing.Font("Tahoma", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.pnlProfileChoose.Location = New System.Drawing.Point(0, 159) + Me.pnlProfileChoose.Location = New System.Drawing.Point(0, 158) Me.pnlProfileChoose.Margin = New System.Windows.Forms.Padding(2, 3, 2, 3) Me.pnlProfileChoose.Name = "pnlProfileChoose" Me.pnlProfileChoose.Size = New System.Drawing.Size(1070, 57) @@ -322,68 +337,68 @@ Partial Class frmSearchStart Me.XtraTabControl1.MultiLine = DevExpress.Utils.DefaultBoolean.[False] Me.XtraTabControl1.Name = "XtraTabControl1" Me.XtraTabControl1.SelectedTabPage = Me.XtraTabPage1 - Me.XtraTabControl1.Size = New System.Drawing.Size(1070, 363) + Me.XtraTabControl1.Size = New System.Drawing.Size(1070, 362) Me.XtraTabControl1.TabIndex = 12 Me.XtraTabControl1.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.XtraTabPage1, Me.XtraTabPage2, Me.XtraTabPage3, Me.XtraTabPage4, Me.XtraTabPage5, Me.XtraTabPage6, Me.XtraTabPage7, Me.XtraTabPage8, Me.XtraTabPage9, Me.XtraTabPage10}) ' 'XtraTabPage1 ' Me.XtraTabPage1.Name = "XtraTabPage1" - Me.XtraTabPage1.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage1.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage1.Text = "Search#1" ' 'XtraTabPage2 ' Me.XtraTabPage2.Name = "XtraTabPage2" - Me.XtraTabPage2.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage2.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage2.Text = "Search#2" ' 'XtraTabPage3 ' Me.XtraTabPage3.Name = "XtraTabPage3" - Me.XtraTabPage3.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage3.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage3.Text = "Search#3" ' 'XtraTabPage4 ' Me.XtraTabPage4.Name = "XtraTabPage4" - Me.XtraTabPage4.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage4.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage4.Text = "Search#4" ' 'XtraTabPage5 ' Me.XtraTabPage5.Name = "XtraTabPage5" - Me.XtraTabPage5.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage5.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage5.Text = "Search#5" ' 'XtraTabPage6 ' Me.XtraTabPage6.Name = "XtraTabPage6" - Me.XtraTabPage6.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage6.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage6.Text = "Search#6" ' 'XtraTabPage7 ' Me.XtraTabPage7.Name = "XtraTabPage7" - Me.XtraTabPage7.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage7.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage7.Text = "Search#7" ' 'XtraTabPage8 ' Me.XtraTabPage8.Name = "XtraTabPage8" - Me.XtraTabPage8.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage8.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage8.Text = "Search#8" ' 'XtraTabPage9 ' Me.XtraTabPage9.Name = "XtraTabPage9" - Me.XtraTabPage9.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage9.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage9.Text = "Search#9" ' 'XtraTabPage10 ' Me.XtraTabPage10.Name = "XtraTabPage10" - Me.XtraTabPage10.Size = New System.Drawing.Size(1068, 340) + Me.XtraTabPage10.Size = New System.Drawing.Size(1068, 337) Me.XtraTabPage10.Text = "Search#10" ' 'ContextMenuStripSearchTerms @@ -422,13 +437,13 @@ Partial Class frmSearchStart Me.SplitContainerControlSearch.CollapsePanel = DevExpress.XtraEditors.SplitCollapsePanel.Panel2 Me.SplitContainerControlSearch.Dock = System.Windows.Forms.DockStyle.Fill Me.SplitContainerControlSearch.FixedPanel = DevExpress.XtraEditors.SplitFixedPanel.Panel2 - Me.SplitContainerControlSearch.Location = New System.Drawing.Point(0, 216) + Me.SplitContainerControlSearch.Location = New System.Drawing.Point(0, 215) Me.SplitContainerControlSearch.Name = "SplitContainerControlSearch" Me.SplitContainerControlSearch.Panel1.Controls.Add(Me.XtraTabControl1) Me.SplitContainerControlSearch.Panel1.Text = "Panel1" Me.SplitContainerControlSearch.Panel2.Text = "Panel2" Me.SplitContainerControlSearch.PanelVisibility = DevExpress.XtraEditors.SplitPanelVisibility.Panel1 - Me.SplitContainerControlSearch.Size = New System.Drawing.Size(1070, 363) + Me.SplitContainerControlSearch.Size = New System.Drawing.Size(1070, 362) Me.SplitContainerControlSearch.SplitterPosition = 310 Me.SplitContainerControlSearch.TabIndex = 16 ' @@ -443,7 +458,6 @@ Partial Class frmSearchStart Me.Controls.Add(Me.pnlProfileChoose) Me.Controls.Add(Me.RibbonStatusBar1) Me.Controls.Add(Me.RibbonControl1) - Me.Font = New System.Drawing.Font("Tahoma", 8.25!) Me.IconOptions.Icon = CType(resources.GetObject("frmSearchStart.IconOptions.Icon"), System.Drawing.Icon) Me.IconOptions.SvgImage = CType(resources.GetObject("frmSearchStart.IconOptions.SvgImage"), DevExpress.Utils.Svg.SvgImage) Me.KeyPreview = True @@ -480,8 +494,8 @@ End Sub Friend WithEvents pnlProfileChoose As Panel Friend WithEvents cmbProfile As ComboBox Friend WithEvents Label1 As Label - Friend WithEvents BarButtonItemNewSearch As DevExpress.XtraBars.BarButtonItem - Friend WithEvents BarButtonItem2 As DevExpress.XtraBars.BarButtonItem + Friend WithEvents BarButtonNewSearch As DevExpress.XtraBars.BarButtonItem + Friend WithEvents BarButtonSaveSearch As DevExpress.XtraBars.BarButtonItem Friend WithEvents XtraTabControl1 As DevExpress.XtraTab.XtraTabControl Friend WithEvents XtraTabPage1 As DevExpress.XtraTab.XtraTabPage Friend WithEvents XtraTabPage2 As DevExpress.XtraTab.XtraTabPage @@ -496,7 +510,7 @@ End Sub Friend WithEvents BarHeaderItem1 As DevExpress.XtraBars.BarHeaderItem Friend WithEvents BarEditItem1 As DevExpress.XtraBars.BarEditItem Friend WithEvents RepositoryItemRadioGroup1 As DevExpress.XtraEditors.Repository.RepositoryItemRadioGroup - Friend WithEvents BarButtonItem1 As DevExpress.XtraBars.BarButtonItem + Friend WithEvents BarButtonClearSearch As DevExpress.XtraBars.BarButtonItem Friend WithEvents BarButtonItem3 As DevExpress.XtraBars.BarButtonItem Friend WithEvents SplitContainerControlSearch As DevExpress.XtraEditors.SplitContainerControl Friend WithEvents BarEditItem2 As DevExpress.XtraBars.BarEditItem @@ -508,7 +522,7 @@ End Sub Friend WithEvents BracketLeftToolStripMenuItem As ToolStripMenuItem Friend WithEvents KlammerRechtsToolStripMenuItem As ToolStripMenuItem Friend WithEvents KlammerEntfernenToolStripMenuItem As ToolStripMenuItem - Friend WithEvents BarButtonItem4 As DevExpress.XtraBars.BarButtonItem + Friend WithEvents BarButtonStartSearch As DevExpress.XtraBars.BarButtonItem Friend WithEvents RibbonPageGroupFilter As DevExpress.XtraBars.Ribbon.RibbonPageGroup Friend WithEvents BarStaticItem1 As DevExpress.XtraBars.BarStaticItem Friend WithEvents RepositoryItemTextEdit1 As DevExpress.XtraEditors.Repository.RepositoryItemTextEdit @@ -519,4 +533,6 @@ End Sub Friend WithEvents cmbFilterTimeframe As DevExpress.XtraBars.BarEditItem Friend WithEvents RepositoryItemComboBox2 As DevExpress.XtraEditors.Repository.RepositoryItemComboBox Friend WithEvents RepositoryItemTimeSpanEdit1 As DevExpress.XtraEditors.Repository.RepositoryItemTimeSpanEdit + Friend WithEvents BarCheckboxOpenSearchInSameWindow As DevExpress.XtraBars.BarCheckItem + Friend WithEvents RibbonPageGroup2 As DevExpress.XtraBars.Ribbon.RibbonPageGroup End Class diff --git a/GUIs.ZooFlow/frmSearchStart.resx b/GUIs.ZooFlow/frmSearchStart.resx index 9b9adcf1..d506b55a 100644 --- a/GUIs.ZooFlow/frmSearchStart.resx +++ b/GUIs.ZooFlow/frmSearchStart.resx @@ -118,7 +118,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl @@ -136,7 +136,7 @@ Cjwvc3ZnPgs= - + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl @@ -152,7 +152,7 @@ IC8+DQo8L3N2Zz4L - + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl @@ -169,7 +169,7 @@ Ny41LDExLjh6IiBjbGFzcz0iUmVkIiAvPg0KPC9zdmc+Cw== - + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl @@ -207,13 +207,39 @@ NCwyOS41LDE5Ljd6IE04LDI2Yy0yLjIsMC00LTEuOC00LTRzMS44LTQsNC00ICBzNCwxLjgsNCw0UzEw LjIsMjYsOCwyNnogTTI0LDI2Yy0yLjIsMC00LTEuOC00LTRzMS44LTQsNC00czQsMS44LDQsNFMyNi4y LDI2LDI0LDI2eiIgY2xhc3M9IkJsYWNrIiAvPg0KPC9zdmc+Cw== + + + + + AAEAAAD/////AQAAAAAAAAAMAgAAAFlEZXZFeHByZXNzLkRhdGEudjE5LjIsIFZlcnNpb249MTkuMi4z + LjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49Yjg4ZDE3NTRkNzAwZTQ5YQUBAAAAHURl + dkV4cHJlc3MuVXRpbHMuU3ZnLlN2Z0ltYWdlAQAAAAREYXRhBwICAAAACQMAAAAPAwAAAEMEAAAC77u/ + PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz4NCjxzdmcgeD0iMHB4IiB5PSIwcHgi + IHZpZXdCb3g9IjAgMCAzMiAzMiIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcv + MjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3Bh + Y2U9InByZXNlcnZlIiBpZD0iTGF5ZXJfMSIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAg + MzIgMzIiPg0KICA8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLkJsYWNre2ZpbGw6IzcyNzI3Mjt9Cgku + WWVsbG93e2ZpbGw6I0ZGQjExNTt9CgkuQmx1ZXtmaWxsOiMxMTc3RDc7fQoJLkdyZWVue2ZpbGw6IzAz + OUMyMzt9CgkuUmVke2ZpbGw6I0QxMUMxQzt9CgkuV2hpdGV7ZmlsbDojRkZGRkZGO30KCS5zdDB7b3Bh + Y2l0eTowLjc1O30KCS5zdDF7b3BhY2l0eTowLjU7fQoJLnN0MntvcGFjaXR5OjAuMjU7fQo8L3N0eWxl + Pg0KICA8ZyBpZD0iV2luZG93cyI+DQogICAgPHBhdGggZD0iTTE4LDE4LjFWMTZoMnYwLjlDMTkuMywx + Ny4yLDE4LjYsMTcuNiwxOCwxOC4xeiBNMTQuNywyNkgyVjE2SDB2MTFjMCwwLjUsMC41LDEsMSwxaDE1 + LjEgICBDMTUuNSwyNy4zLDE1LjEsMjYuNiwxNC43LDI2eiBNMjQsMThjNS43LDAsOCw2LDgsNnMtMi4z + LDYtOCw2Yy01LjcsMC04LTYtOC02UzE4LjMsMTgsMjQsMTggTTI0LDIwYy0zLjMsMC01LjEsMi43LTUu + OCw0ICAgYzAuNywxLjMsMi41LDQsNS44LDRjMy4zLDAsNS4xLTIuNyw1LjgtNEMyOS4xLDIyLjcsMjcu + MywyMCwyNCwyMEwyNCwyMHogTTI0LDIyYy0xLjEsMC0yLDAuOS0yLDJzMC45LDIsMiwyYzEuMSwwLDIt + MC45LDItMiAgIFMyNS4xLDIyLDI0LDIyeiBNMjYsMTYuMlY4aDJ2OC45QzI3LjQsMTYuNiwyNi43LDE2 + LjQsMjYsMTYuMnogTTEwLDhIOHYyaDJWOHoiIGNsYXNzPSJCbGFjayIgLz4NCiAgICA8cGF0aCBkPSJN + MCwxNnYtNWMwLTAuNSwwLjUtMSwxLTFoMThjMC41LDAsMSwwLjUsMSwxdjVIMHogTTI4LDhWM2MwLTAu + NS0wLjUtMS0xLTFIOUM4LjUsMiw4LDIuNSw4LDN2NUgyOHoiIGNsYXNzPSJCbHVlIiAvPg0KICA8L2c+ + DQo8L3N2Zz4L 189, 17 - 174 + 73 diff --git a/GUIs.ZooFlow/frmSearchStart.vb b/GUIs.ZooFlow/frmSearchStart.vb index 5f40dfae..9042e456 100644 --- a/GUIs.ZooFlow/frmSearchStart.vb +++ b/GUIs.ZooFlow/frmSearchStart.vb @@ -7,33 +7,36 @@ Imports DevExpress.XtraGrid.Views.Grid Imports DevExpress.XtraEditors Imports DevExpress.XtraSplashScreen Imports DigitalData.GUIs.Common +Imports System.Threading.Tasks Public Class frmSearchStart Private Logger As Logger - Private DTSearchProfiles As DataTable - Private TabSelectedIndex As Integer - Private TabSelected As XtraTabPage - Private CURR_CTRL_OBJ As Object - Private PSEARCH_ID As Integer = 0 - Private SEARCH_SQL As String - Private SEARCH_TITLE As String - Public DataLoaded As Boolean = False + Private Const DEFAULT_X As Integer = 10 Private Const DEFAULT_Y As Integer = 10 - 'Private DTSearchTerms As DataTable - Private oDTAttributes As DataTable + + Private SelectedTabIndex As Integer + Private SelectedTab As XtraTabPage + + Private SEARCH_ID As Integer = 0 + Private SEARCH_SQL As String + Private SEARCH_TITLE As String Private SEARCH_COUNT As Integer = 0 - Private _Environment As Environment + + Public DataLoaded As Boolean = False + + Private DatatableAttributes As DataTable + Private DatatableSearchProfiles As DataTable + + Private LastSearchForm As frmDocumentResultList Private ChangedDateControls As List(Of String) - - Public Sub New(ByVal pDTSearchProfiles As DataTable, Optional ByVal pRunSearch As Boolean = False) ' Dieser Aufruf ist für den Designer erforderlich. InitializeComponent() ' Fügen Sie Initialisierungen nach dem InitializeComponent()-Aufruf hinzu. - DTSearchProfiles = pDTSearchProfiles + DatatableSearchProfiles = pDTSearchProfiles Logger = My.LogConfig.GetLogger() Dim oSearchTerms As New DataTable @@ -45,12 +48,15 @@ Public Class frmSearchStart oSearchTerms.Columns.Add("SearchTerm", GetType(String)) oSearchTerms.Columns.Add("BracketRight", GetType(String)) oSearchTerms.Columns.Add("Operator", GetType(String)) - 'DTSearchTerms = oSearchTerms End Sub - Private Sub frmSearchStart_Load(sender As Object, e As EventArgs) Handles Me.Load + Private Async Sub frmSearchStart_Load(sender As Object, e As EventArgs) Handles Me.Load + Dim oHandle As IOverlaySplashScreenHandle = Nothing + Try - Me.pnlProfileChoose.Visible = False + oHandle = SplashScreenManager.ShowOverlayForm(Me) + + pnlProfileChoose.Visible = False For Each oTab As XtraTabPage In XtraTabControl1.TabPages oTab.PageVisible = False Next @@ -75,139 +81,80 @@ Public Class frmSearchStart } }) - If DTSearchProfiles.Rows.Count > 1 Then - cmbProfile.DataSource = DTSearchProfiles - cmbProfile.ValueMember = DTSearchProfiles.Columns("SEARCH_PROFILE_ID").ColumnName - cmbProfile.DisplayMember = DTSearchProfiles.Columns("TITLE").ColumnName + BarCheckboxOpenSearchInSameWindow.Checked = My.UIConfig.SearchForm.OpenSearchInSameWindow + + If DatatableSearchProfiles.Rows.Count > 1 Then + cmbProfile.DataSource = DatatableSearchProfiles + cmbProfile.ValueMember = DatatableSearchProfiles.Columns("SEARCH_PROFILE_ID").ColumnName + cmbProfile.DisplayMember = DatatableSearchProfiles.Columns("TITLE").ColumnName cmbProfile.AutoCompleteMode = AutoCompleteMode.Suggest cmbProfile.AutoCompleteSource = AutoCompleteSource.ListItems cmbProfile.SelectedIndex = -1 - TabSelectedIndex = -1 + SelectedTabIndex = -1 - Me.pnlProfileChoose.Visible = True - For Each orow As DataRow In DTSearchProfiles.Rows - RepositoryItemComboBox1.Items.Add(orow.Item("TITLE")) + pnlProfileChoose.Visible = True + For Each oRow As DataRow In DatatableSearchProfiles.Rows + RepositoryItemComboBox1.Items.Add(oRow.Item("TITLE")) Next - Me.pnlProfileChoose.Visible = True Else - Me.pnlProfileChoose.Visible = False + pnlProfileChoose.Visible = False RibbonPageGroupProfiles.Visible = False - TabSelectedIndex = 0 - TabSelected = XtraTabControl1.TabPages(0) - TabSelected.PageVisible = True - PSEARCH_ID = DTSearchProfiles.Rows(0).Item("SEARCH_PROFILE_ID") - SEARCH_SQL = DTSearchProfiles.Rows(0).Item("RESULT_SQL") - SEARCH_TITLE = DTSearchProfiles.Rows(0).Item("TITLE") - TabSelected.Text = DTSearchProfiles.Rows(0).Item("TITLE") - Load_Search_Attributes() - BarButtonItemNewSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Never + SelectedTabIndex = 0 + SelectedTab = XtraTabControl1.TabPages.First + SelectedTab.PageVisible = True + SelectedTab.Text = DatatableSearchProfiles.Rows(0).Item("TITLE") + + SEARCH_ID = DatatableSearchProfiles.Rows(0).Item("SEARCH_PROFILE_ID") + SEARCH_SQL = DatatableSearchProfiles.Rows(0).Item("RESULT_SQL") + SEARCH_TITLE = DatatableSearchProfiles.Rows(0).Item("TITLE") + + Await Load_Search_Attributes() + BarButtonNewSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Never End If - SEARCH_COUNT = DTSearchProfiles.Rows.Count + SEARCH_COUNT = DatatableSearchProfiles.Rows.Count SplitContainerControlSearch.Collapsed = True - RibbonControl1.ColorScheme = DevExpress.XtraBars.Ribbon.RibbonControlColorScheme.Red + + If My.UIConfig.SearchForm.Size.Height > 0 And My.UIConfig.SearchForm.Size.Width > 0 Then + Size = My.UIConfig.SearchForm.Size + End If + If My.UIConfig.SearchForm.Location.X > 0 And My.UIConfig.SearchForm.Location.Y > 0 Then - Me.Location = My.UIConfig.SearchForm.Location + Location = My.UIConfig.SearchForm.Location End If Catch ex As Exception Logger.Error(ex.Message) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error while loading ProfileSearches:") + Finally + SplashScreenManager.CloseOverlayForm(oHandle) End Try - End Sub - - 'Public Sub AddSearchAttribute(pAttributeId As String, pAttributeTitle As String, pSearchTerm As String, Optional pCriteria As String = "=") - ' GridControlSerchTerms.DataSource = Nothing - ' Dim oMultiselect As Boolean = False - ' For Each oRow As DataRow In oDTAttributes.Rows - ' If oRow.Item("ATTRIBUTE_ID") = pAttributeId Then - ' oMultiselect = CBool(oRow.Item("MULTISELECT")) - ' Exit For - ' End If - ' Next - ' If oMultiselect = False Then - ' For Each oSearchTerm As DataRow In DTSearchTerms.Rows - ' If oSearchTerm.Item("AttrID") = pAttributeId Then 'And oSearchTerm.Item("Criteria") = pCriteria And oSearchTerm.Item("SearchTerm") = pSearchTerm - ' oSearchTerm.Delete() - ' End If - ' Next - ' End If - - ' DTSearchTerms.Rows.Add("", pAttributeId, pAttributeTitle, pCriteria, pSearchTerm, "", "and") - ' RenewBinding_DTSearchTerms() - - ' If SplitContainerControlSearch.Collapsed = True Then - ' SplitContainerControlSearch.Collapsed = False - ' End If - - 'End Sub - 'Sub RenewBinding_DTSearchTerms() - ' DTSearchTerms.AcceptChanges() - ' GridControlSerchTerms.DataSource = Nothing - ' GridControlSerchTerms.DataSource = DTSearchTerms - - ' GridViewSearchTerms.Columns("BracketLeft").Caption = "(" - ' GridViewSearchTerms.Columns("BracketRight").Caption = ")" - ' If My.Application.User.Language <> "de-DE" Then - ' GridViewSearchTerms.Columns("AttrTitle").Caption = "Attribute" - ' GridViewSearchTerms.Columns("Criteria").Caption = "Criteria" - ' Else - ' GridViewSearchTerms.Columns("AttrTitle").Caption = "Attribut" - ' GridViewSearchTerms.Columns("Criteria").Caption = "Bedingung" - ' End If - - 'End Sub - - 'Public Sub SearchAttribute(pAttrID As String, pAttrTitle As String, pSearchTerm As String, Optional pCriteria As String = "=") - ' '"BracketLeft" - ' '"AttrID", GetType(Integer)) - ' '"AttrTitle" - ' '"Criteria" - ' '"SearchTerm" - ' '"BracketRight" - ' '"Operator" - ' DTSearchTerms.Rows.Add("", pAttrID, pAttrTitle, pCriteria, pSearchTerm, "", "And") - ' DTSearchTerms.AcceptChanges() - - 'End Sub - - Sub Load_Search_Attributes() + Async Function Load_Search_Attributes() As Task Try DataLoaded = False - Dim oSQL = $"SELECT * FROM VWIDB_SEARCH_PROFILE_ATTRIBUTES WHERE SEARCH_PROFIL_ID = {PSEARCH_ID} ORDER BY [SEQUENCE]" - Dim oDT As DataTable = My.DatabaseIDB.GetDatatable(oSQL) - oDTAttributes = Nothing - oDTAttributes = oDT.Clone() - oDT.Select("", "SEQUENCE").CopyToDataTable(oDTAttributes, LoadOption.PreserveChanges) - 'oDTAttributes.Columns.Add("MULTISELECT", GetType(Boolean)) - 'oDTAttributes.AcceptChanges() - 'For Each oAttributeRow As DataRow In oDTAttributes.Rows - ' oAttributeRow.Item("MULTISELECT") = False - 'Next + Dim oSQL = $"SELECT * FROM VWIDB_SEARCH_PROFILE_ATTRIBUTES WHERE SEARCH_PROFIL_ID = {SEARCH_ID} ORDER BY [SEQUENCE]" + Dim oDT As DataTable = Await My.DatabaseIDB.GetDatatableAsync(oSQL) + DatatableAttributes = Nothing + DatatableAttributes = oDT.Clone() + oDT.Select("", "SEQUENCE").CopyToDataTable(DatatableAttributes, LoadOption.PreserveChanges) + Dim oControlCount As Integer = 1 Dim oControlRow As Integer = 0 - Dim oControls As New ClassControlCreator(TabSelected, Me) + Dim oControls As New ClassControlCreator(SelectedTab, Me) Dim YMax As Integer = 0 Dim YActControlHeight As Integer = 0 Dim XActControlWidth As Integer = 0 - Dim iList As New List(Of Integer)() - iList.Add(2) - iList.Add(3) - iList.Add(5) - iList.Add(6) - iList.Add(8) - iList.Add(9) + Dim iList As New List(Of Integer) From {2, 3, 5, 6, 8, 9} For Each oAttributeRow As DataRow In oDT.Rows Dim oXPosition As Integer Dim oYPositionControl As Integer Dim oYPositionLabel As Integer - Dim oMyLastGridView As DevExpress.XtraGrid.Views.Grid.GridView + Dim oMyLastGridView As GridView Dim oSingleResult As Boolean = False Dim oAttriTitle As String = oAttributeRow.Item("ATTRIBUTE_TITLE").ToString Dim oAttriID As Integer = CInt(oAttributeRow.Item("ATTRIBUTE_ID")) - ' Dim oDepAttriID1 As String = oAttributeRow.Item("DEPENDING_ATTRIBUTE1").ToString - Dim oAttriTYPE As String = oAttributeRow.Item("ATTRIBUTE_TYPE").ToString + Dim oAttributeType As String = oAttributeRow.Item("ATTRIBUTE_TYPE").ToString If oControlCount = 1 Or oControlCount = 5 Or oControlCount = 9 Then oControlRow += 1 End If @@ -236,27 +183,24 @@ Public Class frmSearchStart If CBool(oAttributeRow.Item("MULTISELECT")) = True Then oControlWidth += 50 End If - 'Erst mal das Label hinzufügen - 'If oAttriTYPE <> "BIT" Then + addLabel(oAttriTitle, oXPosition, oYPositionLabel) - 'End If 'Nun das Control mit dem entsprechenden Abstand und der Größe - Dim oXDistance As Integer, oYDistance As Integer Dim oCalcHeight As Integer Dim oCalcWidth As Integer - If oAttriTYPE = "VARCHAR" Or oAttriTYPE = "BIG INTEGER" Then + If oAttributeType = "VARCHAR" Or oAttributeType = "BIG INTEGER" Then oCalcHeight = oControlHeight + oYPositionControl oCalcWidth = oControlWidth - ElseIf (oAttriTYPE = "DATE" Or oAttriTYPE = "BIT") Then + ElseIf (oAttributeType = "DATE" Or oAttributeType = "BIT") Then oCalcHeight = 20 + oYPositionControl oCalcWidth = 100 End If If oCalcHeight > YActControlHeight Then YActControlHeight = oCalcHeight End If - Dim oMyControl As Control - If oAttriTYPE = "VARCHAR" Or oAttriTYPE = "BIG INTEGER" Then + Dim oMyControl As Control = Nothing + If oAttributeType = "VARCHAR" Or oAttributeType = "BIG INTEGER" Then oMyControl = oControls.CreateExistingGridControl(oAttributeRow, oXPosition, oYPositionControl) Dim myDGV As GridControl = CType(oMyControl, GridControl) @@ -279,34 +223,37 @@ Public Class frmSearchStart End If oView.FocusInvalidRow() - ElseIf oAttriTYPE = "DATE" Then + ElseIf oAttributeType = "DATE" Then oMyControl = oControls.CreateExistingDatepicker(oAttributeRow, oXPosition, oYPositionControl) Dim myDTP As DateEdit = CType(oMyControl, DateEdit) AddHandler myDTP.DisableCalendarDate, AddressOf DisableCalendarDate AddHandler myDTP.DateTimeChanged, AddressOf CalendarChanged 'CalendarChanged - ElseIf oAttriTYPE = "BIT" Then + ElseIf oAttributeType = "BIT" Then oMyControl = oControls.CreateExistingCheckbox(oAttributeRow, oXPosition, oYPositionControl) Dim myCheckBox As CheckBox = CType(oMyControl, CheckBox) AddHandler myCheckBox.CheckedChanged, AddressOf CheckBox_CheckedChanged End If oControlCount += 1 - TabSelected.Controls.Add(oMyControl) - If oAttriTYPE = "VARCHAR" Or oAttriTYPE = "BIG INTEGER" Then - oMyLastGridView.FocusInvalidRow() + If oMyControl IsNot Nothing Then + SelectedTab.Controls.Add(oMyControl) End If - oXPosition += oControlWidth + 20 + If oAttributeType = "VARCHAR" Or oAttributeType = "BIG INTEGER" Then + oMyLastGridView.FocusInvalidRow() + End If + + oXPosition += oControlWidth + 20 Next - DataLoaded = True Catch ex As Exception Logger.Warn("Unexpected error in Load_Search_Attributes - Error: " & ex.Message) MsgBox(ex.Message, MsgBoxStyle.Critical, "Unexpected error in Load_Search_Attributes:") + Finally DataLoaded = True End Try - End Sub + End Function Sub addLabel(pAttrName As String, pXPos As Integer, ylbl As Integer) Dim lbl As New Label With { .Name = "lbl" & pAttrName, @@ -315,15 +262,15 @@ Public Class frmSearchStart .Location = New Point(pXPos, ylbl) } - TabSelected.Controls.Add(lbl) + SelectedTab.Controls.Add(lbl) End Sub Private Sub XtraTabControl1_SelectedPageChanged(sender As Object, e As DevExpress.XtraTab.TabPageChangedEventArgs) Handles XtraTabControl1.SelectedPageChanged - TabSelected = XtraTabControl1.SelectedTabPage + SelectedTab = XtraTabControl1.SelectedTabPage End Sub Private Sub ClearSearchCriteria() - Dim oSQL = $"DELETE FROM TBIDB_USER_SEARCH_CRITERIA WHERE SEARCH_PROFIL_ID = {PSEARCH_ID} AND USERID = {My.Application.User.UserId}" + Dim oSQL = $"DELETE FROM TBIDB_USER_SEARCH_CRITERIA WHERE SEARCH_PROFIL_ID = {SEARCH_ID} AND USERID = {My.Application.User.UserId}" My.DatabaseIDB.ExecuteNonQuery(oSQL) @@ -336,7 +283,7 @@ Public Class frmSearchStart Private Sub RenewSearchAttributes() ClearSearchCriteria() - For Each oControl As Control In TabSelected.Controls + For Each oControl As Control In SelectedTab.Controls Dim octrlType = oControl.GetType.ToString Dim oAttrID As Integer Dim oAttrTitle As String @@ -353,12 +300,12 @@ Public Class frmSearchStart oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle For Each oRowHandle As Integer In oSelectedRows Dim oResult = oMyGridView.GetRowCellValue(oRowHandle, oMyGridView.Columns(0).FieldName) - Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {PSEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{oResult}','{My.Application.User.UserName}'" + Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {SEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{oResult}','{My.Application.User.UserName}'" My.DatabaseIDB.ExecuteNonQuery(oInsert) Next Case "DevExpress.XtraEditors.DateEdit" ' MsgBox("Date") - Dim myDTP As DateEdit = CType(oControl, DateEdit) + Dim oDateEdit As DateEdit = CType(oControl, DateEdit) If ChangedDateControls Is Nothing Then Continue For End If @@ -366,15 +313,15 @@ Public Class frmSearchStart Continue For End If For Each oName As String In ChangedDateControls - If myDTP.Name = oName Then - If Not IsNothing(myDTP.EditValue) Then + If oDateEdit.Name = oName Then + If Not IsNothing(oDateEdit.EditValue) Then oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrID oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle Dim oldValue As Date Dim validDate As Boolean = False - Dim oDateValue As DateTime = myDTP.EditValue + Dim oDateValue As Date = DirectCast(oDateEdit.EditValue, Date) Try - validDate = Date.TryParse(myDTP.OldEditValue, oldValue) + validDate = Date.TryParse(oDateEdit.OldEditValue, oldValue) Catch ex As Exception oldValue = Date.MinValue End Try @@ -383,12 +330,12 @@ Public Class frmSearchStart oldValue = Date.MinValue End If - If oldValue = myDTP.EditValue Then + If oldValue = oDateEdit.EditValue Then Exit Sub End If Dim dateString = oDateValue.ToString("yyyy-MM-dd") 'hh:mm:ss.fff - Dim omydate = myDTP.EditValue.ToString - Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {PSEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{omydate}','{My.Application.User.UserName}'" + Dim omydate = oDateEdit.EditValue.ToString + Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {SEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{omydate}','{My.Application.User.UserName}'" My.DatabaseIDB.ExecuteNonQuery(oInsert) End If End If @@ -399,7 +346,7 @@ Public Class frmSearchStart If myCheckBox.CheckState <> CheckState.Indeterminate Then oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrID oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle - Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {PSEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{myCheckBox.Checked.ToString}','{My.Application.User.UserName}'" + Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {SEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{myCheckBox.Checked.ToString}','{My.Application.User.UserName}'" My.DatabaseIDB.ExecuteNonQuery(oInsert) End If Case Else @@ -412,11 +359,10 @@ Public Class frmSearchStart If DataLoaded = False Then Exit Sub Dim oCurrentView As GridView = DirectCast(sender, GridView) Dim oCurrentControl As GridControl = oCurrentView.GridControl + Dim oRowView As DataRowView = CType(oCurrentView.GetFocusedRow(), DataRowView) - Dim rowView As DataRowView = CType(oCurrentView.GetFocusedRow(), DataRowView) - - If IsNothing(rowView) = False Then - Dim oResult As String = CType(rowView.Item(0), String) + If IsNothing(oRowView) = False Then + Dim oResult As String = CType(oRowView.Item(0), String) Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrID Dim oAttrTitle = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle ' RenewSearchAttributes() @@ -446,67 +392,31 @@ Public Class frmSearchStart e.IsDisabled = True End If End If - - - 'If (e.Date.DayOfWeek = DayOfWeek.Wednesday) Then - ' e.IsDisabled = True - 'End If End Sub Private Sub CalendarChanged(sender As Object, e As EventArgs) If DataLoaded = False Then Exit Sub - Dim myDTP As DateEdit = CType(sender, DateEdit) - If Not IsNothing(myDTP.EditValue) Then - Dim omydate = myDTP.EditValue.ToString - Dim oList As New List(Of String) - oList.Add(myDTP.Name) + Dim oDateEdit As DateEdit = CType(sender, DateEdit) + If Not IsNothing(oDateEdit.EditValue) Then + Dim oEditValue = oDateEdit.EditValue.ToString + Dim oList As New List(Of String) From {oDateEdit.Name} + If Not IsNothing(ChangedDateControls) Then Dim oFound As Boolean = False For Each oName As String In ChangedDateControls - If myDTP.Name = oName Then + If oDateEdit.Name = oName Then oFound = True Exit For End If Next If oFound = False Then - ChangedDateControls.Add(myDTP.Name) + ChangedDateControls.Add(oDateEdit.Name) End If Else ChangedDateControls = oList End If - - 'RenewSearchAttributes() - - 'Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {PSEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{omydate}','{My.Application.User.UserName}'" - 'My.DatabaseIDB.ExecuteNonQuery(oInsert) End If End Sub - Private Sub OnDateSelectedValueChanged(sender As Object, e As EventArgs) - Try - Dim myDTP As DateEdit = CType(sender, DateEdit) - Dim value As DateTime = myDTP.EditValue - Dim oldValue As Date - Dim validDate As Boolean = False - - Try - validDate = Date.TryParse(myDTP.OldEditValue, oldValue) - Catch ex As Exception - oldValue = Date.MinValue - End Try - - If Not validDate Then - oldValue = Date.MinValue - End If - - If oldValue = myDTP.EditValue Then - Exit Sub - End If - Dim dateString = value.ToString("yyyy-MM-dd") 'hh:mm:ss.fff - - Catch ex As Exception - Logger.Error(ex) - End Try - End Sub Public Function IsValidDate(pCheckDT As DataTable, pDate2Check As Date) As Boolean Dim oIsValid As Boolean = False For Each oDateRow As DataRow In pCheckDT.Rows @@ -516,158 +426,66 @@ Public Class frmSearchStart Next Return oIsValid End Function - 'Private Sub Clear_token() - ' Try - ' TokenEdit1.Properties.BeginUpdate() - ' Dim oCount As Int16 = 1 - ' For Each oRow As DataRow In DTSearchTerms.Rows - ' TokenEdit1.RemoveItem($"criteria{oCount}") - ' oCount += 1 - ' Next - ' TokenEdit1.Properties.EndUpdate() - ' Catch ex As Exception - ' End Try - - 'End Sub - Private Sub BarButtonItem1_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem1.ItemClick + Private Async Sub BarButtonClearSearch_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonClearSearch.ItemClick Try - 'Clear_token() ClearSearchCriteria() - 'DTSearchTerms.Clear() ClearSelectedControls() Catch ex As Exception MsgBox("Unexpected Error in Clearing Search Items: " & ex.Message, MsgBoxStyle.Critical) End Try - TabSelected.Controls.Clear() - Load_Search_Attributes() + SelectedTab.Controls.Clear() + Await Load_Search_Attributes() End Sub - Private Sub BarButtonItem3_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem3.ItemClick - - 'TokenEdit1.Properties.BeginUpdate() - ''TokenEdit1.Properties.Tokens.AddToken("Column1 = 'Value1'", "criteria1") - - 'TokenEdit1.Properties.Tokens.AddToken("Column1 = 'Value1'", "criteria1") - 'TokenEdit1.Properties.Tokens.AddToken("Column2 > 20", "criteria2") - 'TokenEdit1.Properties.Tokens.AddToken("Column3 <> 'Harry'", "criteria3") - 'TokenEdit1.EditValue = "criteria1, criteria2, criteria3" - '' ... add more tokens - 'TokenEdit1.Properties.EndUpdate() - End Sub - 'Private Sub AddToken(CriteriaString As String) - ' Try - ' Clear_token() - ' TokenEdit1.Properties.BeginUpdate() - ' ''oRow.Item("AttrTitle") & " " & oRow.Item("Criteria") & " '" & oRow.Item("SearchTerm") & "'" - ' Dim oCount As Int16 = 1 - ' For Each oRow As DataRow In DTSearchTerms.Rows - ' Try - ' Dim oCriteriaString = oRow.Item("AttrTitle") & " " & oRow.Item("Criteria") & " '" & oRow.Item("SearchTerm") & "'" - ' TokenEdit1.Properties.Tokens.AddToken(CriteriaString, "criteria" + oCount.ToString) - ' Catch ex As Exception - - ' End Try - - ' oCount += 1 - ' Next - ' ' Dim oTokenCount = DTSearchTerms.Rows.Count - ' 'TokenEdit1.Properties.BeginUpdate() - ' 'TokenEdit1.Properties.Tokens.AddToken(CriteriaString, "criteria" + oCount.ToString) - ' Dim otokenEditString = "" - ' oCount = 1 - ' For Each oRow As DataRow In DTSearchTerms.Rows - ' If oCount = 1 Then - ' otokenEditString = "criteria1" - ' Else - ' otokenEditString &= $", criteria{oCount}" - ' End If - ' oCount += 1 - ' Next - ' TokenEdit1.EditValue = otokenEditString - ' ' ... add more tokens - ' TokenEdit1.Properties.EndUpdate() - ' Catch ex As Exception - ' MsgBox("Unexpected Error in AddToken: " & ex.Message, MsgBoxStyle.Critical) - ' Logger.Warn("Unexpected Error in AddToken: " & ex.Message) - ' End Try - - - 'End Sub - - Private Sub cmbProfile_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbProfile.SelectedIndexChanged + Private Async Sub cmbProfile_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbProfile.SelectedIndexChanged If DataLoaded = False Then Exit Sub If cmbProfile.SelectedIndex <> -1 Then - If TabSelectedIndex = -1 Then - TabSelectedIndex = 0 + If SelectedTabIndex = -1 Then + SelectedTabIndex = 0 Else - TabSelectedIndex += 1 + SelectedTabIndex += 1 End If - TabSelected = XtraTabControl1.TabPages(TabSelectedIndex) - TabSelected.PageVisible = True - PSEARCH_ID = cmbProfile.SelectedValue + SelectedTab = XtraTabControl1.TabPages(SelectedTabIndex) + SelectedTab.PageVisible = True + SEARCH_ID = cmbProfile.SelectedValue Dim oDT As New DataTable - Dim oFilter As String = $"SEARCH_PROFILE_ID = {PSEARCH_ID}" - Dim oFilteredRows() As DataRow = DTSearchProfiles.Select(oFilter) - oDT = DTSearchProfiles.Clone + Dim oFilter As String = $"SEARCH_PROFILE_ID = {SEARCH_ID}" + Dim oFilteredRows() As DataRow = DatatableSearchProfiles.Select(oFilter) + oDT = DatatableSearchProfiles.Clone For Each oRow As DataRow In oFilteredRows SEARCH_SQL = oRow.Item("RESULT_SQL").ToString SEARCH_TITLE = cmbProfile.Text Next - TabSelected.Text = SEARCH_TITLE - Load_Search_Attributes() - BarButtonItemNewSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Always - XtraTabControl1.SelectedTabPageIndex = TabSelectedIndex + SelectedTab.Text = SEARCH_TITLE + Await Load_Search_Attributes() + BarButtonNewSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Always + XtraTabControl1.SelectedTabPageIndex = SelectedTabIndex End If End Sub - - Private Sub BarEditItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarEditItem2.ItemClick - - End Sub - - Private Sub BarButtonItemNewSearch_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItemNewSearch.ItemClick + Private Sub BarButtonNewSearch_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonNewSearch.ItemClick Display_InfoItem("New Search not integrated", Color.Yellow) - End Sub - Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem2.ItemClick + Private Sub BarButtonItem2_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonSaveSearch.ItemClick Display_InfoItem("Search Save not integrated", Color.Yellow) End Sub - Sub Display_InfoItem(pText As String, pColor As Color) + + Sub Display_InfoItem(pText As String, pBackColor As Color) + Display_InfoItem(pText, pBackColor, Color.Black) + End Sub + + Sub Display_InfoItem(pText As String, pBackColor As Color, pForeColor As Color) BarStaticItemInfo.Caption = pText - BarStaticItemInfo.ItemAppearance.Normal.BackColor = pColor + BarStaticItemInfo.ItemAppearance.Normal.BackColor = pBackColor + BarStaticItemInfo.ItemAppearance.Normal.ForeColor = pForeColor End Sub - Private Sub MehrfachauswahlAktivierenToolStripMenuItem_Click(sender As Object, e As EventArgs) - If DataLoaded = False Then Exit Sub - Dim oCurrentControl As GridControl = DirectCast(CURR_CTRL_OBJ, GridControl) - Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrID - Dim oAttrTitle = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle - - For Each oROW As DataRow In oDTAttributes.Rows - If oROW.Item("ATTRIBUTE_ID") = oAttrID Then - oROW.Item("MULTISELECT") = True - Exit For - End If - Next - End Sub - - - - Private Sub MehrfachauswahlInaktivierenToolStripMenuItem_Click(sender As Object, e As EventArgs) - If DataLoaded = False Then Exit Sub - Dim oCurrentControl As GridControl = DirectCast(CURR_CTRL_OBJ, GridControl) - Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrID - Dim oAttrTitle = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle - - For Each oROW As DataRow In oDTAttributes.Rows - If oROW.Item("ATTRIBUTE_ID") = oAttrID Then - oROW.Item("MULTISELECT") = False - Exit For - End If - Next + Sub Clear_InfoItem() + BarStaticItemInfo.Caption = String.Empty + BarStaticItemInfo.ItemAppearance.Normal.BackColor = Color.Transparent End Sub Private Sub GridViewSearchTerms_RowDeleted(sender As Object, e As DevExpress.Data.RowDeletedEventArgs) @@ -675,165 +493,56 @@ Public Class frmSearchStart Dim oCurrentView As GridView = DirectCast(sender, GridView) Dim oCurrentControl As GridControl = oCurrentView.GridControl - Dim rowView As DataRowView = CType(oCurrentView.GetFocusedRow(), DataRowView) + Dim oRowView As DataRowView = CType(oCurrentView.GetFocusedRow(), DataRowView) - If IsNothing(rowView) = False Then - Dim oResult As String = CType(rowView.Item(0), String) + If IsNothing(oRowView) = False Then + Dim oResult As String = CType(oRowView.Item(0), String) Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrID Dim oAttrTitle = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle End If End Sub - 'Private Sub GridViewSearchTerms_KeyUp(sender As Object, e As KeyEventArgs) - ' If e.KeyValue = Keys.Delete Then - ' Dim oSelectedRows As Integer() = GridViewSearchTerms.GetSelectedRows() - ' Dim oAttrID = GridViewSearchTerms.GetRowCellValue(oSelectedRows.Last(), GridViewSearchTerms.Columns("AttrID")) - ' Dim oSearchTerm = GridViewSearchTerms.GetRowCellValue(oSelectedRows.Last(), GridViewSearchTerms.Columns("SearchTerm")) - ' For Each dr As DataRow In DTSearchTerms.Rows - ' If dr.Item("AttrID") = oAttrID And dr.Item("SearchTerm") = oSearchTerm Then - ' dr.Delete() - ' Exit For - ' End If - ' Next - ' RenewBinding_DTSearchTerms() - ' End If - 'End Sub - - 'Private Sub ContextMenuStripSearchTerms_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStripSearchTerms.Opening - ' Dim rowView As DataRowView = GridViewSearchTerms.GetFocusedRow() - ' '"BracketLeft" - ' '"AttrID", GetType(Integer)) - ' '"AttrTitle" - ' '"Criteria" - ' '"SearchTerm" - ' '"BracketRight" - ' '"Operator" - ' If IsNothing(rowView) = False Then - ' Dim oOperator As String = rowView.Item("Operator") - ' If oOperator = "and" Then - ' If My.Application.User.Language = "de-De" Then - ' tsmOperator.Text = "Operator = oder" - ' Else - ' tsmOperator.Text = "Operator = or" - ' End If - ' Else - ' If My.Application.User.Language = "de-De" Then - ' tsmOperator.Text = "Operator = und" - ' Else - ' tsmOperator.Text = "Operator = and" - ' End If - ' End If - ' End If - 'End Sub - - 'Private Sub tsmOperator_Click(sender As Object, e As EventArgs) Handles tsmOperator.Click - ' Dim rowView As DataRowView = GridViewSearchTerms.GetFocusedRow() - ' If IsNothing(rowView) = False Then - ' Dim oAttrID As String = rowView.Item("AttrID") - ' Dim oSearchTerm As String = rowView.Item("SearchTerm") - ' Dim oREPLACEOperator As String - ' If tsmOperator.Text.EndsWith("und") Or tsmOperator.Text.EndsWith("and") Then - ' oREPLACEOperator = "and" - ' Else - ' oREPLACEOperator = "or" - ' End If - ' For Each oRow As DataRow In DTSearchTerms.Rows - ' If oRow.Item("AttrID") = oAttrID And oRow.Item("SearchTerm") = oSearchTerm Then - ' oRow.Item("Operator") = oREPLACEOperator - ' DTSearchTerms.AcceptChanges() - ' Exit For - ' End If - - ' Next - ' End If - 'End Sub - 'Private Sub BracketLeftToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles BracketLeftToolStripMenuItem.Click - ' Dim rowView As DataRowView = GridViewSearchTerms.GetFocusedRow() - ' If IsNothing(rowView) = False Then - ' Dim oAttrID As String = rowView.Item("AttrID") - ' Dim oSearchTerm As String = rowView.Item("SearchTerm") - ' For Each oRow As DataRow In DTSearchTerms.Rows - ' If oRow.Item("AttrID") = oAttrID And oRow.Item("SearchTerm") = oSearchTerm Then - ' oRow.Item("BracketLeft") = "(" - ' DTSearchTerms.AcceptChanges() - ' Exit For - ' End If - - ' Next - ' End If - 'End Sub - - 'Private Sub KlammerRechtsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles KlammerRechtsToolStripMenuItem.Click - ' Dim rowView As DataRowView = CType(GridViewSearchTerms.GetFocusedRow(), DataRowView) - ' If IsNothing(rowView) = False Then - ' Dim oAttrID As String = rowView.Item("AttrID") - ' Dim oSearchTerm As String = rowView.Item("SearchTerm") - ' For Each oRow As DataRow In DTSearchTerms.Rows - ' If oRow.Item("AttrID") = oAttrID And oRow.Item("SearchTerm") = oSearchTerm Then - ' oRow.Item("BracketRight") = ")" - ' DTSearchTerms.AcceptChanges() - ' Exit For - ' End If - - ' Next - ' End If - 'End Sub - 'Private Sub KlammerEntfernenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles KlammerEntfernenToolStripMenuItem.Click - ' Dim rowView As DataRowView = GridViewSearchTerms.GetFocusedRow() - ' If IsNothing(rowView) = False Then - ' Dim oAttrID As String = rowView.Item("AttrID") - ' Dim oSearchTerm As String = rowView.Item("SearchTerm") - ' For Each oRow As DataRow In DTSearchTerms.Rows - ' If oRow.Item("AttrID") = oAttrID And oRow.Item("SearchTerm") = oSearchTerm Then - ' oRow.Item("BracketRight") = "" - ' oRow.Item("BracketLeft") = "" - ' DTSearchTerms.AcceptChanges() - ' Exit For - ' End If - - ' Next - ' End If - 'End Sub Private Sub frmSearchStart_FormClosed(sender As Object, e As FormClosedEventArgs) Handles MyBase.FormClosed My.UIConfig.SearchForm.Location = Me.Location My.UIConfigManager.Save() End Sub - Private Function GetSearchTermForType(pAttrID As Int16, pAttrTitle As String, pCriteria As String, pTERM As String) As String - Dim oRETURN As String = "" + + Private Function GetSearchTermForType(pAttrID As Int16, pAttrTitle As String, pCriteria As String, pTerm As String) As String + Dim oSearchTerm As String = "" Dim oFilter As String = $"GUID = {pAttrID}" Dim oFilteredRows() As DataRow = My.DTAttributes.Select(oFilter) If oFilteredRows.Length = 1 Then For Each oRow As DataRow In oFilteredRows - Dim oType As Integer = CInt(oRow.Item("TYP_ID")) + Dim oType As Integer = DirectCast(oRow.Item("TYP_ID"), Integer) If oType = 1 Or oType = 8 Then - oRETURN = $"{pAttrTitle} {pCriteria} '{pTERM.Replace("'", "''")}'" + oSearchTerm = $"{pAttrTitle} {pCriteria} '{pTerm.Replace("'", "''")}'" ElseIf oType = 2 Or oType = 9 Then - oRETURN = $"{pAttrTitle} {pCriteria} {pTERM}" + oSearchTerm = $"{pAttrTitle} {pCriteria} {pTerm}" ElseIf oType = 3 Then 'Float - oRETURN = $"{pAttrTitle} {pCriteria} Convert(float,'{pTERM.Replace(",", ".")}')" + oSearchTerm = $"{pAttrTitle} {pCriteria} Convert(float,'{pTerm.Replace(",", ".")}')" ElseIf oType = 4 Then 'Decimal - oRETURN = $"{pAttrTitle} {pCriteria} Convert(decimal(19,2),'{pTERM.Replace(",", ".")}')" + oSearchTerm = $"{pAttrTitle} {pCriteria} Convert(decimal(19,2),'{pTerm.Replace(",", ".")}')" ElseIf oType = 5 Then 'DATE - oRETURN = $"{pAttrTitle} {pCriteria} Convert(date,'{pTERM}')" + oSearchTerm = $"{pAttrTitle} {pCriteria} Convert(date,'{pTerm}')" ElseIf oType = 7 Then Dim oBit As Int16 - If CBool(pTERM) = True Then + If CBool(pTerm) = True Then oBit = 1 Else oBit = 0 End If - oRETURN = $"{pAttrTitle} {pCriteria} '{oBit.ToString}'" + oSearchTerm = $"{pAttrTitle} {pCriteria} '{oBit.ToString}'" End If Next End If - Return oRETURN + Return oSearchTerm End Function - Private Sub BarButtonItem4_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonItem4.ItemClick + Private Sub BarButtonStartSearch_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarButtonStartSearch.ItemClick RenewSearchAttributes() Start_Search() End Sub @@ -842,35 +551,14 @@ Public Class frmSearchStart Try oHandle = SplashScreenManager.ShowOverlayForm(Me) + Clear_InfoItem() - Dim oSEARCH_SQL = SEARCH_SQL - Dim oOperator As String - Dim oCount As Integer = 1 - 'For Each oRow As DataRow In DTSearchTerms.Rows - ' '"BracketLeft" - ' '"AttrID", GetType(Integer)) - ' '"AttrTitle" - ' '"Criteria" - ' '"SearchTerm" - ' '"BracketRight" - ' '"Operator" - ' oOperator = oRow.Item("Operator").ToString - ' Dim oSearchTerm = GetSearchTermForType(oRow.Item("AttrID"), oRow.Item("AttrTitle").ToString, oRow.Item("Criteria").ToString, oRow.Item("SearchTerm").ToString) + Dim oSearchSQL = SEARCH_SQL - ' Dim oBracketLeft As String = oRow.Item("BracketLeft").ToString - ' Dim oBracketRight As String = oRow.Item("BracketLeft").ToString - ' Dim oSpaceChar = IIf(oCount = 0, " ", "") - - ' oSEARCH_SQL &= $"{oSpaceChar}{oBracketLeft}{oSearchTerm}{oBracketRight}" - ' If DTSearchTerms.Rows.Count > oCount Then - ' oSEARCH_SQL &= $" {oOperator} {Chr(13)}" - ' End If - ' oCount += 1 - 'Next - oSEARCH_SQL = oSEARCH_SQL.Replace("@UserID", My.Application.User.UserId) - oSEARCH_SQL = oSEARCH_SQL.Replace("@User_ID", My.Application.User.UserId) - oSEARCH_SQL = oSEARCH_SQL.Replace("@UserName", My.Application.User.UserName) - oSEARCH_SQL = oSEARCH_SQL.Replace("@SearchID", PSEARCH_ID) + oSearchSQL = oSearchSQL.Replace("@UserID", My.Application.User.UserId.ToString) + oSearchSQL = oSearchSQL.Replace("@User_ID", My.Application.User.UserId.ToString) + oSearchSQL = oSearchSQL.Replace("@UserName", My.Application.User.UserName) + oSearchSQL = oSearchSQL.Replace("@SearchID", SEARCH_ID.ToString) Dim oEnvironment As New Modules.ZooFlow.Environment() With { .User = My.Application.User, .Modules = My.Application.Modules, @@ -878,29 +566,39 @@ Public Class frmSearchStart .DatabaseIDB = My.DatabaseIDB, .Settings = My.Application.Settings } - Dim oDTSearchResult As DataTable = My.DatabaseIDB.GetDatatable(oSEARCH_SQL) + Dim oDTSearchResult As DataTable = My.DatabaseIDB.GetDatatable(oSearchSQL) If oDTSearchResult.Rows.Count > 0 Then Dim oShortGuid = Guid.NewGuid() - Dim oWindowGuid = $"{PSEARCH_ID.ToString}-{My.User.Name}" + Dim oWindowGuid = $"{SEARCH_ID.ToString}-{My.User.Name}" Dim oParams = New DocumentResultParams() With { .IsIDBResult = True, .WindowGuid = oWindowGuid, .Results = New List(Of DocumentResult) From { New DocumentResult() With { - .Title = TabSelected.Text, + .Title = SelectedTab.Text, .Datatable = oDTSearchResult } } } - Dim oForm As New frmDocumentResultList(My.LogConfig, oEnvironment, oParams) - oForm.Show() + If My.UIConfig.SearchForm.OpenSearchInSameWindow And LastSearchForm IsNot Nothing Then + LastSearchForm.RefreshResults(oParams.Results) + Else + Dim oForm As New frmDocumentResultList(My.LogConfig, oEnvironment, oParams) + oForm.Show() - ' Position Result Window below this window - oForm.Location = GetResultFormLocation() - oForm.Size = GetResultFormSize() + ' Position Result Window below this window + oForm.Location = GetResultFormLocation() + oForm.Size = GetResultFormSize() + + AddHandler oForm.FormClosed, Sub() + LastSearchForm = Nothing + End Sub + + LastSearchForm = oForm + End If Else - Display_InfoItem("No results for this searchcombination!", Color.OrangeRed) + Display_InfoItem("No results for this searchcombination!", Color.OrangeRed, Color.White) End If Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Critical, Text) @@ -958,6 +656,16 @@ Public Class frmSearchStart txtFilterTo.Enabled = True txtFilterTo.EditValue = oTimeframe.[To] End If + End Sub + Private Sub BarCheckboxOpenSearchInSameWindow_CheckedChanged(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles BarCheckboxOpenSearchInSameWindow.CheckedChanged + My.UIConfig.SearchForm.OpenSearchInSameWindow = BarCheckboxOpenSearchInSameWindow.Checked + My.UIConfigManager.Save() + End Sub + + Private Sub frmSearchStart_ResizeEnd(sender As Object, e As EventArgs) Handles Me.ResizeEnd + My.UIConfig.SearchForm.Location = Location + My.UIConfig.SearchForm.Size = Size + My.UIConfigManager.Save() End Sub End Class \ No newline at end of file