Skip to content

Commit

Permalink
Updated Latest module with setting to show properties based by search…
Browse files Browse the repository at this point in the history
… result
  • Loading branch information
Scippy committed Apr 8, 2020
1 parent 6eecb3e commit da110d2
Show file tree
Hide file tree
Showing 6 changed files with 485 additions and 374 deletions.
2 changes: 2 additions & 0 deletions Entities/Constants.vb
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,8 @@ Namespace Ventrian.PropertyAgent
Public Const LATEST_TYPE_ID_SETTING_DEFAULT As Integer = -1
Public Const LATEST_PROPERTY_ID_IN_URL_SETTING As String = "PropertyIDinURL"
Public Const LATEST_PROPERTY_ID_IN_URL_SETTING_DEFAULT As Boolean = False
Public Const LATEST_SEARCH_VALUES_IN_URL_SETTING As String = "SearchValuesInURL"
Public Const LATEST_SEARCH_VALUES_IN_URL_SETTING_DEFAULT As Boolean = False
Public Const LATEST_BUBBLE_FEATURED_SETTING As String = "LatestBubbleFeatured"
Public Const LATEST_BUBBLE_FEATURED_SETTING_DEFAULT As Boolean = False
Public Const LATEST_FEATURED_ONLY_SETTING As String = "LatestFeaturedOnly"
Expand Down
10 changes: 10 additions & 0 deletions Entities/Property/PropertySettingsLatest.vb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ Namespace Ventrian.PropertyAgent
End Get
End Property

Public ReadOnly Property SearchValuesInURL() As Boolean
Get
If (_settings.Contains(Constants.LATEST_SEARCH_VALUES_IN_URL_SETTING)) Then
Return Convert.ToBoolean(_settings(Constants.LATEST_SEARCH_VALUES_IN_URL_SETTING).ToString())
Else
Return Constants.LATEST_SEARCH_VALUES_IN_URL_SETTING_DEFAULT
End If
End Get
End Property

Public ReadOnly Property FeaturedOnly() As Boolean
Get
If (_settings.Contains(Constants.LATEST_FEATURED_ONLY_SETTING)) Then
Expand Down
81 changes: 81 additions & 0 deletions Latest.ascx.vb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ Namespace Ventrian.PropertyAgent

Private _pageNumber As Integer = 1

Private _searchValues As String = Null.NullString
Private _agentType As String = Null.NullString
Private _agentFilter As String = Null.NullString
Private _propertyAgentID As Integer = Null.NullInteger
Private _propertyAgentName As String = Null.NullInteger
Private _propertyBrokerID As Integer = Null.NullInteger
Private _location As String = Null.NullString
Private _currentPage As Integer = 1
Private _pageRecords As Integer = 10
Private _customFieldIDs As String = Null.NullString
Private _sortBy As String = ""
Private _sortDirection As String = ""
Private _totalRecords As Integer = 0

#End Region

#Region " Private Properties "
Expand Down Expand Up @@ -315,6 +329,10 @@ Namespace Ventrian.PropertyAgent
If PropID <> -1 Then
objProperties.Add(objPropertyController.Get(PropID))
End If
ElseIf (Me.PropertySettingsLatest.SearchValuesInURL) Then
ReadQueryStringTotal()
objProperties = objPropertyController.List(Me.PropertySettingsLatest.PropertyAgentModuleID, _propertyTypeID, SearchStatusType.PublishedActive, _propertyAgentID, _propertyBrokerID, Me.PropertySettingsLatest.FeaturedOnly, OnlyForAuthenticated, Me.SortBy, Me.SortByCustomField, Me.SortDirection, Null.NullInteger, Null.NullInteger, SortDirectionType.Ascending, Null.NullInteger, Null.NullInteger, SortDirectionType.Ascending, _customFieldIDs, _searchValues, _currentPage - 1, _pageRecords, _totalRecords, Me.PropertySettingsLatest.Bubblefeatured, True, Null.NullInteger, Null.NullInteger, latitude, longitude, startDate, Null.NullString, shortListID)

