From e15cf7bf56a44f72471d07503ae16c481e6fed3f Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Wed, 15 Apr 2026 09:50:06 -0400 Subject: [PATCH] Refactor project into generic starter template - remove domain-specific controllers, models, repositories, and views - keep only Home/Error starter routing and controller registry entries - add IIS Express startup support with run_site.cmd and applicationhost.config Co-Authored-By: Abacus.AI CLI --- app/controllers/HouseholdController.asp | 397 ------- app/controllers/HouseholderNameController.asp | 284 ----- app/controllers/TerritoryController.asp | 226 ---- app/controllers/autoload_controllers.asp | 5 +- app/models/HouseholderNamesRepository.asp | 176 --- app/models/HouseholdsRepository.asp | 243 ---- app/models/POBO_HouseholderNames.asp | 133 --- app/models/POBO_Households.asp | 172 --- app/models/POBO_Territories.asp | 103 -- app/models/TerritoriesRepository.asp | 176 --- app/views/Household/create.asp | 153 --- app/views/Household/edit.asp | 190 --- app/views/Household/index.asp | 187 --- app/views/Household/show.asp | 291 ----- app/views/HouseholderName/create.asp | 86 -- app/views/HouseholderName/edit.asp | 95 -- app/views/HouseholderName/index.asp | 171 --- app/views/HouseholderName/show.asp | 90 -- app/views/Territory/create.asp | 134 --- app/views/Territory/edit.asp | 164 --- app/views/Territory/index.asp | 150 --- app/views/Territory/show.asp | 813 ------------- app/views/shared/header.asp | 14 +- applicationhost.config | 1030 +++++++++++++++++ core/lib.ControllerRegistry.asp | 3 - public/Default.asp | 36 +- run_site.cmd | 4 + 27 files changed, 1043 insertions(+), 4483 deletions(-) delete mode 100644 app/controllers/HouseholdController.asp delete mode 100644 app/controllers/HouseholderNameController.asp delete mode 100644 app/controllers/TerritoryController.asp delete mode 100644 app/models/HouseholderNamesRepository.asp delete mode 100644 app/models/HouseholdsRepository.asp delete mode 100644 app/models/POBO_HouseholderNames.asp delete mode 100644 app/models/POBO_Households.asp delete mode 100644 app/models/POBO_Territories.asp delete mode 100644 app/models/TerritoriesRepository.asp delete mode 100644 app/views/Household/create.asp delete mode 100644 app/views/Household/edit.asp delete mode 100644 app/views/Household/index.asp delete mode 100644 app/views/Household/show.asp delete mode 100644 app/views/HouseholderName/create.asp delete mode 100644 app/views/HouseholderName/edit.asp delete mode 100644 app/views/HouseholderName/index.asp delete mode 100644 app/views/HouseholderName/show.asp delete mode 100644 app/views/Territory/create.asp delete mode 100644 app/views/Territory/edit.asp delete mode 100644 app/views/Territory/index.asp delete mode 100644 app/views/Territory/show.asp create mode 100644 applicationhost.config create mode 100644 run_site.cmd diff --git a/app/controllers/HouseholdController.asp b/app/controllers/HouseholdController.asp deleted file mode 100644 index b0900a2..0000000 --- a/app/controllers/HouseholdController.asp +++ /dev/null @@ -1,397 +0,0 @@ -<% -' HouseholdController - CRUD controller for Households -' NorthTerritory app -' -' Dependencies: -' - app/models/POBO_Households.asp -' - app/models/HouseholdsRepository.asp -' - app/models/POBO_HouseholderNames.asp -' - app/models/HouseholderNamesRepository.asp -%> - - - - -<% - -Class HouseholdController_Class - Private m_useLayout - Private m_title - - ' Public properties for views - Public households ' LinkedList for Index - Public household ' Single POBO for Show/Edit - Public territoriesList ' For dropdown - Public territoryNamesById ' Dictionary for territory labels - Public householderNames ' LinkedList for Show - - ' Pagination properties - Public currentPage - Public pageCount - Public recordCount - Public perPage - Public searchTerm - Public filterTerritoryId - Public filterDoNotCall - - Private Sub Class_Initialize() - m_useLayout = True - m_title = "Households" - currentPage = 1 - pageCount = 0 - recordCount = 0 - perPage = 25 - searchTerm = "" - filterTerritoryId = 0 - filterDoNotCall = -1 - End Sub - - Public Property Get useLayout - useLayout = m_useLayout - End Property - - Public Property Let useLayout(v) - m_useLayout = v - End Property - - Public Property Get Title - Title = m_title - End Property - - Public Property Let Title(v) - m_title = v - End Property - - '------------------------------------------------------------------------------------------------------------------- - ' Index - List all households with pagination, search, and territory filter - '------------------------------------------------------------------------------------------------------------------- - Public Sub Index() - ' Get pagination params - If Request.QueryString("page") <> "" And IsNumeric(Request.QueryString("page")) Then - currentPage = CInt(Request.QueryString("page")) - If currentPage < 1 Then currentPage = 1 - End If - - ' Get search param - searchTerm = Trim(Request.QueryString("q") & "") - - ' Get territory filter - If Request.QueryString("territory") <> "" And IsNumeric(Request.QueryString("territory")) Then - filterTerritoryId = CInt(Request.QueryString("territory")) - End If - - If Request.QueryString("dnc") <> "" Then - If Request.QueryString("dnc") = "1" Then - filterDoNotCall = 1 - ElseIf Request.QueryString("dnc") = "0" Then - filterDoNotCall = 0 - End If - End If - - ' Load territories for filter dropdown - Set territoriesList = TerritoriesRepository.GetAll(Empty) - Set territoryNamesById = BuildTerritoryNamesById(territoriesList) - - ' Fetch households with pagination - If searchTerm <> "" And filterDoNotCall <> -1 Then - Set households = HouseholdsRepository.SearchTablePagedByDoNotCall( _ - Array("Address", "StreetName"), _ - searchTerm, _ - filterDoNotCall, _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - ElseIf searchTerm <> "" Then - ' Search in Address and StreetName columns - Set households = HouseholdsRepository.SearchTablePaged( _ - Array("Address", "StreetName"), _ - searchTerm, _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - ElseIf filterTerritoryId > 0 And filterDoNotCall <> -1 Then - Set households = HouseholdsRepository.FindPagedByTerritoryAndDoNotCall( _ - filterTerritoryId, _ - filterDoNotCall, _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - ElseIf filterTerritoryId > 0 Then - ' Filter by territory - Set households = HouseholdsRepository.FindPaged( _ - Array("TerritoryId", filterTerritoryId), _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - ElseIf filterDoNotCall <> -1 Then - Set households = HouseholdsRepository.FindPaged( _ - Array("DoNotCall", filterDoNotCall), _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - Else - Set households = HouseholdsRepository.FindPaged( _ - Empty, _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - End If - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Show - Display a single household - '------------------------------------------------------------------------------------------------------------------- - Public Sub Show(id) - On Error Resume Next - Set household = HouseholdsRepository.FindByID(id) - If Err.Number <> 0 Or household Is Nothing Then - On Error GoTo 0 - Flash().AddError "Household not found." - Response.Redirect "/households" - Exit Sub - End If - On Error GoTo 0 - - ' Load householder names for this household - Set householderNames = HouseholderNamesRepository.Find( _ - Array("HouseholdId", id), _ - "Name" _ - ) - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' MarkReturned - Quick action to mark a householder name as returned - '------------------------------------------------------------------------------------------------------------------- - Public Sub MarkReturned(id) - Dim householderId, hn, householdId - householderId = Request.Form("householder_id") - - If householderId = "" Or Not IsNumeric(householderId) Then - Flash().Error = "Invalid householder ID." - Response.Redirect "/households/" & id - Exit Sub - End If - - On Error Resume Next - Set hn = HouseholderNamesRepository.FindByID(CLng(householderId)) - If Err.Number <> 0 Or hn Is Nothing Then - On Error GoTo 0 - Flash().Error = "Householder name not found." - Response.Redirect "/households/" & id - Exit Sub - End If - On Error GoTo 0 - - ' Toggle the returned status - If hn.LetterReturned = 1 Then - hn.LetterReturned = 0 - hn.ReturnDate = #1/1/1970# - Else - hn.LetterReturned = 1 - hn.ReturnDate = Now() - End If - - HouseholderNamesRepository.Update hn - - If hn.LetterReturned = 1 Then - Flash().Success = "Marked as returned." - Else - Flash().Success = "Marked as not returned." - End If - Response.Redirect "/households/" & id - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Create - Display form for new household - '------------------------------------------------------------------------------------------------------------------- - Public Sub Create() - Set household = New POBO_Households - - ' Pre-fill territory if passed in query string - If Request.QueryString("territory") <> "" And IsNumeric(Request.QueryString("territory")) Then - household.TerritoryId = CInt(Request.QueryString("territory")) - End If - - ' Load territories for dropdown - Set territoriesList = TerritoriesRepository.GetAll(Empty) - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Store - Save new household - '------------------------------------------------------------------------------------------------------------------- - Public Sub Store() - Set household = New POBO_Households - household.Address = Trim(Request.Form("Address")) - household.StreetNumber = Request.Form("StreetNumber") - household.StreetName = Trim(Request.Form("StreetName")) - household.Latitude = Trim(Request.Form("Latitude")) - household.Longitude = Trim(Request.Form("Longitude")) - household.IsBusiness = IIf(Request.Form("IsBusiness") = "1", 1, 0) - household.DoNotCall = IIf(Request.Form("DoNotCall") = "1", 1, 0) - household.DoNotCallNotes = Trim(Request.Form("DoNotCallNotes")) - household.DoNotCallPrivateNotes = Trim(Request.Form("DoNotCallPrivateNotes")) - household.TerritoryId = Request.Form("TerritoryId") - - If Request.Form("DoNotCallDate") <> "" Then - household.DoNotCallDate = CDate(Request.Form("DoNotCallDate")) - ElseIf household.DoNotCall = 1 Then - household.DoNotCallDate = Date() - Else - household.DoNotCallDate = Null - End If - - ' Validation - If household.Address = "" Then - Flash().AddError "Address is required." - Response.Redirect "/households/new" - Exit Sub - End If - - If Not IsNumeric(household.TerritoryId) Or CInt(household.TerritoryId) < 1 Then - Flash().AddError "Please select a territory." - Response.Redirect "/households/new" - Exit Sub - End If - - HouseholdsRepository.AddNew household - - Flash().Success = "Household created successfully." - Response.Redirect "/households/" & household.Id - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Edit - Display form to edit household - '------------------------------------------------------------------------------------------------------------------- - Public Sub Edit(id) - On Error Resume Next - Set household = HouseholdsRepository.FindByID(id) - If Err.Number <> 0 Or household Is Nothing Then - On Error GoTo 0 - Flash().AddError "Household not found." - Response.Redirect "/households" - Exit Sub - End If - On Error GoTo 0 - - ' Load territories for dropdown - Set territoriesList = TerritoriesRepository.GetAll(Empty) - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Update - Save changes to household - '------------------------------------------------------------------------------------------------------------------- - Public Sub Update(id) - On Error Resume Next - Set household = HouseholdsRepository.FindByID(id) - If Err.Number <> 0 Or household Is Nothing Then - On Error GoTo 0 - Flash().AddError "Household not found." - Response.Redirect "/households" - Exit Sub - End If - On Error GoTo 0 - - household.Address = Trim(Request.Form("Address")) - household.StreetNumber = Request.Form("StreetNumber") - household.StreetName = Trim(Request.Form("StreetName")) - household.Latitude = Trim(Request.Form("Latitude")) - household.Longitude = Trim(Request.Form("Longitude")) - household.IsBusiness = IIf(Request.Form("IsBusiness") = "1", 1, 0) - household.DoNotCall = IIf(Request.Form("DoNotCall") = "1", 1, 0) - household.DoNotCallNotes = Trim(Request.Form("DoNotCallNotes")) - household.DoNotCallPrivateNotes = Trim(Request.Form("DoNotCallPrivateNotes")) - household.TerritoryId = Request.Form("TerritoryId") - - If Request.Form("DoNotCallDate") <> "" Then - household.DoNotCallDate = CDate(Request.Form("DoNotCallDate")) - ElseIf household.DoNotCall = 1 Then - If IsNull(household.DoNotCallDate) Then - household.DoNotCallDate = Date() - ElseIf Trim(CStr(household.DoNotCallDate)) = "" Then - household.DoNotCallDate = Date() - End If - Else - household.DoNotCallDate = Null - End If - - ' Validation - If household.Address = "" Then - Flash().AddError "Address is required." - Response.Redirect "/households/" & id & "/edit" - Exit Sub - End If - - HouseholdsRepository.Update household - - Flash().Success = "Household updated successfully." - Response.Redirect "/households/" & id - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Delete - Remove a household - '------------------------------------------------------------------------------------------------------------------- - Public Sub Delete(id) - On Error Resume Next - Set household = HouseholdsRepository.FindByID(id) - If Err.Number <> 0 Or household Is Nothing Then - On Error GoTo 0 - Flash().AddError "Household not found." - Response.Redirect "/households" - Exit Sub - End If - On Error GoTo 0 - - HouseholdsRepository.Delete id - - Flash().Success = "Household deleted successfully." - Response.Redirect "/households" - End Sub - - Private Function BuildTerritoryNamesById(territories) - Dim dict : Set dict = Server.CreateObject("Scripting.Dictionary") - Dim iter, territory - Set iter = territories.Iterator() - Do While iter.HasNext() - Set territory = iter.GetNext() - dict(CStr(territory.Id)) = territory.Name & "" - Loop - Set BuildTerritoryNamesById = dict - End Function - -End Class - -' Singleton instance -Dim HouseholdController_Class__Singleton -Function HouseholdController() - If IsEmpty(HouseholdController_Class__Singleton) Then - Set HouseholdController_Class__Singleton = New HouseholdController_Class - End If - Set HouseholdController = HouseholdController_Class__Singleton -End Function -%> diff --git a/app/controllers/HouseholderNameController.asp b/app/controllers/HouseholderNameController.asp deleted file mode 100644 index 16672f2..0000000 --- a/app/controllers/HouseholderNameController.asp +++ /dev/null @@ -1,284 +0,0 @@ -<% -' HouseholderNameController - CRUD controller for HouseholderNames -' NorthTerritory app -' -' Dependencies (all included via HouseholdController which loads first): -' - app/models/POBO_HouseholderNames.asp -' - app/models/HouseholderNamesRepository.asp -' - app/models/POBO_Households.asp -' - app/models/HouseholdsRepository.asp - -Class HouseholderNameController_Class - Private m_useLayout - Private m_title - - ' Public properties for views - Public householderNames ' LinkedList for Index - Public householderName ' Single POBO for Show/Edit - Public household ' Parent household - Public householdsList ' For dropdown - - ' Pagination properties - Public currentPage - Public pageCount - Public recordCount - Public perPage - Public searchTerm - Public filterHouseholdId - - Private Sub Class_Initialize() - m_useLayout = True - m_title = "Householder Names" - currentPage = 1 - pageCount = 0 - recordCount = 0 - perPage = 25 - searchTerm = "" - filterHouseholdId = 0 - End Sub - - Public Property Get useLayout - useLayout = m_useLayout - End Property - - Public Property Let useLayout(v) - m_useLayout = v - End Property - - Public Property Get Title - Title = m_title - End Property - - Public Property Let Title(v) - m_title = v - End Property - - '------------------------------------------------------------------------------------------------------------------- - ' Index - List all householder names with pagination, search, and household filter - '------------------------------------------------------------------------------------------------------------------- - Public Sub Index() - ' Get pagination params - If Request.QueryString("page") <> "" And IsNumeric(Request.QueryString("page")) Then - currentPage = CInt(Request.QueryString("page")) - If currentPage < 1 Then currentPage = 1 - End If - - ' Get search param - searchTerm = Trim(Request.QueryString("q") & "") - - ' Get household filter - If Request.QueryString("household") <> "" And IsNumeric(Request.QueryString("household")) Then - filterHouseholdId = CLng(Request.QueryString("household")) - End If - - ' Fetch householder names with pagination - If searchTerm <> "" Then - ' Search in Name column - Set householderNames = HouseholderNamesRepository.SearchTablePaged( _ - Array("Name"), _ - searchTerm, _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - ElseIf filterHouseholdId > 0 Then - ' Filter by household - Set householderNames = HouseholderNamesRepository.FindPaged( _ - Array("HouseholdId", filterHouseholdId), _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - ' Load parent household for context - On Error Resume Next - Set household = HouseholdsRepository.FindByID(filterHouseholdId) - On Error GoTo 0 - Else - Set householderNames = HouseholderNamesRepository.FindPaged( _ - Empty, _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - End If - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Show - Display a single householder name - '------------------------------------------------------------------------------------------------------------------- - Public Sub Show(id) - On Error Resume Next - Set householderName = HouseholderNamesRepository.FindByID(id) - If Err.Number <> 0 Or householderName Is Nothing Then - On Error GoTo 0 - Flash().Error = "Householder name not found." - Response.Redirect "/householder-names" - Exit Sub - End If - On Error GoTo 0 - - ' Load parent household - On Error Resume Next - Set household = HouseholdsRepository.FindByID(householderName.HouseholdId) - On Error GoTo 0 - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Create - Display form for new householder name - '------------------------------------------------------------------------------------------------------------------- - Public Sub Create() - Set householderName = New POBO_HouseholderNames - householderName.Created = Now() - householderName.LetterReturned = 0 - - ' Pre-fill household if passed in query string - If Request.QueryString("household") <> "" And IsNumeric(Request.QueryString("household")) Then - householderName.HouseholdId = CLng(Request.QueryString("household")) - ' Load parent household for context - On Error Resume Next - Set household = HouseholdsRepository.FindByID(householderName.HouseholdId) - On Error GoTo 0 - End If - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Store - Save new householder name - '------------------------------------------------------------------------------------------------------------------- - Public Sub Store() - Set householderName = New POBO_HouseholderNames - householderName.Name = Trim(Request.Form("Name")) - householderName.HouseholdId = Request.Form("HouseholdId") - householderName.LetterReturned = IIf(Request.Form("LetterReturned") = "1", 1, 0) - householderName.Created = Now() - - If Request.Form("ReturnDate") <> "" Then - On Error Resume Next - householderName.ReturnDate = CDate(Request.Form("ReturnDate")) - On Error GoTo 0 - End If - - ' Validation - If householderName.Name = "" Then - Flash().Error = "Name is required." - Response.Redirect "/householder-names/new?household=" & householderName.HouseholdId - Exit Sub - End If - - If Not IsNumeric(householderName.HouseholdId) Or CLng(householderName.HouseholdId) < 1 Then - Flash().Error = "Please select a household." - Response.Redirect "/householder-names/new" - Exit Sub - End If - - HouseholderNamesRepository.AddNew householderName - - Flash().Success = "Householder name created successfully." - Response.Redirect "/householder-names/" & householderName.Id - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Edit - Display form to edit householder name - '------------------------------------------------------------------------------------------------------------------- - Public Sub Edit(id) - On Error Resume Next - Set householderName = HouseholderNamesRepository.FindByID(id) - If Err.Number <> 0 Or householderName Is Nothing Then - On Error GoTo 0 - Flash().Error = "Householder name not found." - Response.Redirect "/householder-names" - Exit Sub - End If - On Error GoTo 0 - - ' Load parent household for context - On Error Resume Next - Set household = HouseholdsRepository.FindByID(householderName.HouseholdId) - On Error GoTo 0 - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Update - Save changes to householder name - '------------------------------------------------------------------------------------------------------------------- - Public Sub Update(id) - On Error Resume Next - Set householderName = HouseholderNamesRepository.FindByID(id) - If Err.Number <> 0 Or householderName Is Nothing Then - On Error GoTo 0 - Flash().Error = "Householder name not found." - Response.Redirect "/householder-names" - Exit Sub - End If - On Error GoTo 0 - - householderName.Name = Trim(Request.Form("Name")) - householderName.LetterReturned = IIf(Request.Form("LetterReturned") = "1", 1, 0) - - If Request.Form("ReturnDate") <> "" Then - On Error Resume Next - householderName.ReturnDate = CDate(Request.Form("ReturnDate")) - On Error GoTo 0 - Else - householderName.ReturnDate = #1/1/1970# - End If - - ' Validation - If householderName.Name = "" Then - Flash().Error = "Name is required." - Response.Redirect "/householder-names/" & id & "/edit" - Exit Sub - End If - - HouseholderNamesRepository.Update householderName - - Flash().Success = "Householder name updated successfully." - Response.Redirect "/householder-names/" & id - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Delete - Remove a householder name - '------------------------------------------------------------------------------------------------------------------- - Public Sub Delete(id) - On Error Resume Next - Set householderName = HouseholderNamesRepository.FindByID(id) - If Err.Number <> 0 Or householderName Is Nothing Then - On Error GoTo 0 - Flash().Error = "Householder name not found." - Response.Redirect "/householder-names" - Exit Sub - End If - On Error GoTo 0 - - Dim householdId - householdId = householderName.HouseholdId - - HouseholderNamesRepository.Delete id - - Flash().Success = "Householder name deleted successfully." - Response.Redirect "/householder-names?household=" & householdId - End Sub - -End Class - -' Singleton instance -Dim HouseholderNameController_Class__Singleton -Function HouseholderNameController() - If IsEmpty(HouseholderNameController_Class__Singleton) Then - Set HouseholderNameController_Class__Singleton = New HouseholderNameController_Class - End If - Set HouseholderNameController = HouseholderNameController_Class__Singleton -End Function -%> diff --git a/app/controllers/TerritoryController.asp b/app/controllers/TerritoryController.asp deleted file mode 100644 index 54a02a1..0000000 --- a/app/controllers/TerritoryController.asp +++ /dev/null @@ -1,226 +0,0 @@ -<% -' TerritoryController - CRUD controller for Territories -' Generated for NorthTerritory app -' -' Dependencies: -' - app/models/POBO_Territories.asp -' - app/models/TerritoriesRepository.asp -%> - - -<% - -Class TerritoryController_Class - Private m_useLayout - Private m_title - - ' Public properties for views - Public territories ' LinkedList for Index - Public territory ' Single POBO for Show/Edit - Public territoryHouseholdCounts - Public territoryStreets ' LinkedList of street names for Show - - ' Pagination properties - Public currentPage - Public pageCount - Public recordCount - Public perPage - Public searchTerm - - Private Sub Class_Initialize() - m_useLayout = True - m_title = "Territories" - currentPage = 1 - pageCount = 0 - recordCount = 0 - perPage = 20 - searchTerm = "" - Set territoryHouseholdCounts = Nothing - End Sub - - Public Property Get useLayout - useLayout = m_useLayout - End Property - - Public Property Let useLayout(v) - m_useLayout = v - End Property - - Public Property Get Title - Title = m_title - End Property - - Public Property Let Title(v) - m_title = v - End Property - - '------------------------------------------------------------------------------------------------------------------- - ' Index - List all territories with pagination and search - '------------------------------------------------------------------------------------------------------------------- - Public Sub Index() - ' Get pagination params - If Request.QueryString("page") <> "" And IsNumeric(Request.QueryString("page")) Then - currentPage = CInt(Request.QueryString("page")) - If currentPage < 1 Then currentPage = 1 - End If - - ' Get search param - searchTerm = Trim(Request.QueryString("q") & "") - - ' Fetch territories with pagination - If searchTerm <> "" Then - ' Search in Name and Description columns - Set territories = TerritoriesRepository.SearchTablePaged( _ - Array("Name", "Description"), _ - searchTerm, _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - Else - Set territories = TerritoriesRepository.FindPaged( _ - Empty, _ - Empty, _ - perPage, _ - currentPage, _ - pageCount, _ - recordCount _ - ) - End If - - Set territoryHouseholdCounts = HouseholdsRepository.GetCountsByTerritory() - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Show - Display a single territory - '------------------------------------------------------------------------------------------------------------------- - Public Sub Show(id) - On Error Resume Next - Set territory = TerritoriesRepository.FindByID(id) - If Err.Number <> 0 Or territory Is Nothing Then - On Error GoTo 0 - Flash().AddError "Territory not found." - Response.Redirect "/territories" - Exit Sub - End If - On Error GoTo 0 - - ' Load distinct street names for this territory - Set territoryStreets = HouseholdsRepository.GetDistinctStreetsByTerritory(id) - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Create - Display form for new territory - '------------------------------------------------------------------------------------------------------------------- - Public Sub Create() - Set territory = New POBO_Territories - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Store - Save new territory - '------------------------------------------------------------------------------------------------------------------- - Public Sub Store() - Set territory = New POBO_Territories - territory.Name = Trim(Request.Form("Name")) - territory.Description = Trim(Request.Form("Description")) - territory.Coordinates = Trim(Request.Form("Coordinates")) - - ' Validation - If territory.Name = "" Then - Flash().AddError "Name is required." - Response.Redirect "/territories/new" - Exit Sub - End If - - TerritoriesRepository.AddNew territory - - Flash().Success = "Territory created successfully." - Response.Redirect "/territories/" & territory.Id - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Edit - Display form to edit territory - '------------------------------------------------------------------------------------------------------------------- - Public Sub Edit(id) - On Error Resume Next - Set territory = TerritoriesRepository.FindByID(id) - If Err.Number <> 0 Or territory Is Nothing Then - On Error GoTo 0 - Flash().AddError "Territory not found." - Response.Redirect "/territories" - Exit Sub - End If - On Error GoTo 0 - - %> <% - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Update - Save changes to territory - '------------------------------------------------------------------------------------------------------------------- - Public Sub Update(id) - On Error Resume Next - Set territory = TerritoriesRepository.FindByID(id) - If Err.Number <> 0 Or territory Is Nothing Then - On Error GoTo 0 - Flash().AddError "Territory not found." - Response.Redirect "/territories" - Exit Sub - End If - On Error GoTo 0 - - territory.Name = Trim(Request.Form("Name")) - territory.Description = Trim(Request.Form("Description")) - territory.Coordinates = Trim(Request.Form("Coordinates")) - - ' Validation - If territory.Name = "" Then - Flash().AddError "Name is required." - Response.Redirect "/territories/" & id & "/edit" - Exit Sub - End If - - TerritoriesRepository.Update territory - - Flash().Success = "Territory updated successfully." - Response.Redirect "/territories/" & id - End Sub - - '------------------------------------------------------------------------------------------------------------------- - ' Delete - Remove a territory - '------------------------------------------------------------------------------------------------------------------- - Public Sub Delete(id) - On Error Resume Next - Set territory = TerritoriesRepository.FindByID(id) - If Err.Number <> 0 Or territory Is Nothing Then - On Error GoTo 0 - Flash().AddError "Territory not found." - Response.Redirect "/territories" - Exit Sub - End If - On Error GoTo 0 - - TerritoriesRepository.Delete id - - Flash().Success = "Territory deleted successfully." - Response.Redirect "/territories" - End Sub - -End Class - -' Singleton instance -Dim TerritoryController_Class__Singleton -Function TerritoryController() - If IsEmpty(TerritoryController_Class__Singleton) Then - Set TerritoryController_Class__Singleton = New TerritoryController_Class - End If - Set TerritoryController = TerritoryController_Class__Singleton -End Function -%> diff --git a/app/controllers/autoload_controllers.asp b/app/controllers/autoload_controllers.asp index 671990b..425e8a9 100644 --- a/app/controllers/autoload_controllers.asp +++ b/app/controllers/autoload_controllers.asp @@ -1,5 +1,2 @@ - - - - \ No newline at end of file + \ No newline at end of file diff --git a/app/models/HouseholderNamesRepository.asp b/app/models/HouseholderNamesRepository.asp deleted file mode 100644 index d625bc9..0000000 --- a/app/models/HouseholderNamesRepository.asp +++ /dev/null @@ -1,176 +0,0 @@ -<% -' Auto-generated Repository for table [HouseholderNames] -' Generated on 1/17/2026 7:59:02 PM -' Generator: GenerateRepo.vbs v1.0 -' -' Dependencies: -' - core/lib.DAL.asp (DAL singleton for database access) -' - core/lib.AutoMapper.asp (Automapper for object mapping) -' - core/lib.Collections.asp (LinkedList_Class) -' - core/lib.helpers.asp (KVUnzip, BuildOrderBy, QI, Destroy) - - -Class HouseholderNamesRepository_Class - - Public Function FindByID(id) - Dim sql : sql = "Select [Created], [HouseholdId], [Id], [LetterReturned], [Name], [ReturnDate] FROM [HouseholderNames] WHERE [Id] = ?" - Dim rs : Set rs = DAL.Query(sql, Array(id)) - If rs.EOF Then - Err.Raise 1, "HouseholderNamesRepository_Class", RecordNotFoundException("Id", id) - Else - Set FindByID = Automapper.AutoMap(rs, "POBO_HouseholderNames") - End If - Destroy rs - End Function - - Public Function GetAll(orderBy) - Set GetAll = Find(Empty, orderBy) - End Function - - Public Function Find(where_kvarray, order_string_or_array) - Dim sql : sql = "Select [Created], [HouseholdId], [Id], [LetterReturned], [Name], [ReturnDate] FROM [HouseholderNames]" - Dim where_keys, where_values, i - If Not IsEmpty(where_kvarray) Then - KVUnzip where_kvarray, where_keys, where_values - If Not IsEmpty(where_keys) Then - sql = sql & " WHERE " - For i = 0 To UBound(where_keys) - If i > 0 Then sql = sql & " AND " - sql = sql & " " & QI(where_keys(i)) & " = ?" - Next - End If - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.Query(sql, where_values) - Dim list : Set list = new LinkedList_Class - Do Until rs.EOF - list.Push Automapper.AutoMap(rs, "POBO_HouseholderNames") - rs.MoveNext - Loop - Set Find = list - Destroy rs - End Function - - Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [Created], [HouseholdId], [Id], [LetterReturned], [Name], [ReturnDate] FROM [HouseholderNames]" - Dim where_keys, where_values, i - If Not IsEmpty(where_kvarray) Then - KVUnzip where_kvarray, where_keys, where_values - If Not IsEmpty(where_keys) Then - sql = sql & " WHERE " - For i = 0 To UBound(where_keys) - If i > 0 Then sql = sql & " AND " - sql = sql & " " & QI(where_keys(i)) & " = ?" - Next - End If - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.PagedQuery(sql, where_values, per_page, page_num) - If Not rs.EOF Then - rs.PageSize = per_page - rs.AbsolutePage = page_num - page_count = rs.PageCount - record_count = rs.RecordCount - End If - Set FindPaged = PagedList(rs, per_page) - Destroy rs - End Function - - Public Function SearchTablePaged(columns_array, search_value, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [Created], [HouseholdId], [Id], [LetterReturned], [Name], [ReturnDate] FROM [HouseholderNames]" - Dim i, params() - If IsArray(columns_array) And UBound(columns_array) >= 0 Then - sql = sql & " WHERE " - ReDim params(UBound(columns_array)) - For i = 0 To UBound(columns_array) - If i > 0 Then sql = sql & " OR " - sql = sql & " " & QI(columns_array(i)) & " LIKE ?" - params(i) = "%" & search_value & "%" - Next - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.PagedQuery(sql, params, per_page, page_num) - If Not rs.EOF Then - rs.PageSize = per_page - rs.AbsolutePage = page_num - page_count = rs.PageCount - record_count = rs.RecordCount - End If - Set SearchTablePaged = PagedList(rs, per_page) - Destroy rs - End Function - - Private Function PagedList(rs, per_page) - Dim list : Set list = new LinkedList_Class - Dim x : x = 0 - Do While (per_page <= 0 Or x < per_page) And Not rs.EOF - list.Push Automapper.AutoMap(rs, "POBO_HouseholderNames") - x = x + 1 - rs.MoveNext - Loop - Set PagedList = list - End Function - - Public Sub AddNew(ByRef model) - Dim sql : sql = "INSERT INTO [HouseholderNames] ([Created], [HouseholdId], [LetterReturned], [Name], [ReturnDate]) VALUES (?, ?, ?, ?, ?)" - DAL.[Execute] sql, Array(model.Created, model.HouseholdId, model.LetterReturned, model.Name, model.ReturnDate) - - ' Retrieve the newly inserted ID - On Error Resume Next - Dim rsId : Set rsId = DAL.Query("SELECT @@IDENTITY AS NewID", Empty) - If Err.Number <> 0 Then - ' Fallback for Access databases - Err.Clear - Set rsId = DAL.Query("SELECT TOP 1 [Id] FROM [HouseholderNames] ORDER BY [Id] DESC", Empty) - End If - On Error GoTo 0 - - If Not rsId.EOF Then - If Not IsNull(rsId(0)) Then model.Id = rsId(0) - End If - Destroy rsId - End Sub - - Public Sub Update(model) - Dim sql : sql = "UPDATE [HouseholderNames] SET [Created] = ?, [HouseholdId] = ?, [LetterReturned] = ?, [Name] = ?, [ReturnDate] = ? WHERE [Id] = ?" - DAL.[Execute] sql, Array(model.Created, model.HouseholdId, model.LetterReturned, model.Name, model.ReturnDate, model.Id) - End Sub - - Public Sub Delete(id) - Dim sql : sql = "DELETE FROM [HouseholderNames] WHERE [Id] = ?" - DAL.[Execute] sql, Array(id) - End Sub - - Private Function RecordNotFoundException(ByVal field_name, ByVal field_val) - RecordNotFoundException = "HouseholderNames record was not found with " & field_name & " = '" & field_val & "'." - End Function - - Private Function QI(name) - QI = "[" & Replace(CStr(name), "]", "]]") & "]" - End Function - - Private Function BuildOrderBy(orderArg, defaultCol) - Dim s : s = "" - If IsEmpty(orderArg) Or IsNull(orderArg) Or orderArg = "" Then - s = " ORDER BY " & defaultCol & " ASC" - ElseIf IsArray(orderArg) Then - Dim i : s = " ORDER BY " - For i = 0 To UBound(orderArg) - If i > 0 Then s = s & ", " - s = s & QI(orderArg(i)) - Next - Else - s = " ORDER BY " & QI(orderArg) - End If - BuildOrderBy = s - End Function -End Class - -Dim HouseholderNamesRepository__Singleton -Function HouseholderNamesRepository() - If IsEmpty(HouseholderNamesRepository__Singleton) Then - Set HouseholderNamesRepository__Singleton = new HouseholderNamesRepository_Class - End If - Set HouseholderNamesRepository = HouseholderNamesRepository__Singleton -End Function -%> diff --git a/app/models/HouseholdsRepository.asp b/app/models/HouseholdsRepository.asp deleted file mode 100644 index 9da2b2a..0000000 --- a/app/models/HouseholdsRepository.asp +++ /dev/null @@ -1,243 +0,0 @@ -<% -' Auto-generated Repository for table [Households] -' Generator: GenerateRepo.vbs v1.0 -' -' Dependencies: -' - core/lib.DAL.asp (DAL singleton for database access) -' - core/lib.AutoMapper.asp (Automapper for object mapping) -' - core/lib.Collections.asp (LinkedList_Class) -' - core/lib.helpers.asp (KVUnzip, BuildOrderBy, QI, Destroy) - - -Class HouseholdsRepository_Class - - Public Function FindByID(id) - Dim sql : sql = "Select [Address], [DoNotCall], [DoNotCallDate], [DoNotCallNotes], [DoNotCallPrivateNotes], [Id], [IsBusiness], [Latitude], [Longitude], [StreetName], [StreetNumber], [TerritoryId] FROM [Households] WHERE [Id] = ?" - Dim rs : Set rs = DAL.Query(sql, Array(id)) - If rs.EOF Then - Err.Raise 1, "HouseholdsRepository_Class", RecordNotFoundException("Id", id) - Else - Set FindByID = Automapper.AutoMap(rs, "POBO_Households") - End If - Destroy rs - End Function - - Public Function GetAll(orderBy) - Set GetAll = Find(Empty, orderBy) - End Function - - Public Function Find(where_kvarray, order_string_or_array) - Dim sql : sql = "Select [Address], [DoNotCall], [DoNotCallDate], [DoNotCallNotes], [DoNotCallPrivateNotes], [Id], [IsBusiness], [Latitude], [Longitude], [StreetName], [StreetNumber], [TerritoryId] FROM [Households]" - Dim where_keys, where_values, i - If Not IsEmpty(where_kvarray) Then - KVUnzip where_kvarray, where_keys, where_values - If Not IsEmpty(where_keys) Then - sql = sql & " WHERE " - For i = 0 To UBound(where_keys) - If i > 0 Then sql = sql & " AND " - sql = sql & " " & QI(where_keys(i)) & " = ?" - Next - End If - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.Query(sql, where_values) - Dim list : Set list = new LinkedList_Class - Do Until rs.EOF - list.Push Automapper.AutoMap(rs, "POBO_Households") - rs.MoveNext - Loop - Set Find = list - Destroy rs - End Function - - Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [Address], [DoNotCall], [DoNotCallDate], [DoNotCallNotes], [DoNotCallPrivateNotes], [Id], [IsBusiness], [Latitude], [Longitude], [StreetName], [StreetNumber], [TerritoryId] FROM [Households]" - Dim where_keys, where_values, i - If Not IsEmpty(where_kvarray) Then - KVUnzip where_kvarray, where_keys, where_values - If Not IsEmpty(where_keys) Then - sql = sql & " WHERE " - For i = 0 To UBound(where_keys) - If i > 0 Then sql = sql & " AND " - sql = sql & " " & QI(where_keys(i)) & " = ?" - Next - End If - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.PagedQuery(sql, where_values, per_page, page_num) - If Not rs.EOF Then - rs.PageSize = per_page - rs.AbsolutePage = page_num - page_count = rs.PageCount - record_count = rs.RecordCount - End If - Set FindPaged = PagedList(rs, per_page) - Destroy rs - End Function - - Public Function SearchTablePaged(columns_array, search_value, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [Address], [DoNotCall], [DoNotCallDate], [DoNotCallNotes], [DoNotCallPrivateNotes], [Id], [IsBusiness], [Latitude], [Longitude], [StreetName], [StreetNumber], [TerritoryId] FROM [Households]" - Dim i, params() - If IsArray(columns_array) And UBound(columns_array) >= 0 Then - sql = sql & " WHERE " - ReDim params(UBound(columns_array)) - For i = 0 To UBound(columns_array) - If i > 0 Then sql = sql & " OR " - sql = sql & " " & QI(columns_array(i)) & " LIKE ?" - params(i) = "%" & search_value & "%" - Next - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.PagedQuery(sql, params, per_page, page_num) - If Not rs.EOF Then - rs.PageSize = per_page - rs.AbsolutePage = page_num - page_count = rs.PageCount - record_count = rs.RecordCount - End If - Set SearchTablePaged = PagedList(rs, per_page) - Destroy rs - End Function - - Public Function SearchTablePagedByDoNotCall(columns_array, search_value, doNotCallValue, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [Address], [DoNotCall], [DoNotCallDate], [DoNotCallNotes], [DoNotCallPrivateNotes], [Id], [IsBusiness], [Latitude], [Longitude], [StreetName], [StreetNumber], [TerritoryId] FROM [Households] WHERE [DoNotCall] = ?" - Dim i, params() - If IsArray(columns_array) And UBound(columns_array) >= 0 Then - ReDim params(UBound(columns_array) + 1) - params(0) = doNotCallValue - sql = sql & " AND (" - For i = 0 To UBound(columns_array) - If i > 0 Then sql = sql & " OR " - sql = sql & " " & QI(columns_array(i)) & " LIKE ?" - params(i + 1) = "%" & search_value & "%" - Next - sql = sql & ")" - Else - ReDim params(0) - params(0) = doNotCallValue - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.PagedQuery(sql, params, per_page, page_num) - If Not rs.EOF Then - rs.PageSize = per_page - rs.AbsolutePage = page_num - page_count = rs.PageCount - record_count = rs.RecordCount - End If - Set SearchTablePagedByDoNotCall = PagedList(rs, per_page) - Destroy rs - End Function - - Public Function FindPagedByTerritoryAndDoNotCall(territoryId, doNotCallValue, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [Address], [DoNotCall], [DoNotCallDate], [DoNotCallNotes], [DoNotCallPrivateNotes], [Id], [IsBusiness], [Latitude], [Longitude], [StreetName], [StreetNumber], [TerritoryId] FROM [Households] WHERE [TerritoryId] = ? AND [DoNotCall] = ?" - Dim rs : Set rs = DAL.PagedQuery(sql & BuildOrderBy(order_string_or_array, "[Id]"), Array(territoryId, doNotCallValue), per_page, page_num) - If Not rs.EOF Then - rs.PageSize = per_page - rs.AbsolutePage = page_num - page_count = rs.PageCount - record_count = rs.RecordCount - End If - Set FindPagedByTerritoryAndDoNotCall = PagedList(rs, per_page) - Destroy rs - End Function - - Private Function PagedList(rs, per_page) - Dim list : Set list = new LinkedList_Class - Dim x : x = 0 - Do While (per_page <= 0 Or x < per_page) And Not rs.EOF - list.Push Automapper.AutoMap(rs, "POBO_Households") - x = x + 1 - rs.MoveNext - Loop - Set PagedList = list - End Function - - Public Function GetCountsByTerritory() - Dim sql : sql = "SELECT [TerritoryId], COUNT(*) AS [HouseholdCount] FROM [Households] GROUP BY [TerritoryId]" - Dim rs : Set rs = DAL.Query(sql, Empty) - Dim dict : Set dict = Server.CreateObject("Scripting.Dictionary") - Do Until rs.EOF - If Not IsNull(rs("TerritoryId")) Then - dict(CLng(rs("TerritoryId"))) = CLng(rs("HouseholdCount")) - End If - rs.MoveNext - Loop - Set GetCountsByTerritory = dict - Destroy rs - End Function - - Public Function GetDistinctStreetsByTerritory(territoryId) - Dim sql : sql = "SELECT DISTINCT [StreetName] FROM [Households] WHERE [TerritoryId] = ? AND [StreetName] IS NOT NULL AND [StreetName] <> '' ORDER BY [StreetName]" - Dim rs : Set rs = DAL.Query(sql, Array(territoryId)) - Dim list : Set list = new LinkedList_Class - Do Until rs.EOF - list.Push rs("StreetName") & "" - rs.MoveNext - Loop - Set GetDistinctStreetsByTerritory = list - Destroy rs - End Function - - Public Sub AddNew(ByRef model) - Dim sql : sql = "INSERT INTO [Households] ([Address], [DoNotCall], [DoNotCallDate], [DoNotCallNotes], [DoNotCallPrivateNotes], [IsBusiness], [Latitude], [Longitude], [StreetName], [StreetNumber], [TerritoryId]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" - DAL.[Execute] sql, Array(model.Address, model.DoNotCall, model.DoNotCallDate, model.DoNotCallNotes, model.DoNotCallPrivateNotes, model.IsBusiness, model.Latitude, model.Longitude, model.StreetName, model.StreetNumber, model.TerritoryId) - - ' Retrieve the newly inserted ID - On Error Resume Next - Dim rsId : Set rsId = DAL.Query("SELECT @@IDENTITY AS NewID", Empty) - If Err.Number <> 0 Then - ' Fallback for Access databases - Err.Clear - Set rsId = DAL.Query("SELECT TOP 1 [Id] FROM [Households] ORDER BY [Id] DESC", Empty) - End If - On Error GoTo 0 - - If Not rsId.EOF Then - If Not IsNull(rsId(0)) Then model.Id = rsId(0) - End If - Destroy rsId - End Sub - - Public Sub Update(model) - Dim sql : sql = "UPDATE [Households] SET [Address] = ?, [DoNotCall] = ?, [DoNotCallDate] = ?, [DoNotCallNotes] = ?, [DoNotCallPrivateNotes] = ?, [IsBusiness] = ?, [Latitude] = ?, [Longitude] = ?, [StreetName] = ?, [StreetNumber] = ?, [TerritoryId] = ? WHERE [Id] = ?" - DAL.[Execute] sql, Array(model.Address, model.DoNotCall, model.DoNotCallDate, model.DoNotCallNotes, model.DoNotCallPrivateNotes, model.IsBusiness, model.Latitude, model.Longitude, model.StreetName, model.StreetNumber, model.TerritoryId, model.Id) - End Sub - - Public Sub Delete(id) - Dim sql : sql = "DELETE FROM [Households] WHERE [Id] = ?" - DAL.[Execute] sql, Array(id) - End Sub - - Private Function RecordNotFoundException(ByVal field_name, ByVal field_val) - RecordNotFoundException = "Households record was not found with " & field_name & " = '" & field_val & "'." - End Function - - Private Function QI(name) - QI = "[" & Replace(CStr(name), "]", "]]") & "]" - End Function - - Private Function BuildOrderBy(orderArg, defaultCol) - Dim s : s = "" - If IsEmpty(orderArg) Or IsNull(orderArg) Or orderArg = "" Then - s = " ORDER BY " & defaultCol & " ASC" - ElseIf IsArray(orderArg) Then - Dim i : s = " ORDER BY " - For i = 0 To UBound(orderArg) - If i > 0 Then s = s & ", " - s = s & QI(orderArg(i)) - Next - Else - s = " ORDER BY " & QI(orderArg) - End If - BuildOrderBy = s - End Function -End Class - -Dim HouseholdsRepository__Singleton -Function HouseholdsRepository() - If IsEmpty(HouseholdsRepository__Singleton) Then - Set HouseholdsRepository__Singleton = new HouseholdsRepository_Class - End If - Set HouseholdsRepository = HouseholdsRepository__Singleton -End Function -%> diff --git a/app/models/POBO_HouseholderNames.asp b/app/models/POBO_HouseholderNames.asp deleted file mode 100644 index f3d91bf..0000000 --- a/app/models/POBO_HouseholderNames.asp +++ /dev/null @@ -1,133 +0,0 @@ -<% -' Auto-generated POBO for table [HouseholderNames] -' Generated on 1/17/2026 7:59:02 PM -' Generator: GenerateRepo.vbs v1.0 -' -' Dependencies: core/helpers.asp (QuoteValue function) - - -Class POBO_HouseholderNames - ' Public array of all property names - Public Properties - - Private pCreated - Private pHouseholdId - Private pId - Private pLetterReturned - Private pName - Private pReturnDate - - Private Sub Class_Initialize() - pCreated = #1/1/1970# - pHouseholdId = 0 - pId = 0 - pLetterReturned = 0 - pName = Null - pReturnDate = #1/1/1970# - Properties = Array("Created","HouseholdId","Id","LetterReturned","Name","ReturnDate") - End Sub - - Public Property Get PrimaryKey() - PrimaryKey = "Id" - End Property - - Public Property Get TableName() - TableName = "HouseholderNames" - End Property - - Public Property Get Created() - Created = pCreated - End Property - - Public Property Let Created(val) - On Error Resume Next - pCreated = CDate(val) - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_HouseholderNames.Created", "Invalid value for Created: " & Err.Description - End If - On Error GoTo 0 - End Property - - Public Property Get HouseholdId() - HouseholdId = pHouseholdId - End Property - - Public Property Let HouseholdId(val) - On Error Resume Next - If IsNumeric(val) Then - pHouseholdId = CDbl(val) - Else - pHouseholdId = val - End If - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_HouseholderNames.HouseholdId", "Invalid value for HouseholdId: " & Err.Description - End If - On Error GoTo 0 - End Property - - Public Property Get Id() - Id = pId - End Property - - Public Property Let Id(val) - On Error Resume Next - If IsNumeric(val) Then - pId = CDbl(val) - Else - pId = val - End If - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_HouseholderNames.Id", "Invalid value for Id: " & Err.Description - End If - On Error GoTo 0 - End Property - - Public Property Get LetterReturned() - LetterReturned = pLetterReturned - End Property - - Public Property Let LetterReturned(val) - On Error Resume Next - If IsNumeric(val) Then - pLetterReturned = CDbl(val) - Else - pLetterReturned = val - End If - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_HouseholderNames.LetterReturned", "Invalid value for LetterReturned: " & Err.Description - End If - On Error GoTo 0 - End Property - - Public Property Get Name() - Name = pName - End Property - - Public Property Let Name(val) - On Error Resume Next - If IsNumeric(val) Then - pName = CDbl(val) - Else - pName = val - End If - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_HouseholderNames.Name", "Invalid value for Name: " & Err.Description - End If - On Error GoTo 0 - End Property - - Public Property Get ReturnDate() - ReturnDate = pReturnDate - End Property - - Public Property Let ReturnDate(val) - On Error Resume Next - pReturnDate = CDate(val) - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_HouseholderNames.ReturnDate", "Invalid value for ReturnDate: " & Err.Description - End If - On Error GoTo 0 - End Property - -End Class -%> diff --git a/app/models/POBO_Households.asp b/app/models/POBO_Households.asp deleted file mode 100644 index 5332b20..0000000 --- a/app/models/POBO_Households.asp +++ /dev/null @@ -1,172 +0,0 @@ -<% -' Auto-generated POBO for table [Households] -' Generator: GenerateRepo.vbs v1.0 -' -' Dependencies: core/helpers.asp (QuoteValue function) - - -Class POBO_Households - ' Public array of all property names - Public Properties - - Private pAddress - Private pDoNotCall - Private pDoNotCallDate - Private pDoNotCallNotes - Private pDoNotCallPrivateNotes - Private pId - Private pIsBusiness - Private pLatitude - Private pLongitude - Private pStreetName - Private pStreetNumber - Private pTerritoryId - - Private Sub Class_Initialize() - pAddress = Null - pDoNotCall = 0 - pDoNotCallDate = Null - pDoNotCallNotes = Null - pDoNotCallPrivateNotes = Null - pId = 0 - pIsBusiness = 0 - pLatitude = Null - pLongitude = Null - pStreetName = Null - pStreetNumber = 0 - pTerritoryId = 0 - Properties = Array("Address","DoNotCall","DoNotCallDate","DoNotCallNotes","DoNotCallPrivateNotes","Id","IsBusiness","Latitude","Longitude","StreetName","StreetNumber","TerritoryId") - End Sub - - Public Property Get PrimaryKey() - PrimaryKey = "Id" - End Property - - Public Property Get TableName() - TableName = "Households" - End Property - - Public Property Get Address() - Address = pAddress - End Property - - Public Property Let Address(val) - pAddress = val - End Property - - Public Property Get DoNotCall() - DoNotCall = pDoNotCall - End Property - - Public Property Let DoNotCall(val) - If IsNumeric(val) Then - pDoNotCall = CLng(val) - Else - pDoNotCall = val - End If - End Property - - Public Property Get DoNotCallDate() - DoNotCallDate = pDoNotCallDate - End Property - - Public Property Let DoNotCallDate(val) - If IsNull(val) Then - pDoNotCallDate = Null - ElseIf Trim(CStr(val)) = "" Then - pDoNotCallDate = Null - Else - pDoNotCallDate = CDate(val) - End If - End Property - - Public Property Get DoNotCallNotes() - DoNotCallNotes = pDoNotCallNotes - End Property - - Public Property Let DoNotCallNotes(val) - pDoNotCallNotes = val - End Property - - Public Property Get DoNotCallPrivateNotes() - DoNotCallPrivateNotes = pDoNotCallPrivateNotes - End Property - - Public Property Let DoNotCallPrivateNotes(val) - pDoNotCallPrivateNotes = val - End Property - - Public Property Get Id() - Id = pId - End Property - - Public Property Let Id(val) - If IsNumeric(val) Then - pId = CLng(val) - Else - pId = val - End If - End Property - - Public Property Get IsBusiness() - IsBusiness = pIsBusiness - End Property - - Public Property Let IsBusiness(val) - If IsNumeric(val) Then - pIsBusiness = CLng(val) - Else - pIsBusiness = val - End If - End Property - - Public Property Get Latitude() - Latitude = pLatitude - End Property - - Public Property Let Latitude(val) - pLatitude = val - End Property - - Public Property Get Longitude() - Longitude = pLongitude - End Property - - Public Property Let Longitude(val) - pLongitude = val - End Property - - Public Property Get StreetName() - StreetName = pStreetName - End Property - - Public Property Let StreetName(val) - pStreetName = val - End Property - - Public Property Get StreetNumber() - StreetNumber = pStreetNumber - End Property - - Public Property Let StreetNumber(val) - If IsNumeric(val) Then - pStreetNumber = CLng(val) - Else - pStreetNumber = val - End If - End Property - - Public Property Get TerritoryId() - TerritoryId = pTerritoryId - End Property - - Public Property Let TerritoryId(val) - If IsNumeric(val) Then - pTerritoryId = CLng(val) - Else - pTerritoryId = val - End If - End Property - -End Class -%> diff --git a/app/models/POBO_Territories.asp b/app/models/POBO_Territories.asp deleted file mode 100644 index 937cd2a..0000000 --- a/app/models/POBO_Territories.asp +++ /dev/null @@ -1,103 +0,0 @@ -<% -' Auto-generated POBO for table [Territories] -' Generated on 1/17/2026 2:53:15 PM -' Generator: GenerateRepo.vbs v1.0 -' -' Dependencies: core/helpers.asp (QuoteValue function) - - -Class POBO_Territories - ' Public array of all property names - Public Properties - - Private pCoordinates - Private pDescription - Private pId - Private pName - - Private Sub Class_Initialize() - pCoordinates = Null - pDescription = Null - pId = 0 - pName = Null - Properties = Array("Coordinates","Description","Id","Name") - End Sub - - Public Property Get PrimaryKey() - PrimaryKey = "Id" - End Property - - Public Property Get TableName() - TableName = "Territories" - End Property - - Public Property Get Coordinates() - Coordinates = pCoordinates - End Property - - Public Property Let Coordinates(val) - On Error Resume Next - If IsNumeric(val) Then - pCoordinates = CDbl(val) - Else - pCoordinates = val - End If - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_Territories.Coordinates", "Invalid value for Coordinates: " & Err.Description - End If - On Error GoTo 0 - End Property - - Public Property Get Description() - Description = pDescription - End Property - - Public Property Let Description(val) - On Error Resume Next - If IsNumeric(val) Then - pDescription = CDbl(val) - Else - pDescription = val - End If - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_Territories.Description", "Invalid value for Description: " & Err.Description - End If - On Error GoTo 0 - End Property - - Public Property Get Id() - Id = pId - End Property - - Public Property Let Id(val) - On Error Resume Next - If IsNumeric(val) Then - pId = CDbl(val) - Else - pId = val - End If - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_Territories.Id", "Invalid value for Id: " & Err.Description - End If - On Error GoTo 0 - End Property - - Public Property Get Name() - Name = pName - End Property - - Public Property Let Name(val) - On Error Resume Next - If IsNumeric(val) Then - pName = CDbl(val) - Else - pName = val - End If - If Err.Number <> 0 Then - Err.Raise Err.Number, "POBO_Territories.Name", "Invalid value for Name: " & Err.Description - End If - On Error GoTo 0 - End Property - -End Class -%> diff --git a/app/models/TerritoriesRepository.asp b/app/models/TerritoriesRepository.asp deleted file mode 100644 index 895e23e..0000000 --- a/app/models/TerritoriesRepository.asp +++ /dev/null @@ -1,176 +0,0 @@ -<% -' Auto-generated Repository for table [Territories] -' Generated on 1/17/2026 2:53:15 PM -' Generator: GenerateRepo.vbs v1.0 -' -' Dependencies: -' - core/lib.DAL.asp (DAL singleton for database access) -' - core/lib.AutoMapper.asp (Automapper for object mapping) -' - core/lib.Collections.asp (LinkedList_Class) -' - core/lib.helpers.asp (KVUnzip, BuildOrderBy, QI, Destroy) - - -Class TerritoriesRepository_Class - - Public Function FindByID(id) - Dim sql : sql = "Select [Coordinates], [Description], [Id], [Name] FROM [Territories] WHERE [Id] = ?" - Dim rs : Set rs = DAL.Query(sql, Array(id)) - If rs.EOF Then - Err.Raise 1, "TerritoriesRepository_Class", RecordNotFoundException("Id", id) - Else - Set FindByID = Automapper.AutoMap(rs, "POBO_Territories") - End If - Destroy rs - End Function - - Public Function GetAll(orderBy) - Set GetAll = Find(Empty, orderBy) - End Function - - Public Function Find(where_kvarray, order_string_or_array) - Dim sql : sql = "Select [Coordinates], [Description], [Id], [Name] FROM [Territories]" - Dim where_keys, where_values, i - If Not IsEmpty(where_kvarray) Then - KVUnzip where_kvarray, where_keys, where_values - If Not IsEmpty(where_keys) Then - sql = sql & " WHERE " - For i = 0 To UBound(where_keys) - If i > 0 Then sql = sql & " AND " - sql = sql & " " & QI(where_keys(i)) & " = ?" - Next - End If - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.Query(sql, where_values) - Dim list : Set list = new LinkedList_Class - Do Until rs.EOF - list.Push Automapper.AutoMap(rs, "POBO_Territories") - rs.MoveNext - Loop - Set Find = list - Destroy rs - End Function - - Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [Coordinates], [Description], [Id], [Name] FROM [Territories]" - Dim where_keys, where_values, i - If Not IsEmpty(where_kvarray) Then - KVUnzip where_kvarray, where_keys, where_values - If Not IsEmpty(where_keys) Then - sql = sql & " WHERE " - For i = 0 To UBound(where_keys) - If i > 0 Then sql = sql & " AND " - sql = sql & " " & QI(where_keys(i)) & " = ?" - Next - End If - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.PagedQuery(sql, where_values, per_page, page_num) - If Not rs.EOF Then - rs.PageSize = per_page - rs.AbsolutePage = page_num - page_count = rs.PageCount - record_count = rs.RecordCount - End If - Set FindPaged = PagedList(rs, per_page) - Destroy rs - End Function - - Public Function SearchTablePaged(columns_array, search_value, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [Coordinates], [Description], [Id], [Name] FROM [Territories]" - Dim i, params() - If IsArray(columns_array) And UBound(columns_array) >= 0 Then - sql = sql & " WHERE " - ReDim params(UBound(columns_array)) - For i = 0 To UBound(columns_array) - If i > 0 Then sql = sql & " OR " - sql = sql & " " & QI(columns_array(i)) & " LIKE ?" - params(i) = "%" & search_value & "%" - Next - End If - sql = sql & BuildOrderBy(order_string_or_array, "[Id]") - Dim rs : Set rs = DAL.PagedQuery(sql, params, per_page, page_num) - If Not rs.EOF Then - rs.PageSize = per_page - rs.AbsolutePage = page_num - page_count = rs.PageCount - record_count = rs.RecordCount - End If - Set SearchTablePaged = PagedList(rs, per_page) - Destroy rs - End Function - - Private Function PagedList(rs, per_page) - Dim list : Set list = new LinkedList_Class - Dim x : x = 0 - Do While (per_page <= 0 Or x < per_page) And Not rs.EOF - list.Push Automapper.AutoMap(rs, "POBO_Territories") - x = x + 1 - rs.MoveNext - Loop - Set PagedList = list - End Function - - Public Sub AddNew(ByRef model) - Dim sql : sql = "INSERT INTO [Territories] ([Coordinates], [Description], [Name]) VALUES (?, ?, ?)" - DAL.[Execute] sql, Array(model.Coordinates, model.Description, model.Name) - - ' Retrieve the newly inserted ID - On Error Resume Next - Dim rsId : Set rsId = DAL.Query("SELECT @@IDENTITY AS NewID", Empty) - If Err.Number <> 0 Then - ' Fallback for Access databases - Err.Clear - Set rsId = DAL.Query("SELECT TOP 1 [Id] FROM [Territories] ORDER BY [Id] DESC", Empty) - End If - On Error GoTo 0 - - If Not rsId.EOF Then - If Not IsNull(rsId(0)) Then model.Id = rsId(0) - End If - Destroy rsId - End Sub - - Public Sub Update(model) - Dim sql : sql = "UPDATE [Territories] SET [Coordinates] = ?, [Description] = ?, [Name] = ? WHERE [Id] = ?" - DAL.[Execute] sql, Array(model.Coordinates, model.Description, model.Name, model.Id) - End Sub - - Public Sub Delete(id) - Dim sql : sql = "DELETE FROM [Territories] WHERE [Id] = ?" - DAL.[Execute] sql, Array(id) - End Sub - - Private Function RecordNotFoundException(ByVal field_name, ByVal field_val) - RecordNotFoundException = "Territories record was not found with " & field_name & " = '" & field_val & "'." - End Function - - Private Function QI(name) - QI = "[" & Replace(CStr(name), "]", "]]") & "]" - End Function - - Private Function BuildOrderBy(orderArg, defaultCol) - Dim s : s = "" - If IsEmpty(orderArg) Or IsNull(orderArg) Or orderArg = "" Then - s = " ORDER BY " & defaultCol & " ASC" - ElseIf IsArray(orderArg) Then - Dim i : s = " ORDER BY " - For i = 0 To UBound(orderArg) - If i > 0 Then s = s & ", " - s = s & QI(orderArg(i)) - Next - Else - s = " ORDER BY " & QI(orderArg) - End If - BuildOrderBy = s - End Function -End Class - -Dim TerritoriesRepository__Singleton -Function TerritoriesRepository() - If IsEmpty(TerritoriesRepository__Singleton) Then - Set TerritoriesRepository__Singleton = new TerritoriesRepository_Class - End If - Set TerritoriesRepository = TerritoriesRepository__Singleton -End Function -%> diff --git a/app/views/Household/create.asp b/app/views/Household/create.asp deleted file mode 100644 index a7c7f3a..0000000 --- a/app/views/Household/create.asp +++ /dev/null @@ -1,153 +0,0 @@ -
- - -

New Household

- - <% Flash().ShowErrorsIfPresent %> - -
-
-
-
-
-
- - -
- -
-
-
- - -
-
-
-
- - -
-
-
- -
- - -
- -
-
- - -
-
- -
-
-
- - -
- -
- - -
- -
- - -
- -
- - -
-
-
- -
-
-
- - -
-
-
-
- - -
-
-
- -
- - Cancel -
-
-
- -
- Click on the map to set latitude and longitude. -
-
-
-
-
-
- - - diff --git a/app/views/Household/edit.asp b/app/views/Household/edit.asp deleted file mode 100644 index b4c10dd..0000000 --- a/app/views/Household/edit.asp +++ /dev/null @@ -1,190 +0,0 @@ -
- - -

Edit Household

- - <% Flash().ShowErrorsIfPresent %> - -
-
-
-
-
-
- - -
- -
-
-
- - -
-
-
-
- - "> -
-
-
- -
- - -
- -
-
- > - -
-
- - <% - Dim doNotCallDateVal, doNotCallNotesVal, doNotCallPrivateNotesVal - doNotCallDateVal = "" - doNotCallNotesVal = "" - doNotCallPrivateNotesVal = "" - If IsDate(HouseholdController.household.DoNotCallDate) Then - doNotCallDateVal = Year(HouseholdController.household.DoNotCallDate) & "-" & _ - Right("0" & Month(HouseholdController.household.DoNotCallDate), 2) & "-" & _ - Right("0" & Day(HouseholdController.household.DoNotCallDate), 2) - End If - If Not IsNull(HouseholdController.household.DoNotCallNotes) Then - doNotCallNotesVal = HouseholdController.household.DoNotCallNotes - End If - If Not IsNull(HouseholdController.household.DoNotCallPrivateNotes) Then - doNotCallPrivateNotesVal = HouseholdController.household.DoNotCallPrivateNotes - End If - %> -
-
-
- > - -
- -
- - -
- -
- - -
- -
- - -
-
-
- -
-
-
- - "> -
-
-
-
- - "> -
-
-
- -
- - Cancel -
-
-
- -
- Click on the map to update latitude and longitude. -
-
-
-
-
-
- - - - diff --git a/app/views/Household/index.asp b/app/views/Household/index.asp deleted file mode 100644 index d14e46c..0000000 --- a/app/views/Household/index.asp +++ /dev/null @@ -1,187 +0,0 @@ -
-
-

Households

- New Household -
- - <% Flash().ShowSuccessIfPresent %> - <% Flash().ShowErrorsIfPresent %> - - -
-
-
-
-
- - -
-
-
- -
-
- -
-
- - <%= HouseholdController.recordCount %> household(s) - - <% If HouseholdController.searchTerm <> "" Or HouseholdController.filterTerritoryId > 0 Or HouseholdController.filterDoNotCall > -1 Then %> - Clear - <% End If %> -
-
-
-
- -
- - - - - - - - - - - - - - <% - Dim iter, h - Set iter = HouseholdController.households.Iterator() - If Not iter.HasNext() Then - %> - - - - <% - Else - Do While iter.HasNext() - Set h = iter.GetNext() - %> - - - - - - - - - - <% - Loop - End If - %> - -
IDAddressTypeDNCStreetTerritoryActions
- <% If HouseholdController.searchTerm <> "" Then %> - No households found matching "<%= Server.HTMLEncode(HouseholdController.searchTerm) %>" - <% ElseIf HouseholdController.filterTerritoryId > 0 Then %> - No households found in this territory. - <% Else %> - No households found. Create one - <% End If %> -
<%= h.Id %><%= Server.HTMLEncode(h.Address) %> - <% If h.IsBusiness = 1 Then %> - Business - <% Else %> - Residential - <% End If %> - - <% If h.DoNotCall = 1 Then %> - Do Not Call - <% If IsDate(h.DoNotCallDate) Then %> -
<%= FormatDateTime(h.DoNotCallDate, 2) %>
- <% End If %> - <% Else %> - No - <% End If %> -
<%= h.StreetNumber %> <%= Server.HTMLEncode(h.StreetName) %> - - <% - If HouseholdController.territoryNamesById.Exists(CStr(h.TerritoryId)) Then - Response.Write Server.HTMLEncode(HouseholdController.territoryNamesById(CStr(h.TerritoryId))) - Else - Response.Write "Territory " & h.TerritoryId - End If - %> - - - View - Edit -
- -
-
-
- - - <% If HouseholdController.pageCount > 1 Then %> - <% - Dim baseUrl, pg, startPage, endPage - baseUrl = "/households?" - If HouseholdController.searchTerm <> "" Then - baseUrl = baseUrl & "q=" & Server.URLEncode(HouseholdController.searchTerm) & "&" - End If - If HouseholdController.filterTerritoryId > 0 Then - baseUrl = baseUrl & "territory=" & HouseholdController.filterTerritoryId & "&" - End If - If HouseholdController.filterDoNotCall > -1 Then - baseUrl = baseUrl & "dnc=" & HouseholdController.filterDoNotCall & "&" - End If - - ' Calculate pagination range (show 5 pages at a time) - startPage = HouseholdController.currentPage - 2 - If startPage < 1 Then startPage = 1 - endPage = startPage + 4 - If endPage > HouseholdController.pageCount Then - endPage = HouseholdController.pageCount - startPage = endPage - 4 - If startPage < 1 Then startPage = 1 - End If - %> - -

- Page <%= HouseholdController.currentPage %> of <%= HouseholdController.pageCount %> -

- <% End If %> -
diff --git a/app/views/Household/show.asp b/app/views/Household/show.asp deleted file mode 100644 index 2a7d4c5..0000000 --- a/app/views/Household/show.asp +++ /dev/null @@ -1,291 +0,0 @@ -
- <% - Dim dncNotesVal, dncPrivateNotesVal - dncNotesVal = "" - dncPrivateNotesVal = "" - If Not IsNull(HouseholdController.household.DoNotCallNotes) Then dncNotesVal = HouseholdController.household.DoNotCallNotes - If Not IsNull(HouseholdController.household.DoNotCallPrivateNotes) Then dncPrivateNotesVal = HouseholdController.household.DoNotCallPrivateNotes - %> - - - <% Flash().ShowSuccessIfPresent %> - <% Flash().ShowErrorsIfPresent %> - -
-
-

<%= Server.HTMLEncode(HouseholdController.household.Address) %>

-
- Edit -
- -
-
-
-
-
-
-
-
ID
-
<%= HouseholdController.household.Id %>
- -
Address
-
<%= Server.HTMLEncode(HouseholdController.household.Address) %>
- -
Street Number
-
<%= HouseholdController.household.StreetNumber %>
- -
Street Name
-
<%= Server.HTMLEncode(HouseholdController.household.StreetName & "") %>
- -
Type
-
- <% If HouseholdController.household.IsBusiness = 1 Then %> - Business - <% Else %> - Residential - <% End If %> - <% If HouseholdController.household.DoNotCall = 1 Then %> - Do Not Call - <% End If %> -
- -
Do Not Call Date
-
- <% If IsDate(HouseholdController.household.DoNotCallDate) Then %> - <%= FormatDateTime(HouseholdController.household.DoNotCallDate, 2) %> - <% Else %> - Not set - <% End If %> -
- -
Do Not Call Notes
-
- <% If Trim(dncNotesVal) <> "" Then %> - <%= Server.HTMLEncode(dncNotesVal) %> - <% Else %> - None - <% End If %> -
- -
Private DNC Notes
-
- <% If Trim(dncPrivateNotesVal) <> "" Then %> - <%= Server.HTMLEncode(dncPrivateNotesVal) %> - <% Else %> - None - <% End If %> -
- -
Territory
-
Territory <%= HouseholdController.household.TerritoryId %>
-
-
-
-
-
Latitude
-
<%= Server.HTMLEncode(HouseholdController.household.Latitude & "") %>
- -
Longitude
-
<%= Server.HTMLEncode(HouseholdController.household.Longitude & "") %>
-
- - <% If HouseholdController.household.Latitude <> "" And HouseholdController.household.Longitude <> "" Then %> -
- <% End If %> -
-
-
-
- - -
-
-
Householder Names
- Add Name -
-
- <% - Dim hnIter, hn - Set hnIter = HouseholdController.householderNames.Iterator() - If Not hnIter.HasNext() Then - %> -
- No householder names recorded. Add one -
- <% - Else - %> - - - - - - - - - - - <% - Do While hnIter.HasNext() - Set hn = hnIter.GetNext() - %> - - - - - - - <% - Loop - %> - -
NameTypeLetter StatusActions
- <%= Server.HTMLEncode(hn.Name & "") %> - - <% If HouseholdController.household.IsBusiness = 1 Then %> - Business - <% Else %> - Residential - <% End If %> - -
- - <% If hn.LetterReturned = 1 Then %> - - <% Else %> - - <% End If %> -
-
- Edit -
- <% - End If - %> -
-
- - -
- -<% If HouseholdController.household.Latitude <> "" And HouseholdController.household.Longitude <> "" Then %> -<% - Dim mapProvider, googleMapsKey, mapTilerKey, mapTilerStyle, mapTilerSdkJsUrl, mapTilerSdkCssUrl - mapProvider = LCase(Trim(GetAppSetting("MapProvider") & "")) - If mapProvider <> "maptiler" Then mapProvider = "google" - - googleMapsKey = Trim(GetAppSetting("GoogleMapsApiKey") & "") - mapTilerKey = Trim(GetAppSetting("MapTilerApiKey") & "") - mapTilerStyle = Trim(GetAppSetting("MapTilerStyle") & "") - If mapTilerStyle = "" Or LCase(mapTilerStyle) = "nothing" Then mapTilerStyle = "streets-v2" - - mapTilerSdkJsUrl = Trim(GetAppSetting("MapTilerSdkJsUrl") & "") - mapTilerSdkCssUrl = Trim(GetAppSetting("MapTilerSdkCssUrl") & "") - If mapTilerSdkJsUrl = "" Or LCase(mapTilerSdkJsUrl) = "nothing" Then mapTilerSdkJsUrl = "https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0/maptiler-sdk.umd.min.js" - If mapTilerSdkCssUrl = "" Or LCase(mapTilerSdkCssUrl) = "nothing" Then mapTilerSdkCssUrl = "https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0/maptiler-sdk.css" -%> - -<% If mapProvider = "maptiler" Then %> - - -<% Else %> - -<% End If %> - -<% End If %> diff --git a/app/views/HouseholderName/create.asp b/app/views/HouseholderName/create.asp deleted file mode 100644 index 975a545..0000000 --- a/app/views/HouseholderName/create.asp +++ /dev/null @@ -1,86 +0,0 @@ -
- - -

- New Householder Name - <% If IsObject(HouseholderNameController.household) Then %> - for <%= Server.HTMLEncode(HouseholderNameController.household.Address) %> - <% End If %> -

- - <% Flash().ShowSuccessIfPresent %> - <% Flash().ShowErrorsIfPresent %> - -
-
-
-
-
-
- - "> -
- -
- - <% If IsObject(HouseholderNameController.household) Then %> - - - <% Else %> - -
Enter the ID of the household this name belongs to.
- <% End If %> -
- - - -
-
- > - -
-
- -
- - -
Only fill in if letter was returned.
-
- -
- - Cancel -
-
-
-
-
- -
-
-
-
Help
-
-
-

Name: The name of the person or business at this address.

-

Type: Business/Residential is now stored on the household, not the name.

-

Letter Returned: Check if a letter sent to this name was returned as undeliverable.

-
-
-
-
-
diff --git a/app/views/HouseholderName/edit.asp b/app/views/HouseholderName/edit.asp deleted file mode 100644 index ee69410..0000000 --- a/app/views/HouseholderName/edit.asp +++ /dev/null @@ -1,95 +0,0 @@ -
- - -

Edit Householder Name

- - <% Flash().ShowSuccessIfPresent %> - <% Flash().ShowErrorsIfPresent %> - -
-
-
-
-
-
- - "> -
- -
- - <% If IsObject(HouseholderNameController.household) Then %> -

- <%= Server.HTMLEncode(HouseholderNameController.household.Address) %> -

- <% Else %> -

ID: <%= HouseholderNameController.householderName.HouseholdId %>

- <% End If %> -
- - - -
-
- > - -
-
- -
- - <% - Dim returnDateVal - returnDateVal = "" - If Year(HouseholderNameController.householderName.ReturnDate) > 1970 Then - returnDateVal = Year(HouseholderNameController.householderName.ReturnDate) & "-" & _ - Right("0" & Month(HouseholderNameController.householderName.ReturnDate), 2) & "-" & _ - Right("0" & Day(HouseholderNameController.householderName.ReturnDate), 2) - End If - %> - -
Only fill in if letter was returned.
-
- -
- -

<%= FormatDateTime(HouseholderNameController.householderName.Created, 2) %>

-
- -
- - Cancel -
-
-
-
-
- -
-
-
-
Danger Zone
-
-
-

Permanently delete this householder name.

-
- -
-
-
-
-
-
diff --git a/app/views/HouseholderName/index.asp b/app/views/HouseholderName/index.asp deleted file mode 100644 index 43e61ca..0000000 --- a/app/views/HouseholderName/index.asp +++ /dev/null @@ -1,171 +0,0 @@ -
-
-

- Householder Names - <% If IsObject(HouseholderNameController.household) Then %> - for <%= Server.HTMLEncode(HouseholderNameController.household.Address) %> - <% End If %> -

- New Householder Name -
- - <% Flash().ShowSuccessIfPresent %> - <% Flash().ShowErrorsIfPresent %> - - -
-
-
-
-
- - - <% If HouseholderNameController.searchTerm <> "" Or HouseholderNameController.filterHouseholdId > 0 Then %> - Clear - <% End If %> -
-
-
- - <% If HouseholderNameController.searchTerm <> "" Then %> - Found <%= HouseholderNameController.recordCount %> result(s) - <% Else %> - <%= HouseholderNameController.recordCount %> total - <% End If %> - -
-
-
-
- - <% If IsObject(HouseholderNameController.household) Then %> - - <% End If %> - -
- - - - - - - - - - - - - <% - Dim iter, hn - Set iter = HouseholderNameController.householderNames.Iterator() - If Not iter.HasNext() Then - %> - - - - <% - Else - Do While iter.HasNext() - Set hn = iter.GetNext() - %> - - - - - - - - - <% - Loop - End If - %> - -
IDNameTypeLetter ReturnedCreatedActions
- <% If HouseholderNameController.searchTerm <> "" Then %> - No householder names found matching "<%= Server.HTMLEncode(HouseholderNameController.searchTerm) %>" - <% ElseIf HouseholderNameController.filterHouseholdId > 0 Then %> - No householder names for this household. Add one - <% Else %> - No householder names found. Create one - <% End If %> -
<%= hn.Id %><%= Server.HTMLEncode(hn.Name & "") %> - Household - - <% If hn.LetterReturned = 1 Then %> - Returned - <% If Year(hn.ReturnDate) > 1970 Then %> - <%= FormatDateTime(hn.ReturnDate, 2) %> - <% End If %> - <% Else %> - No - <% End If %> - <%= FormatDateTime(hn.Created, 2) %> - View - Edit -
- -
-
-
- - - <% If HouseholderNameController.pageCount > 1 Then %> - <% - Dim baseUrl, pg, startPage, endPage - baseUrl = "/householder-names?" - If HouseholderNameController.searchTerm <> "" Then - baseUrl = baseUrl & "q=" & Server.URLEncode(HouseholderNameController.searchTerm) & "&" - End If - If HouseholderNameController.filterHouseholdId > 0 Then - baseUrl = baseUrl & "household=" & HouseholderNameController.filterHouseholdId & "&" - End If - - ' Calculate pagination range (show 5 pages at a time) - startPage = HouseholderNameController.currentPage - 2 - If startPage < 1 Then startPage = 1 - endPage = startPage + 4 - If endPage > HouseholderNameController.pageCount Then - endPage = HouseholderNameController.pageCount - startPage = endPage - 4 - If startPage < 1 Then startPage = 1 - End If - %> - -

- Page <%= HouseholderNameController.currentPage %> of <%= HouseholderNameController.pageCount %> -

- <% End If %> -
diff --git a/app/views/HouseholderName/show.asp b/app/views/HouseholderName/show.asp deleted file mode 100644 index ada659d..0000000 --- a/app/views/HouseholderName/show.asp +++ /dev/null @@ -1,90 +0,0 @@ -
- - -
-

<%= Server.HTMLEncode(HouseholderNameController.householderName.Name & "") %>

-
- Edit - Back to List -
-
- - <% Flash().ShowSuccessIfPresent %> - <% Flash().ShowErrorsIfPresent %> - -
-
-
-
-
Householder Details
-
-
-
-
ID
-
<%= HouseholderNameController.householderName.Id %>
- -
Name
-
<%= Server.HTMLEncode(HouseholderNameController.householderName.Name & "") %>
- -
Type
-
- Household -
- -
Letter Returned
-
- <% If HouseholderNameController.householderName.LetterReturned = 1 Then %> - Yes - Returned - <% If Year(HouseholderNameController.householderName.ReturnDate) > 1970 Then %> -
Return Date: <%= FormatDateTime(HouseholderNameController.householderName.ReturnDate, 2) %> - <% End If %> - <% Else %> - No - <% End If %> -
- -
Created
-
<%= FormatDateTime(HouseholderNameController.householderName.Created, 2) %>
- -
Household
-
- <% If IsObject(HouseholderNameController.household) Then %> - <%= Server.HTMLEncode(HouseholderNameController.household.Address) %> - <% Else %> - ID: <%= HouseholderNameController.householderName.HouseholdId %> - <% End If %> -
-
-
-
-
- -
-
-
-
Actions
-
-
-
- Edit - <% If IsObject(HouseholderNameController.household) Then %> - View Household - Add Another Name - <% End If %> -
- -
-
-
-
-
-
-
diff --git a/app/views/Territory/create.asp b/app/views/Territory/create.asp deleted file mode 100644 index 3da0b12..0000000 --- a/app/views/Territory/create.asp +++ /dev/null @@ -1,134 +0,0 @@ -
- - -

New Territory

- - <% Flash().ShowErrorsIfPresent %> - -
-
-
-
-
-
- - -
- -
- - -
- -
- - - Click on the map to draw the territory boundary. -
- -
- - Cancel -
-
-
- -
-
- - -
-
-
-
-
-
-
- - - diff --git a/app/views/Territory/edit.asp b/app/views/Territory/edit.asp deleted file mode 100644 index 68aaf33..0000000 --- a/app/views/Territory/edit.asp +++ /dev/null @@ -1,164 +0,0 @@ -
- - -

Edit Territory

- - <% Flash().ShowErrorsIfPresent %> - -
-
-
-
-
-
- - -
- -
- - -
- -
- - - Click on the map to add points, or edit JSON directly. -
- -
- - Cancel -
-
-
- -
-
- - -
-
-
-
-
-
-
- - - - diff --git a/app/views/Territory/index.asp b/app/views/Territory/index.asp deleted file mode 100644 index ab0e1e0..0000000 --- a/app/views/Territory/index.asp +++ /dev/null @@ -1,150 +0,0 @@ -
-
-

Territories

- New Territory -
- - <% Flash().ShowSuccessIfPresent %> - <% Flash().ShowErrorsIfPresent %> - - -
-
-
-
-
- - - <% If TerritoryController.searchTerm <> "" Then %> - Clear - <% End If %> -
-
-
- - <% If TerritoryController.searchTerm <> "" Then %> - Found <%= TerritoryController.recordCount %> result(s) - <% Else %> - <%= TerritoryController.recordCount %> total territories - <% End If %> - -
-
-
-
- -
- - - - - - - - - - - - <% - Dim iter, t - Set iter = TerritoryController.territories.Iterator() - If Not iter.HasNext() Then - %> - - - - <% - Else - Do While iter.HasNext() - Set t = iter.GetNext() - %> - - - - - <% - Dim householdCount - householdCount = 0 - If IsObject(TerritoryController.territoryHouseholdCounts) Then - If TerritoryController.territoryHouseholdCounts.Exists(CLng(t.Id)) Then - householdCount = TerritoryController.territoryHouseholdCounts(CLng(t.Id)) - End If - End If - %> - - - - <% - Loop - End If - %> - -
IDNameDescriptionHouseholdsActions
- <% If TerritoryController.searchTerm <> "" Then %> - No territories found matching "<%= Server.HTMLEncode(TerritoryController.searchTerm) %>" - <% Else %> - No territories found. Create one - <% End If %> -
<%= t.Id %><%= Server.HTMLEncode(t.Name) %><%= Server.HTMLEncode(Left(t.Description & "", 50)) %><% If Len(t.Description & "") > 50 Then Response.Write "..." End If %><%= householdCount %> - View - Edit -
- -
-
-
- - - <% If TerritoryController.pageCount > 1 Then %> - <% - Dim baseUrl, pg, startPage, endPage - baseUrl = "/territories?" - If TerritoryController.searchTerm <> "" Then - baseUrl = baseUrl & "q=" & Server.URLEncode(TerritoryController.searchTerm) & "&" - End If - - ' Calculate pagination range (show 5 pages at a time) - startPage = TerritoryController.currentPage - 2 - If startPage < 1 Then startPage = 1 - endPage = startPage + 4 - If endPage > TerritoryController.pageCount Then - endPage = TerritoryController.pageCount - startPage = endPage - 4 - If startPage < 1 Then startPage = 1 - End If - %> - -

- Page <%= TerritoryController.currentPage %> of <%= TerritoryController.pageCount %> -

- <% End If %> -
diff --git a/app/views/Territory/show.asp b/app/views/Territory/show.asp deleted file mode 100644 index 68add19..0000000 --- a/app/views/Territory/show.asp +++ /dev/null @@ -1,813 +0,0 @@ -
- - - <% Flash().ShowSuccessIfPresent %> - <% Flash().ShowErrorsIfPresent %> - -
-
-

<%= Server.HTMLEncode(TerritoryController.territory.Name) %>

-
- - Edit -
- -
-
-
-
-
-
-
-
ID
-
<%= TerritoryController.territory.Id %>
- -
Name
-
<%= Server.HTMLEncode(TerritoryController.territory.Name) %>
- -
Description
-
<%= Server.HTMLEncode(TerritoryController.territory.Description & "") %>
-
-
-
-
-
-
-
-
- - -
- - - -<% - Dim mapProvider, googleMapsKey, mapTilerKey, mapTilerStyle, mapTilerSdkJsUrl, mapTilerSdkCssUrl - mapProvider = LCase(Trim(GetAppSetting("MapProvider") & "")) - If mapProvider <> "maptiler" Then mapProvider = "google" - - googleMapsKey = Trim(GetAppSetting("GoogleMapsApiKey") & "") - mapTilerKey = Trim(GetAppSetting("MapTilerApiKey") & "") - mapTilerStyle = Trim(GetAppSetting("MapTilerStyle") & "") - If mapTilerStyle = "" Or LCase(mapTilerStyle) = "nothing" Then mapTilerStyle = "streets-v2" - - mapTilerSdkJsUrl = Trim(GetAppSetting("MapTilerSdkJsUrl") & "") - mapTilerSdkCssUrl = Trim(GetAppSetting("MapTilerSdkCssUrl") & "") - If mapTilerSdkJsUrl = "" Or LCase(mapTilerSdkJsUrl) = "nothing" Then mapTilerSdkJsUrl = "https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0/maptiler-sdk.umd.min.js" - If mapTilerSdkCssUrl = "" Or LCase(mapTilerSdkCssUrl) = "nothing" Then mapTilerSdkCssUrl = "https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0/maptiler-sdk.css" -%> - -<% - Dim coordsJson - coordsJson = Trim(TerritoryController.territory.Coordinates & "") - If coordsJson = "" Then coordsJson = "[]" - - ' Build street names array for JavaScript - Dim streetIter, streetName, streetsJson, isFirst - streetsJson = "[" - isFirst = True - If Not TerritoryController.territoryStreets Is Nothing Then - Set streetIter = TerritoryController.territoryStreets.Iterator() - Do While streetIter.HasNext() - streetName = streetIter.GetNext() - If Not isFirst Then streetsJson = streetsJson & "," - streetsJson = streetsJson & """" & Replace(streetName, """", "\""") & """" - isFirst = False - Loop - End If - streetsJson = streetsJson & "]" - - ' Get border streets from the Description field - Dim borderStreets - borderStreets = Trim(TerritoryController.territory.Description & "") -%> - -<% If mapProvider = "maptiler" Then %> - - -<% Else %> - -<% End If %> - diff --git a/app/views/shared/header.asp b/app/views/shared/header.asp index de8b482..03fce57 100644 --- a/app/views/shared/header.asp +++ b/app/views/shared/header.asp @@ -15,7 +15,7 @@ If IsObject(CurrentController) Then On Error GoTo 0 End If -If Len(pageTitle) = 0 Then pageTitle = "Classic ASP Unified Framework" +If Len(pageTitle) = 0 Then pageTitle = "Classic ASP Starter Template" %> @@ -50,8 +50,8 @@ If Len(pageTitle) = 0 Then pageTitle = "Classic ASP Unified Framework"