Zooflow: Zooflow: Rework New Search
This commit is contained in:
@@ -9,14 +9,14 @@ Public Class SearchRunner
|
||||
|
||||
Private Const SEARCH_FACT_DATE_DEFAULT As String = "ADDED_WHEN"
|
||||
|
||||
Private Const CREATED_TOMORROW As String = "TOMORROW"
|
||||
Private Const CREATED_TODAY As String = "ECM_CREATED_TODAY"
|
||||
Private Const CREATED_YESTERDAY As String = "ECM_CREATED_YESTERDAY"
|
||||
Private Const CREATED_LAST_7_DAYS As String = "ECM_CREATED_LAST7DAYS"
|
||||
Private Const CREATED_YEAR_CURRENT As String = "ECM_CREATED_YEAR_CURRENT"
|
||||
Private Const CREATED_YEAR_LAST As String = "ECM_CREATED_YEAR_LAST"
|
||||
Private Const CREATED_MONTH_CURR As String = "ECM_CREATED_MONTH_CURRENT"
|
||||
Private Const CREATED_MONTH_LAST As String = "ECM_CREATED_MONTH_LAST"
|
||||
Public Const CREATED_TOMORROW As String = "TOMORROW"
|
||||
Public Const CREATED_TODAY As String = "ECM_CREATED_TODAY"
|
||||
Public Const CREATED_YESTERDAY As String = "ECM_CREATED_YESTERDAY"
|
||||
Public Const CREATED_LAST_7_DAYS As String = "ECM_CREATED_LAST7DAYS"
|
||||
Public Const CREATED_YEAR_CURRENT As String = "ECM_CREATED_YEAR_CURRENT"
|
||||
Public Const CREATED_YEAR_LAST As String = "ECM_CREATED_YEAR_LAST"
|
||||
Public Const CREATED_MONTH_CURR As String = "ECM_CREATED_MONTH_CURRENT"
|
||||
Public Const CREATED_MONTH_LAST As String = "ECM_CREATED_MONTH_LAST"
|
||||
|
||||
Public Enum DateConstraint
|
||||
Today
|
||||
@@ -27,6 +27,7 @@ Public Class SearchRunner
|
||||
LastMonth
|
||||
CurrentYear
|
||||
LastYear
|
||||
Undefined
|
||||
End Enum
|
||||
|
||||
Public Event NeedsRefresh As EventHandler(Of Integer)
|
||||
@@ -85,10 +86,13 @@ Public Class SearchRunner
|
||||
End Function
|
||||
|
||||
Public Async Function Run(pSearchTerm As String) As Task(Of SearchResult)
|
||||
Dim oWindowTitle = GetResultWindowString(pSearchTerm)
|
||||
Return Await Run(pSearchTerm, Nothing, Nothing)
|
||||
End Function
|
||||
|
||||
Public Async Function Run() As Task(Of SearchResult)
|
||||
Return Await Run("")
|
||||
End Function
|
||||
|
||||
|
||||
Public Async Function Run(pSearchTerm As String, pDateFrom As Date, pDateTo As Date) As Threading.Tasks.Task(Of SearchResult)
|
||||
If pDateFrom.Equals(Date.MinValue) = False Then
|
||||
@@ -129,7 +133,7 @@ Public Class SearchRunner
|
||||
|
||||
Dim oForm As New frmDocumentResultList(My.LogConfig, Environment, oParams)
|
||||
|
||||
' TODO: Implement, not needed right now
|
||||
' TODO: Implement
|
||||
'AddHandler oForm.NeedsRefresh, AddressOf Form_NeedsRefresh
|
||||
AddHandler oForm.FormClosed, AddressOf Form_Closed
|
||||
|
||||
@@ -190,36 +194,62 @@ Public Class SearchRunner
|
||||
End Sub
|
||||
|
||||
Public Sub SetDateConstraint(pConstraint As DateConstraint)
|
||||
_ActiveDateConstraint = DateConstraintToConstant(pConstraint)
|
||||
End Sub
|
||||
|
||||
Public Function DateConstraintToConstant(pConstraint As DateConstraint) As String
|
||||
Select Case pConstraint
|
||||
Case DateConstraint.Today
|
||||
_ActiveDateConstraint = CREATED_TODAY
|
||||
Return CREATED_TODAY
|
||||
|
||||
Case DateConstraint.Yesterday
|
||||
_ActiveDateConstraint = CREATED_YESTERDAY
|
||||
Return CREATED_YESTERDAY
|
||||
|
||||
Case DateConstraint.Tomorrow
|
||||
_ActiveDateConstraint = CREATED_TOMORROW
|
||||
Return CREATED_TOMORROW
|
||||
|
||||
Case DateConstraint.Last7Days
|
||||
_ActiveDateConstraint = CREATED_LAST_7_DAYS
|
||||
Return CREATED_LAST_7_DAYS
|
||||
|
||||
Case DateConstraint.CurrentMonth
|
||||
_ActiveDateConstraint = CREATED_MONTH_CURR
|
||||
Return CREATED_MONTH_CURR
|
||||
|
||||
Case DateConstraint.LastMonth
|
||||
_ActiveDateConstraint = CREATED_MONTH_LAST
|
||||
Return CREATED_MONTH_LAST
|
||||
|
||||
Case DateConstraint.CurrentYear
|
||||
_ActiveDateConstraint = CREATED_YEAR_CURRENT
|
||||
Return CREATED_YEAR_CURRENT
|
||||
|
||||
Case DateConstraint.LastYear
|
||||
_ActiveDateConstraint = CREATED_YEAR_LAST
|
||||
Return CREATED_YEAR_LAST
|
||||
|
||||
Case Else
|
||||
_ActiveDateAttribute = String.Empty
|
||||
Return String.Empty
|
||||
|
||||
End Select
|
||||
End Sub
|
||||
End Function
|
||||
Public Function ConstantToDateConstraint(pConstant As String) As DateConstraint
|
||||
Select Case pConstant
|
||||
Case CREATED_TODAY
|
||||
Return DateConstraint.Today
|
||||
Case CREATED_YESTERDAY
|
||||
Return DateConstraint.Yesterday
|
||||
Case CREATED_TOMORROW
|
||||
Return DateConstraint.Tomorrow
|
||||
Case CREATED_LAST_7_DAYS
|
||||
Return DateConstraint.Last7Days
|
||||
Case CREATED_MONTH_CURR
|
||||
Return DateConstraint.CurrentMonth
|
||||
Case CREATED_MONTH_LAST
|
||||
Return DateConstraint.LastMonth
|
||||
Case CREATED_YEAR_CURRENT
|
||||
Return DateConstraint.CurrentYear
|
||||
Case CREATED_YEAR_LAST
|
||||
Return DateConstraint.LastYear
|
||||
Case Else
|
||||
Return DateConstraint.Undefined
|
||||
End Select
|
||||
End Function
|
||||
|
||||
Public Sub SetDateAttribute(pAttributeName As String)
|
||||
_ActiveDateAttribute = pAttributeName
|
||||
|
||||
Reference in New Issue
Block a user