Else
objProperties = objPropertyController.List(Me.PropertySettingsLatest.PropertyAgentModuleID, _propertyTypeID, SearchStatusType.PublishedActive, agentID, Null.NullInteger, Me.PropertySettingsLatest.FeaturedOnly, OnlyForAuthenticated, Me.SortBy, Me.SortByCustomField, Me.SortDirection, Null.NullInteger, Null.NullInteger, SortDirectionType.Ascending, Null.NullInteger, Null.NullInteger, SortDirectionType.Ascending, customFieldFilters, customFieldValues, _pageNumber - 1, maxCount, totalRecords, Me.PropertySettingsLatest.Bubblefeatured, True, Null.NullInteger, Null.NullInteger, latitude, longitude, startDate, Null.NullString, shortListID)

Expand Down Expand Up @@ -404,6 +422,69 @@ Namespace Ventrian.PropertyAgent

End Sub

Private Sub ReadQueryStringTotal()

Dim agentTypeParam As String = PropertySettings.SEOAgentType
If (Request(agentTypeParam) = "") Then
agentTypeParam = "agentType"
End If
If Not (Request(agentTypeParam) Is Nothing) Then
_agentType = Request(agentTypeParam)
End If

Dim propertyTypeIDParam As String = PropertySettings.SEOPropertyTypeID
If (Request(propertyTypeIDParam) = "") Then
propertyTypeIDParam = "PropertyTypeID"
End If
If Not (Request(propertyTypeIDParam) Is Nothing) Then
Integer.TryParse(Request(propertyTypeIDParam), _propertyTypeID)
If (_propertyTypeID = 0) Then
Response.Redirect(NavigateURL(Me.TabId), True)
End If
End If

If Not (Request("AgentFilter") Is Nothing) Then
_agentFilter = Server.UrlDecode(Request("AgentFilter"))
End If

If Not (Request("PropertyAgentID") Is Nothing) Then
_propertyAgentID = Convert.ToInt32(Request("PropertyAgentID"))
End If
If Not (Request("PropertyAgentName") Is Nothing) Then
_propertyAgentName = Request("PropertyAgentName")
End If
If Not (Request("PropertyBrokerID") Is Nothing) Then
_propertyBrokerID = Convert.ToInt32(Request("PropertyBrokerID"))
End If

If Not (Request("Location") Is Nothing) Then
_location = Server.UrlDecode(Request("Location"))
End If

If Not (Request("CurrentPage") Is Nothing) Then
_currentPage = Convert.ToInt32(Request("CurrentPage"))
End If

If Not (Request("CustomFieldIDs") Is Nothing) Then
_customFieldIDs = Request("CustomFieldIDs").Trim()
End If

If Not (Request("SearchValues") Is Nothing) Then
_searchValues = Request("SearchValues").Trim()
End If

If Not (Request("sortBy") Is Nothing) Then
_sortBy = Request("sortBy").Trim()
End If

If Not (Request("sortDir") Is Nothing) Then
_sortDirection = Request("sortDir").Trim()
End If

_pageRecords = Me.PropertySettings.ListingItemsPerPage

End Sub

Private Sub ProcessEmpty(ByRef objPlaceHolder As ControlCollection, ByVal layoutArray As String())

For iPtr As Integer = 0 To layoutArray.Length - 1 Step 2
Expand Down
6 changes: 6 additions & 0 deletions LatestOptions.ascx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<asp:CheckBox ID="ckkPropertyIDinURL" Runat="server" />
</td>
</tr>
<tr>
<td class="SubHead" width="150">Bind search values in URL</td>
<td valign="bottom">
<asp:CheckBox ID="ckkSearchValuesInURL" Runat="server" />
</td>
</tr>
<tr>
<td class="SubHead" width="150"><dnn:label id="plBubbleFeatured" runat="server" controlname="chkBubbleFeatured" suffix=":"></dnn:label></td>
<td valign="bottom">
Expand Down
Loading

0 comments on commit da110d2

Please sign in to comment.