improve init, clean up code
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Option Explicit On
|
||||
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DevExpress.XtraTab
|
||||
Imports DevExpress.XtraGrid
|
||||
Imports DevExpress.XtraGrid.Views.Grid
|
||||
@@ -44,24 +46,24 @@ Public Class frmSearchStart
|
||||
|
||||
|
||||
End Sub
|
||||
Public Sub AddSearchAttribute(pAttrID As String, pAttrTitle As String, pSearchTerm As String, Optional pCriteria As String = "=")
|
||||
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") = pAttrID Then
|
||||
oMultiselect = CBool(oROW.Item("MULTISELECT"))
|
||||
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") = pAttrID Then 'And oSearchTerm.Item("Criteria") = pCriteria And oSearchTerm.Item("SearchTerm") = pSearchTerm
|
||||
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("", pAttrID, pAttrTitle, pCriteria, pSearchTerm, "", "and")
|
||||
DTSearchTerms.Rows.Add("", pAttributeId, pAttributeTitle, pCriteria, pSearchTerm, "", "and")
|
||||
RenewBinding_DTSearchTerms()
|
||||
|
||||
If SplitContainerControlSearch.Collapsed = True Then
|
||||
@@ -630,7 +632,7 @@ Public Class frmSearchStart
|
||||
End Sub
|
||||
|
||||
Private Sub KlammerRechtsToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles KlammerRechtsToolStripMenuItem.Click
|
||||
Dim rowView As DataRowView = GridViewSearchTerms.GetFocusedRow()
|
||||
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")
|
||||
@@ -679,7 +681,7 @@ Public Class frmSearchStart
|
||||
'"BracketRight"
|
||||
'"Operator"
|
||||
oOperator = oRow.Item("Operator").ToString
|
||||
Dim oSearchTerm = GetSearchTerm_for_Type(oRow.Item("AttrID"), oRow.Item("AttrTitle").ToString, oRow.Item("Criteria").ToString, oRow.Item("SearchTerm").ToString)
|
||||
Dim oSearchTerm = GetSearchTermForType(oRow.Item("AttrID"), oRow.Item("AttrTitle").ToString, oRow.Item("Criteria").ToString, oRow.Item("SearchTerm").ToString)
|
||||
|
||||
oSEARCH_SQL &= IIf(oCount = 0, " ", "") + $"{oRow.Item("BracketLeft").ToString}{oSearchTerm}{oRow.Item("BracketLeft").ToString}"
|
||||
If DTSearchTerms.Rows.Count > oCount Then
|
||||
@@ -699,12 +701,14 @@ Public Class frmSearchStart
|
||||
Dim oShortGuid = Guid.NewGuid()
|
||||
Dim oWindowGuid = $"{PSEARCH_ID.ToString}-{My.User.Name}" '{String.Join("-", oShortGuid.ToString)}"
|
||||
Dim oParams = New DocumentResultParams() With {
|
||||
.WindowGuid = oWindowGuid
|
||||
}
|
||||
oParams.Results.Add(New DocumentResult() With {
|
||||
.Title = TabSelected.Text,
|
||||
.Datatable = oDTSearchResult
|
||||
})
|
||||
.WindowGuid = oWindowGuid,
|
||||
.Results = New List(Of DocumentResult) From {
|
||||
New DocumentResult() With {
|
||||
.Title = TabSelected.Text,
|
||||
.Datatable = oDTSearchResult
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Dim oForm As New frmDocumentResultList(My.LogConfig, oEnvironment, oParams)
|
||||
|
||||
@@ -722,7 +726,7 @@ Public Class frmSearchStart
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function GetSearchTerm_for_Type(pAttrID As Int16, pAttrTitle As String, pCriteria As String, pTERM As String) As String
|
||||
Private Function GetSearchTermForType(pAttrID As Int16, pAttrTitle As String, pCriteria As String, pTERM As String) As String
|
||||
Dim oRETURN As String = ""
|
||||
|
||||
Dim oFilter As String = $"GUID = {pAttrID}"
|
||||
|
||||
Reference in New Issue
Block a user