diff --git a/.github/.trufflehog3.yml b/.github/.trufflehog3.yml
index f69b089755..078ff3fd10 100644
--- a/.github/.trufflehog3.yml
+++ b/.github/.trufflehog3.yml
@@ -35,6 +35,7 @@ exclude: # exclude matching issues
- "*.ico"
- "*.css"
- "*.scss"
+ - "*.config.ts"
- message: Ignore integrity hashes on Openshift config files
pattern: sha256:.*
paths:
diff --git a/.github/workflows/api-dotnetcore.yml b/.github/workflows/api-dotnetcore.yml
index 1691089973..4a2f644d29 100644
--- a/.github/workflows/api-dotnetcore.yml
+++ b/.github/workflows/api-dotnetcore.yml
@@ -106,11 +106,11 @@ jobs:
- name: Codecov
uses: codecov/codecov-action@v3.1.1
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV }}
with:
# User defined upload name. Visible in Codecov UI
name: PIMS
- # Repository upload token - get it from codecov.io. Required only for private repositories
- token: ${{ secrets.CodeCov }}
# Path to coverage file to upload
file: ${{env.working-directory}}/tests/unit/TestResults/coverage.opencover.xml
# Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)
diff --git a/.github/workflows/app-react.yml b/.github/workflows/app-react.yml
index 1e74a55d2d..a71995706e 100644
--- a/.github/workflows/app-react.yml
+++ b/.github/workflows/app-react.yml
@@ -52,18 +52,18 @@ jobs:
- run: npm run build --if-present
working-directory: ${{env.working-directory}}
- - run: npm run coverage -- --maxWorkers=2
+ - run: npm run coverage -- --bail 1 --maxWorkers 2 --minWorkers 2
working-directory: ${{env.working-directory}}
env:
REACT_APP_TENANT: MOTI
- name: Codecov
uses: codecov/codecov-action@v3.1.1
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV }}
with:
# User defined upload name. Visible in Codecov UI
name: PIMS
- # Repository upload token - get it from codecov.io. Required only for private repositories
- token: ${{ secrets.CodeCov }}
# Path to coverage file to upload
file: ${{env.working-directory}}/coverage/coverage-final.json
# Flag upload to group coverage metrics (e.g. unittests | integration | ui,chrome)
diff --git a/Makefile b/Makefile
index a29d63ce64..e51a844a4c 100644
--- a/Makefile
+++ b/Makefile
@@ -184,11 +184,11 @@ infra: ## Starts infrastructure containers (e.g. database, geoserver). Useful fo
start: ## Starts the local containers (n=service name)
@echo "$(P) Starting client and server containers..."
- @docker-compose start $(n)
+ @docker-compose --profile all start $(n)
up: ## Runs the local containers (n=service name)
@echo "$(P) Running client and server..."
- @docker-compose up -d --no-recreate $(n)
+ @docker-compose --profile all up -d --no-recreate $(n)
destroy: ## Stops the local containers and removes them (n=service name)
@echo "$(P) Removing docker containers..."
@@ -196,15 +196,15 @@ destroy: ## Stops the local containers and removes them (n=service name)
down: ## Stops the local containers and removes them
@echo "$(P) Stopping client and server..."
- @docker-compose down
+ @docker-compose --profile all down
stop: ## Stops the local containers (n=service name)
@echo "$(P) Stopping client and server..."
- @docker-compose stop $(n)
+ @docker-compose --profile all stop $(n)
build: ## Builds the local containers (n=service name)
@echo "$(P) Building images..."
- @docker-compose build --no-cache $(n)
+ @docker-compose --profile all build --no-cache $(n)
rebuild: ## Build the local contains (n=service name) and then start them after building
@"$(MAKE)" build n=$(n)
@@ -216,6 +216,9 @@ clean: ## Removes all local containers, images, volumes, etc
@docker volume rm -f psp-frontend-node-cache
@docker volume rm -f psp-api-db-data
+restart-mayan:
+ @docker-compose --profile mayan up --build -d
+
logs: ## Shows logs for running containers (n=service name)
@docker-compose logs -f $(n)
diff --git a/docker-compose.yml b/docker-compose.yml
index ee2cea399b..96bfcef60f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,8 +1,14 @@
version: "3.5"
+include:
+ - tools/mayan-edms/docker-compose.yml
+
services:
####################### Database #######################
database:
+ profiles:
+ - all
+ - psp
environment:
- TARGET_SPRINT
- SEED
@@ -21,6 +27,9 @@ services:
####################### Backend #######################
backend:
+ profiles:
+ - all
+ - psp
restart: on-failure:1
container_name: psp-api
build:
@@ -39,6 +48,9 @@ services:
####################### Frontend #######################
frontend:
+ profiles:
+ - all
+ - psp
stdin_open: true
tty: true
restart: on-failure:1
@@ -59,6 +71,9 @@ services:
####################### GeoServer #######################
geoserver:
+ profiles:
+ - all
+ - psp
image: kartoza/geoserver:2.19.2
volumes:
- ./tools/geoserver/geoserver_data:/opt/geoserver/data_dir/workspaces
@@ -77,6 +92,8 @@ services:
####################### Clam AV #######################
# example av test file here: https://serverfault.com/questions/484082/how-should-i-test-clam-anti-virus
clamav:
+ profiles:
+ - all
image: mkodockx/docker-clamav:alpine-idb-amd64
environment:
- CLAMD_CONF_MaxFileSize=500M
@@ -86,7 +103,7 @@ services:
restart: on-failure
container_name: psp-clamav
healthcheck:
- test: ["CMD", "./check.sh"]
+ test: [ "CMD", "./check.sh" ]
interval: 60s
retries: 3
start_period: 120s
@@ -94,6 +111,9 @@ services:
- psp
prometheus:
+ profiles:
+ - all
+ - monitoring
image: ubuntu/prometheus
container_name: psp-prometheus
ports:
@@ -108,6 +128,9 @@ services:
- "--web.enable-lifecycle"
grafana:
+ profiles:
+ - all
+ - monitoring
image: grafana/grafana-oss
container_name: psp-grafana
restart: on-failure
diff --git a/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.dtproj b/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.dtproj
new file mode 100644
index 0000000000..fc742ccdd0
--- /dev/null
+++ b/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.dtproj
@@ -0,0 +1,238 @@
+
+
+ Project
+ 16.0.5270.0
+ 9.0.1.0
+ $base64$PFNvdXJjZUNvbnRyb2xJbmZvIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOmRkbDI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yIiB4bWxuczpkZGwyXzI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yLzIiIHhtbG5zOmRkbDEwMF8xMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDA4L2VuZ2luZS8xMDAvMTAwIiB4bWxuczpkZGwyMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAiIHhtbG5zOmRkbDIwMF8yMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAvMjAwIiB4bWxuczpkZGwzMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAiIHhtbG5zOmRkbDMwMF8zMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAvMzAwIiB4bWxuczpkZGw0MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAiIHhtbG5zOmRkbDQwMF80MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAvNDAwIiB4bWxuczpkZGw1MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAiIHhtbG5zOmRkbDUwMF81MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAvNTAwIiB4bWxuczpkd2Q9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vRGF0YVdhcmVob3VzZS9EZXNpZ25lci8xLjAiPg0KICA8RW5hYmxlZD5mYWxzZTwvRW5hYmxlZD4NCiAgPFByb2plY3ROYW1lPjwvUHJvamVjdE5hbWU+DQogIDxBdXhQYXRoPjwvQXV4UGF0aD4NCiAgPExvY2FsUGF0aD48L0xvY2FsUGF0aD4NCiAgPFByb3ZpZGVyPjwvUHJvdmlkZXI+DQo8L1NvdXJjZUNvbnRyb2xJbmZvPg==
+
+ PIMS_ADDRESS_MERGE.database
+ PIMS_ADDRESS_MERGE.database
+
+
+
+
+
+
+
+ {592e3762-5ece-499a-8a45-9091d862091c}
+ PIMS_ADDRESS_MERGE
+ 0
+ 0
+ 0
+
+
+ 2024-04-18T07:57:18.9414114-07:00
+ ARIMA-DELL\smart
+ ARIMA-DELL
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+ {2D5694EC-F952-4ACD-9643-F82177A0AE06}
+ Package
+ 1
+ 0
+ 31
+
+
+ {E545B53F-177F-49B9-9F9F-C0A226EBA12E}
+ 8
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ false
+ 3
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ Data Source=localhost,5433;User ID=admin;Initial Catalog=pims;Provider=SQLOLEDB.1;Persist Security Info=True;Auto Translate=False;Application Name=SSIS-Package-{A403C4B4-6865-4E60-8AA6-D8AD90A7F8EE}localhost,5433.pims.admin;
+ 18
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 1
+ 9
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 5
+ 9
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ false
+ 3
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ pims
+ 18
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 1
+ 18
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ false
+ 3
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ localhost,5433
+ 18
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ admin
+ 18
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Development
+
+ bin
+
+
+
+
+ SQLServer2022
+ false
+
+
+
+
+
+
+
+ LastModifiedTime
+ LastModifiedTime
+ 2024-04-18T15:07:50.144204Z
+
+
+
+
+
+
\ No newline at end of file
diff --git a/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.dtproj.user b/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.dtproj.user
new file mode 100644
index 0000000000..e58df52043
--- /dev/null
+++ b/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.dtproj.user
@@ -0,0 +1,27 @@
+
+
+
+
+ Development
+
+
+ false
+
+
+ ssistst.th.gov.bc.ca
+ /SSISDB/PIMS_TST/PIMS_ADDRESS_MERGE
+
+
+ false
+ true
+
+
+ LastModifiedTime
+ LastModifiedTime
+ 2024-04-18T15:07:50.14521Z
+
+
+
+
+
+
\ No newline at end of file
diff --git a/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.dtsx b/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.dtsx
new file mode 100644
index 0000000000..2c03e4efdb
--- /dev/null
+++ b/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.dtsx
@@ -0,0 +1,475 @@
+
+
+ 8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+]]>
+
\ No newline at end of file
diff --git a/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.sln b/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.sln
new file mode 100644
index 0000000000..b654b9ad03
--- /dev/null
+++ b/etl/PIMS_ADDRESS_MERGE/PIMS_ADDRESS_MERGE.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.34729.46
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{C9674DCB-5085-4A16-B785-4C70DD1589BD}") = "PIMS_ADDRESS_MERGE", "PIMS_ADDRESS_MERGE.dtproj", "{A919C602-C26C-4F09-A09B-9FA032489359}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Development|Default = Development|Default
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A919C602-C26C-4F09-A09B-9FA032489359}.Development|Default.ActiveCfg = Development
+ {A919C602-C26C-4F09-A09B-9FA032489359}.Development|Default.Build.0 = Development
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {FA7CA1F9-93ED-4535-B9E1-038D59A9C236}
+ EndGlobalSection
+EndGlobal
diff --git a/etl/PIMS_ADDRESS_MERGE/Project.params b/etl/PIMS_ADDRESS_MERGE/Project.params
new file mode 100644
index 0000000000..680ffe30da
--- /dev/null
+++ b/etl/PIMS_ADDRESS_MERGE/Project.params
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.dtproj b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.dtproj
new file mode 100644
index 0000000000..373d2c36d6
--- /dev/null
+++ b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.dtproj
@@ -0,0 +1,238 @@
+
+
+ Project
+ 16.0.5270.0
+ 9.0.1.0
+ $base64$PFNvdXJjZUNvbnRyb2xJbmZvIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOmRkbDI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yIiB4bWxuczpkZGwyXzI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yLzIiIHhtbG5zOmRkbDEwMF8xMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDA4L2VuZ2luZS8xMDAvMTAwIiB4bWxuczpkZGwyMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAiIHhtbG5zOmRkbDIwMF8yMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAvMjAwIiB4bWxuczpkZGwzMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAiIHhtbG5zOmRkbDMwMF8zMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAvMzAwIiB4bWxuczpkZGw0MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAiIHhtbG5zOmRkbDQwMF80MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAvNDAwIiB4bWxuczpkZGw1MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAiIHhtbG5zOmRkbDUwMF81MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAvNTAwIiB4bWxuczpkd2Q9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vRGF0YVdhcmVob3VzZS9EZXNpZ25lci8xLjAiPg0KICA8RW5hYmxlZD5mYWxzZTwvRW5hYmxlZD4NCiAgPFByb2plY3ROYW1lPjwvUHJvamVjdE5hbWU+DQogIDxBdXhQYXRoPjwvQXV4UGF0aD4NCiAgPExvY2FsUGF0aD48L0xvY2FsUGF0aD4NCiAgPFByb3ZpZGVyPjwvUHJvdmlkZXI+DQo8L1NvdXJjZUNvbnRyb2xJbmZvPg==
+
+ PIMS_PROPERTY_MERGE_UPD.database
+ PIMS_PROPERTY_MERGE_UPD.database
+
+
+
+
+
+
+
+ {ab10a073-f437-43ba-b888-7df4ecb67e13}
+ PIMS_PROPERTY_MERGE
+ 0
+ 0
+ 0
+
+
+ 2024-02-05T22:43:26.2113404-08:00
+ ARIMA-DELL\smart
+ ARIMA-DELL
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+ {8025F2FD-D9A2-4353-9157-A87C7B09C318}
+ sd
+ 1
+ 0
+ 138
+
+
+ {019D3EAF-BB8C-4D79-BDBD-BA41B85631B2}
+ 8
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ false
+ 3
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ Data Source=sqldevtst.th.gov.bc.ca;User ID=PIMS_TST;Initial Catalog=PIMS_TST;Provider=SQLOLEDB.1;Persist Security Info=True;Auto Translate=False;Application Name=SSIS-Package-{A4157154-8FF2-477B-A4CA-636A021C5560}localhost,5433.pims.admin;
+ 18
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 1
+ 9
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ 5
+ 9
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ false
+ 3
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ PIMS_TST
+ 18
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 1
+ 18
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ false
+ 3
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ sqldevtst.th.gov.bc.ca
+ 18
+
+
+
+
+
+
+
+
+
+
+ 0
+ 0
+ 0
+ PIMS_TST
+ 18
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Development
+
+ bin
+
+
+
+
+ SQLServer2022
+ false
+
+
+
+
+
+
+
+ LastModifiedTime
+ LastModifiedTime
+ 2024-02-06T06:50:27.5563488Z
+
+
+
+
+
+
\ No newline at end of file
diff --git a/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.dtproj.user b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.dtproj.user
new file mode 100644
index 0000000000..0f69be98fb
--- /dev/null
+++ b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.dtproj.user
@@ -0,0 +1,27 @@
+
+
+
+
+ Development
+
+
+ false
+
+
+ ssistst.th.gov.bc.ca
+ /SSISDB/PIMS_TST/PIMS_PROPERTY_MERGE
+
+
+ false
+ true
+
+
+ LastModifiedTime
+ LastModifiedTime
+ 2024-02-06T06:50:27.5573469Z
+
+
+
+
+
+
\ No newline at end of file
diff --git a/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.dtsx b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.dtsx
new file mode 100644
index 0000000000..d0a3e64fab
--- /dev/null
+++ b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.dtsx
@@ -0,0 +1,734 @@
+
+
+ 8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+]]>
+
\ No newline at end of file
diff --git a/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.sln b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.sln
new file mode 100644
index 0000000000..3b7048db87
--- /dev/null
+++ b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.34031.81
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{C9674DCB-5085-4A16-B785-4C70DD1589BD}") = "PIMS_PROPERTY_MERGE", "PIMS_PROPERTY_MERGE.dtproj", "{8994A286-C849-4339-AC34-BE7EF96D25A2}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Development|Default = Development|Default
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8994A286-C849-4339-AC34-BE7EF96D25A2}.Development|Default.ActiveCfg = Development
+ {8994A286-C849-4339-AC34-BE7EF96D25A2}.Development|Default.Build.0 = Development
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {6E6A44AE-0984-4C69-A0F5-9903276F2359}
+ EndGlobalSection
+EndGlobal
diff --git a/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE_UPD.dtproj.user b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE_UPD.dtproj.user
new file mode 100644
index 0000000000..0f69be98fb
--- /dev/null
+++ b/etl/PIMS_PROPERTY_MERGE_UPD/PIMS_PROPERTY_MERGE_UPD.dtproj.user
@@ -0,0 +1,27 @@
+
+
+
+
+ Development
+
+
+ false
+
+
+ ssistst.th.gov.bc.ca
+ /SSISDB/PIMS_TST/PIMS_PROPERTY_MERGE
+
+
+ false
+ true
+
+
+ LastModifiedTime
+ LastModifiedTime
+ 2024-02-06T06:50:27.5573469Z
+
+
+
+
+
+
\ No newline at end of file
diff --git a/etl/PIMS_PROPERTY_MERGE_UPD/Project.params b/etl/PIMS_PROPERTY_MERGE_UPD/Project.params
new file mode 100644
index 0000000000..680ffe30da
--- /dev/null
+++ b/etl/PIMS_PROPERTY_MERGE_UPD/Project.params
@@ -0,0 +1,2 @@
+
+
\ No newline at end of file
diff --git a/etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION.dtproj b/etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION.dtproj
index bf9a26060b..ae7573c274 100644
--- a/etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION.dtproj
+++ b/etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION.dtproj
@@ -5,8 +5,8 @@
9.0.1.0
$base64$PFNvdXJjZUNvbnRyb2xJbmZvIHhtbG5zOnhzZD0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEiIHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zOmRkbDI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yIiB4bWxuczpkZGwyXzI9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDAzL2VuZ2luZS8yLzIiIHhtbG5zOmRkbDEwMF8xMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDA4L2VuZ2luZS8xMDAvMTAwIiB4bWxuczpkZGwyMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAiIHhtbG5zOmRkbDIwMF8yMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEwL2VuZ2luZS8yMDAvMjAwIiB4bWxuczpkZGwzMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAiIHhtbG5zOmRkbDMwMF8zMDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDExL2VuZ2luZS8zMDAvMzAwIiB4bWxuczpkZGw0MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAiIHhtbG5zOmRkbDQwMF80MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEyL2VuZ2luZS80MDAvNDAwIiB4bWxuczpkZGw1MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAiIHhtbG5zOmRkbDUwMF81MDA9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vYW5hbHlzaXNzZXJ2aWNlcy8yMDEzL2VuZ2luZS81MDAvNTAwIiB4bWxuczpkd2Q9Imh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vRGF0YVdhcmVob3VzZS9EZXNpZ25lci8xLjAiPg0KICA8RW5hYmxlZD5mYWxzZTwvRW5hYmxlZD4NCiAgPFByb2plY3ROYW1lPjwvUHJvamVjdE5hbWU+DQogIDxBdXhQYXRoPjwvQXV4UGF0aD4NCiAgPExvY2FsUGF0aD48L0xvY2FsUGF0aD4NCiAgPFByb3ZpZGVyPjwvUHJvdmlkZXI+DQo8L1NvdXJjZUNvbnRyb2xJbmZvPg==
- PIMS_PROPERTY_SPATIAL_CORRECTION 11.database
- PIMS_PROPERTY_SPATIAL_CORRECTION 11.database
+ PIMS_PROPERTY_SPATIAL_CORRECTION.database
+ PIMS_PROPERTY_SPATIAL_CORRECTION.database
@@ -41,10 +41,10 @@
Package
1
0
- 47
+ 57
- {C036C22A-FB08-4CA9-8625-018613EC0B33}
+ {D964A069-45BD-4156-8F06-443B81810E43}
8
@@ -77,7 +77,7 @@
0
0
0
- Data Source=sqldevtst.th.gov.bc.ca;Initial Catalog=PIMS_DEV;Provider=SQLNCLI11.1;Integrated Security=SSPI;Auto Translate=False;Application Name=SSIS-Package-{C854C770-B13C-477E-8DD4-44721E1B9FCF}sqldevtst.th.gov.bc.ca.PIMS_DEV;
+ Data Source=sqlprd.th.gov.bc.ca;User ID=PIMS_UAT;Initial Catalog=PIMS_UAT;Provider=SQLNCLI11.1;Auto Translate=False;Application Name=SSIS-Package-{C854C770-B13C-477E-8DD4-44721E1B9FCF}sqldevtst.th.gov.bc.ca.PIMS_DEV;
18
@@ -137,7 +137,7 @@
0
0
0
- PIMS_DEV
+ PIMS_UAT
18
@@ -181,7 +181,7 @@
0
0
0
- sqldevtst.th.gov.bc.ca
+ sqlprd.th.gov.bc.ca
18
@@ -196,6 +196,7 @@
0
0
0
+ PIMS_UAT
18
diff --git a/etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/Package.dtsx b/etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/SPATIAL_CORRECTION.dtsx
similarity index 79%
rename from etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/Package.dtsx
rename to etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/SPATIAL_CORRECTION.dtsx
index a19f112de1..7957b0057c 100644
--- a/etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/Package.dtsx
+++ b/etl/PIMS_PROPERTY_SPATIAL_CORRECTION/PIMS_PROPERTY_SPATIAL_CORRECTION/SPATIAL_CORRECTION.dtsx
@@ -12,8 +12,8 @@
DTS:ObjectName="Package"
DTS:PackageType="5"
DTS:ProtectionLevel="0"
- DTS:VersionBuild="47"
- DTS:VersionGUID="{C036C22A-FB08-4CA9-8625-018613EC0B33}">
+ DTS:VersionBuild="57"
+ DTS:VersionGUID="{D964A069-45BD-4156-8F06-443B81810E43}">
8
@@ -26,7 +26,11 @@
+ DTS:ConnectionString="Data Source=sqlprd.th.gov.bc.ca;User ID=PIMS_UAT;Initial Catalog=PIMS_UAT;Provider=SQLNCLI11.1;Auto Translate=False;Application Name=SSIS-Package-{C854C770-B13C-477E-8DD4-44721E1B9FCF}sqldevtst.th.gov.bc.ca.PIMS_DEV;">
+
+
@@ -162,7 +166,7 @@
dataType="System.String"
description="The SQL command to be executed."
name="SqlCommand"
- UITypeEditor="Microsoft.DataTransformationServices.Controls.ModalMultilineStringEditor, Microsoft.DataTransformationServices.Controls, Version=16.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91">select cast(BOUNDARY.STAsText() as varchar(max)) as BOUNDARY_TEXT, PROPERTY_ID from PIMS_PROPERTY WHERE BOUNDARY IS NOT NULL and APP_CREATE_USERID in ('APP_PIMS_PROXY_ETL_EDIT', 'LISDB_ETL_USER', 'PMBC_PIMS_BCTFA', 'LISOS_ETL_USER')
+ UITypeEditor="Microsoft.DataTransformationServices.Controls.ModalMultilineStringEditor, Microsoft.DataTransformationServices.Controls, Version=16.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91">select cast(BOUNDARY.STAsText() as varchar(max)) as BOUNDARY_TEXT, PROPERTY_ID from PIMS_PROPERTY WHERE BOUNDARY IS NOT NULL and APP_CREATE_USERID in ('APP_PIMS_PROXY_ETL_EDIT', 'LISDB_ETL_USER', 'PMBC_PIMS_BCTFA', 'LISOS_ETL_USER', 'PIMS_ETL_USER')
points = new List();
- foreach (Match match in matches)
+ PolyLabel.PolyLabel newPoint = null;
+ if (stringData.Contains("MULTIPOLYGON"))
{
- string[] latLng = match.Value.Split(' ');
- points.Add(new PointF(float.Parse(latLng[0]), float.Parse(latLng[1])));
+ string multiPolygonPattern = @"\([^()]*\)";
+ var polygonMatches = Regex.Matches(stringData, multiPolygonPattern, RegexOptions.None);
+ foreach (Match polygonMatch in polygonMatches)
+ {
+ var matches = Regex.Matches(polygonMatch.Value, pattern, RegexOptions.None);
+ PolyLabel.PolyLabel tempPoint = getPolygonCentroid(matches);
+ if(newPoint == null || tempPoint.Radius > newPoint.Radius)
+ {
+ newPoint = tempPoint;
+ }
+ }
}
-
- var newPoint = PolyLabel.PolyLabel.GetPolyLabel(points, .1f);
+ else
+ {
+ var matches = Regex.Matches(stringData, pattern, RegexOptions.None);
+ newPoint = getPolygonCentroid(matches);
+ }
+
var bytes = Encoding.UTF8.GetBytes($"POINT ({newPoint.Centroid.X} {newPoint.Centroid.Y})");
Row.POLEOFINACCESSABILITY.AddBlobData(bytes);
@@ -575,6 +592,19 @@ public class ScriptMain : UserComponent
}
}
+ public static PolyLabel.PolyLabel getPolygonCentroid(MatchCollection matches)
+ {
+ List points = new List();
+ foreach (Match match in matches)
+ {
+ string[] latLng = match.Value.Split(' ');
+ points.Add(new PointF(float.Parse(latLng[0]), float.Parse(latLng[1])));
+ }
+
+ var newPoint = PolyLabel.PolyLabel.GetPolyLabel(points, .1f);
+ return newPoint;
+ }
+
}
]]>
SC_4664d38d6d774888963e21557351c901
msBuild
SC_4664d38d6d774888963e21557351c901
- {9DFA908A-4CC6-4FE2-93C1-582187F61F61}
+ {5E55CC12-CF24-4606-A224-6AA9B352D30C}
@@ -1010,6 +1040,18 @@ public class Input0Buffer: ScriptBuffer
+
+ main.cs
+ 142
+ 17
+ True
+ 1
+
+
+ C#
+ 1
+ 1
+
]]>
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAA==]]>
name="BreakpointCollection"
typeConverter="NOTBROWSABLE">
+ arrayElementCount="1">
+ <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:clr="http://schemas.microsoft.com/soap/encoding/clr/1.0" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
+<SOAP-ENV:Body>
+<a1:ScriptBreakpointInfo id="ref-1" xmlns:a1="http://schemas.microsoft.com/clr/nsassem/Microsoft.SqlServer.VSTAHosting/Microsoft.SqlServer.VSTAScriptingLib%2C%20Version%3D14.0.0.0%2C%20Culture%3Dneutral%2C%20PublicKeyToken%3D89845dcd8080cc91">
+<Enabled>true</Enabled>
+<File id="ref-3">main.cs</File>
+<FileLine>142</FileLine>
+<FileColumn>17</FileColumn>
+</a1:ScriptBreakpointInfo>
+</SOAP-ENV:Body>
+</SOAP-ENV:Envelope>
+
+
Size="209,42"
Id="Package\Create Temp Output Table"
TopLeft="53,5.5" />
+
+
@@ -3315,10 +3387,6 @@ AAAAAAAAAAAAAAA=]]>
-
@@ -3341,10 +3409,6 @@ AAAAAAAAAAAAAAA=]]>
-
@@ -3375,43 +3439,61 @@ AAAAAAAAAAAAAAA=]]>
+
-
+
+ Id="Package\Correct PIMS Locations.Paths[VALID_NEW_LOCATION]"
+ TopLeft="143,251.5">
+ End="313.5,67">
+ End="0,33.25" />
+
+
+
+
-
+
+ Id="Package\Correct PIMS Locations.Paths[Output 0]"
+ TopLeft="143,149.5">
-
+ Id="Package\Correct PIMS Locations.Paths[OLE DB Source Output]"
+ TopLeft="143,47.5">
+ End="0,52.5">
-
-
-
-
+ End="0,52.5" />
-
+
+ design-time-name="Package\Correct PIMS Locations\Store Location In Temp Table">
DataSourceViewID
@@ -3483,12 +3547,12 @@ AAAAAAAAAAAAAAA=]]>
TableInfoObjectType
View
+ type="q2:string">Table
+ design-time-name="Package\Correct PIMS Locations\PIMS_PROPERTY_BOUNDARY_VIEW">
DataSourceViewID
@@ -3496,7 +3560,7 @@ AAAAAAAAAAAAAAA=]]>
TableInfoObjectType
Table
+ type="q2:string">View
diff --git a/source/backend/Backup/Pims.sln b/source/backend/Backup/Pims.sln
deleted file mode 100644
index b2365f8c86..0000000000
--- a/source/backend/Backup/Pims.sln
+++ /dev/null
@@ -1,254 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.29728.190
-MinimumVisualStudioVersion = 15.0.26124.0
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Api", "api\Pims.Api.csproj", "{16BC0468-78F6-4C91-87DA-7403C919E646}"
- ProjectSection(ProjectDependencies) = postProject
- {1ED5DF03-7784-44EC-B02B-516167210CCF} = {1ED5DF03-7784-44EC-B02B-516167210CCF}
- EndProjectSection
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal", "dal\Pims.Dal.csproj", "{6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Entities", "entities\Pims.Dal.Entities.csproj", "{1C724CD5-CD24-46CD-835A-A83F673F97B5}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Keycloak", "keycloak\Pims.Keycloak.csproj", "{970903E9-BC53-436F-BA77-C62349546425}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Core", "core\Pims.Core.csproj", "{AC8F04FF-3164-41FB-9EDF-E468B8B77837}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Keycloak", "dal.keycloak\Pims.Dal.Keycloak.csproj", "{5697DD19-62CC-4377-ABA8-1E192376F4F6}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "root", "root", "{8D3E4CB2-41D6-4AA6-B9E4-CFCAB0E2F5BC}"
- ProjectSection(SolutionItems) = preProject
- .dockerignore = .dockerignore
- .editorconfig = .editorconfig
- .gitignore = .gitignore
- Dockerfile = Dockerfile
- Dockerfile.bak = Dockerfile.bak
- entrypoint.sh = entrypoint.sh
- README.md = README.md
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libraries", "libraries", "{5237F8A4-67F5-4751-B8B2-B93A06791480}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{A0343C94-486E-4A06-9A64-0584D20A4728}"
- ProjectSection(SolutionItems) = preProject
- docs\API.md = docs\API.md
- docs\DAL.md = docs\DAL.md
- docs\DATABASE.md = docs\DATABASE.md
- docs\GITHUB-ACTIONS.md = docs\GITHUB-ACTIONS.md
- docs\SETUP.md = docs\SETUP.md
- docs\TOOLS.md = docs\TOOLS.md
- docs\VERSIONING.md = docs\VERSIONING.md
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{F256F2A5-0DBF-4137-A7D6-21F08111BD4A}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unit", "unit", "{3D70B211-74A8-484C-9B86-B0A2835C71E7}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Api.Test", "tests\unit\api\Pims.Api.Test.csproj", "{1F4E301C-F03B-4A31-A6F2-6A77384A74DA}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Test", "tests\unit\dal\Pims.Dal.Test.csproj", "{412BF533-2759-4FBE-B4C6-B89DB44FB6B5}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "core", "core", "{04780892-FC30-4B6B-A10C-5795C657E574}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Core.Test", "tests\core\Pims.Core.Test.csproj", "{5A83C636-741A-4795-8588-70F033E79B5A}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Geocoder", "geocoder\Pims.Geocoder.csproj", "{BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Ltsa", "ltsa\Pims.Ltsa.csproj", "{1ED5DF03-7784-44EC-B02B-516167210CCF}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Dal.Mock.Test", "tests\unit\mockdal\Pims.Dal.Mock.Test.csproj", "{2C31E92C-9C95-45FF-9F95-928C2962F37D}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Pims.Av", "clamav\Pims.Av.csproj", "{16C06BDA-112F-4D04-82FF-0BBE45072372}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|Any CPU = Release|Any CPU
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|x64.ActiveCfg = Debug|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|x64.Build.0 = Debug|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|x86.ActiveCfg = Debug|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Debug|x86.Build.0 = Debug|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|Any CPU.Build.0 = Release|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x64.ActiveCfg = Release|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x64.Build.0 = Release|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x86.ActiveCfg = Release|Any CPU
- {16BC0468-78F6-4C91-87DA-7403C919E646}.Release|x86.Build.0 = Release|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Debug|x64.ActiveCfg = Debug|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Debug|x64.Build.0 = Debug|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Debug|x86.ActiveCfg = Debug|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Debug|x86.Build.0 = Debug|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Release|Any CPU.Build.0 = Release|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Release|x64.ActiveCfg = Release|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Release|x64.Build.0 = Release|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Release|x86.ActiveCfg = Release|Any CPU
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3}.Release|x86.Build.0 = Release|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Debug|x64.ActiveCfg = Debug|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Debug|x64.Build.0 = Debug|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Debug|x86.Build.0 = Debug|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Release|Any CPU.Build.0 = Release|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Release|x64.ActiveCfg = Release|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Release|x64.Build.0 = Release|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Release|x86.ActiveCfg = Release|Any CPU
- {1C724CD5-CD24-46CD-835A-A83F673F97B5}.Release|x86.Build.0 = Release|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Debug|x64.ActiveCfg = Debug|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Debug|x64.Build.0 = Debug|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Debug|x86.ActiveCfg = Debug|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Debug|x86.Build.0 = Debug|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Release|Any CPU.Build.0 = Release|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Release|x64.ActiveCfg = Release|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Release|x64.Build.0 = Release|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Release|x86.ActiveCfg = Release|Any CPU
- {970903E9-BC53-436F-BA77-C62349546425}.Release|x86.Build.0 = Release|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|x64.ActiveCfg = Debug|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|x64.Build.0 = Debug|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|x86.ActiveCfg = Debug|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Debug|x86.Build.0 = Debug|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|Any CPU.Build.0 = Release|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|x64.ActiveCfg = Release|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|x64.Build.0 = Release|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|x86.ActiveCfg = Release|Any CPU
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837}.Release|x86.Build.0 = Release|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Debug|x64.ActiveCfg = Debug|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Debug|x64.Build.0 = Debug|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Debug|x86.ActiveCfg = Debug|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Debug|x86.Build.0 = Debug|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Release|Any CPU.Build.0 = Release|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Release|x64.ActiveCfg = Release|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Release|x64.Build.0 = Release|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Release|x86.ActiveCfg = Release|Any CPU
- {5697DD19-62CC-4377-ABA8-1E192376F4F6}.Release|x86.Build.0 = Release|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Debug|x64.ActiveCfg = Debug|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Debug|x64.Build.0 = Debug|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Debug|x86.Build.0 = Debug|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Release|Any CPU.Build.0 = Release|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Release|x64.ActiveCfg = Release|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Release|x64.Build.0 = Release|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Release|x86.ActiveCfg = Release|Any CPU
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA}.Release|x86.Build.0 = Release|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Debug|x64.ActiveCfg = Debug|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Debug|x64.Build.0 = Debug|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Debug|x86.ActiveCfg = Debug|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Debug|x86.Build.0 = Debug|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Release|Any CPU.Build.0 = Release|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Release|x64.ActiveCfg = Release|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Release|x64.Build.0 = Release|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Release|x86.ActiveCfg = Release|Any CPU
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5}.Release|x86.Build.0 = Release|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Debug|x64.ActiveCfg = Debug|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Debug|x64.Build.0 = Debug|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Debug|x86.ActiveCfg = Debug|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Debug|x86.Build.0 = Debug|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Release|Any CPU.Build.0 = Release|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Release|x64.ActiveCfg = Release|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Release|x64.Build.0 = Release|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Release|x86.ActiveCfg = Release|Any CPU
- {5A83C636-741A-4795-8588-70F033E79B5A}.Release|x86.Build.0 = Release|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Debug|x64.ActiveCfg = Debug|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Debug|x64.Build.0 = Debug|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Debug|x86.ActiveCfg = Debug|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Debug|x86.Build.0 = Debug|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Release|Any CPU.Build.0 = Release|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Release|x64.ActiveCfg = Release|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Release|x64.Build.0 = Release|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Release|x86.ActiveCfg = Release|Any CPU
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC}.Release|x86.Build.0 = Release|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Debug|x64.ActiveCfg = Debug|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Debug|x64.Build.0 = Debug|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Debug|x86.ActiveCfg = Debug|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Debug|x86.Build.0 = Debug|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Release|Any CPU.Build.0 = Release|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Release|x64.ActiveCfg = Release|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Release|x64.Build.0 = Release|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Release|x86.ActiveCfg = Release|Any CPU
- {1ED5DF03-7784-44EC-B02B-516167210CCF}.Release|x86.Build.0 = Release|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Debug|x64.ActiveCfg = Debug|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Debug|x64.Build.0 = Debug|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Debug|x86.ActiveCfg = Debug|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Debug|x86.Build.0 = Debug|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Release|Any CPU.Build.0 = Release|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Release|x64.ActiveCfg = Release|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Release|x64.Build.0 = Release|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Release|x86.ActiveCfg = Release|Any CPU
- {2C31E92C-9C95-45FF-9F95-928C2962F37D}.Release|x86.Build.0 = Release|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|x64.ActiveCfg = Debug|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|x64.Build.0 = Debug|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|x86.ActiveCfg = Debug|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Debug|x86.Build.0 = Debug|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|Any CPU.Build.0 = Release|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x64.ActiveCfg = Release|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x64.Build.0 = Release|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x86.ActiveCfg = Release|Any CPU
- {16C06BDA-112F-4D04-82FF-0BBE45072372}.Release|x86.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {6DFFF5E1-1B87-403B-99D0-A9E03D8A8EB3} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
- {1C724CD5-CD24-46CD-835A-A83F673F97B5} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
- {970903E9-BC53-436F-BA77-C62349546425} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
- {AC8F04FF-3164-41FB-9EDF-E468B8B77837} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
- {5697DD19-62CC-4377-ABA8-1E192376F4F6} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
- {3D70B211-74A8-484C-9B86-B0A2835C71E7} = {F256F2A5-0DBF-4137-A7D6-21F08111BD4A}
- {1F4E301C-F03B-4A31-A6F2-6A77384A74DA} = {3D70B211-74A8-484C-9B86-B0A2835C71E7}
- {412BF533-2759-4FBE-B4C6-B89DB44FB6B5} = {3D70B211-74A8-484C-9B86-B0A2835C71E7}
- {04780892-FC30-4B6B-A10C-5795C657E574} = {F256F2A5-0DBF-4137-A7D6-21F08111BD4A}
- {5A83C636-741A-4795-8588-70F033E79B5A} = {04780892-FC30-4B6B-A10C-5795C657E574}
- {BF7450E8-B3C5-46FB-BEC1-C5FC1C5964DC} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
- {1ED5DF03-7784-44EC-B02B-516167210CCF} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
- {2C31E92C-9C95-45FF-9F95-928C2962F37D} = {3D70B211-74A8-484C-9B86-B0A2835C71E7}
- {16C06BDA-112F-4D04-82FF-0BBE45072372} = {5237F8A4-67F5-4751-B8B2-B93A06791480}
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {3433C5DD-DC49-4A96-A1AE-90C1A1EBA87C}
- EndGlobalSection
-EndGlobal
diff --git a/source/backend/Dockerfile b/source/backend/Dockerfile
index aa48c92424..d972bedba6 100644
--- a/source/backend/Dockerfile
+++ b/source/backend/Dockerfile
@@ -9,8 +9,8 @@ WORKDIR /src
COPY *.sln .
COPY Directory.Build.props .
COPY api/*.csproj api/
-COPY entities/*.csproj entities/
COPY apimodels/*.csproj apimodels/
+COPY entities/*.csproj entities/
COPY tests/core/*.csproj tests/core/
COPY tests/unit/api/*.csproj tests/unit/api/
COPY tests/unit/dal/*.csproj tests/unit/dal/
diff --git a/source/backend/api/Areas/Property/Controllers/PropertyController.cs b/source/backend/api/Areas/Property/Controllers/PropertyController.cs
index 95803dc8d7..dd567c16a9 100644
--- a/source/backend/api/Areas/Property/Controllers/PropertyController.cs
+++ b/source/backend/api/Areas/Property/Controllers/PropertyController.cs
@@ -95,12 +95,28 @@ public IActionResult GetConceptPropertyWithId(long id)
[ProducesResponseType(typeof(PropertyModel), 200)]
[SwaggerOperation(Tags = new[] { "property" })]
[TypeFilter(typeof(NullJsonResultFilter))]
- public IActionResult GetConceptPropertyWithId(string pid)
+ public IActionResult GetConceptPropertyWithPid(string pid)
{
var property = _propertyService.GetByPid(pid);
return new JsonResult(_mapper.Map(property));
}
+ ///
+ /// Get the property for the specified 'pin'.
+ ///
+ ///
+ [HttpGet("pin/{pin:int}")]
+ [HasPermission(Permissions.PropertyView)]
+ [Produces("application/json")]
+ [ProducesResponseType(typeof(PropertyModel), 200)]
+ [SwaggerOperation(Tags = new[] { "property" })]
+ [TypeFilter(typeof(NullJsonResultFilter))]
+ public IActionResult GetConceptPropertyWithPin(int pin)
+ {
+ var property = _propertyService.GetByPin(pin);
+ return new JsonResult(_mapper.Map(property));
+ }
+
///
/// Get the properties for the specified set of ids.
///
diff --git a/source/backend/api/Areas/Property/Controllers/SearchController.cs b/source/backend/api/Areas/Property/Controllers/SearchController.cs
index 649d8b55e3..fc78a64166 100644
--- a/source/backend/api/Areas/Property/Controllers/SearchController.cs
+++ b/source/backend/api/Areas/Property/Controllers/SearchController.cs
@@ -58,7 +58,7 @@ public SearchController(IPropertyRepository propertyRepository, IMapper mapper)
[HttpGet]
[HasPermission(Permissions.PropertyView)]
[Produces("application/json")]
- [ProducesResponseType(typeof(PageModel), 200)]
+ [ProducesResponseType(typeof(PageModel), 200)]
[SwaggerOperation(Tags = new[] { "property" })]
public IActionResult GetProperties()
{
@@ -75,7 +75,7 @@ public IActionResult GetProperties()
[HttpPost("filter")]
[HasPermission(Permissions.PropertyView)]
[Produces("application/json")]
- [ProducesResponseType(typeof(PageModel), 200)]
+ [ProducesResponseType(typeof(PageModel), 200)]
[SwaggerOperation(Tags = new[] { "property" })]
public IActionResult GetProperties([FromBody] PropertyFilterModel filter)
{
@@ -86,7 +86,7 @@ public IActionResult GetProperties([FromBody] PropertyFilterModel filter)
}
var page = _propertyRepository.GetPage((PropertyFilter)filter);
- var result = _mapper.Map>(page);
+ var result = _mapper.Map>(page);
return new JsonResult(result);
}
diff --git a/source/backend/api/Areas/Property/Models/PropertyFilterModel.cs b/source/backend/api/Areas/Property/Models/PropertyFilterModel.cs
index 8fe7f147ac..8eed2b97ff 100644
--- a/source/backend/api/Areas/Property/Models/PropertyFilterModel.cs
+++ b/source/backend/api/Areas/Property/Models/PropertyFilterModel.cs
@@ -62,7 +62,7 @@ public PropertyFilterModel(Dictionary
- /// Update the list of takes associated to a property within an acquisition file.
+ /// Add the passed take to the acquisition property with the given id.
///
///
- [HttpPut("acquisition/property/{acquisitionFilePropertyId:long}")]
+ [HttpPost("acquisition/property/{acquisitionFilePropertyId:long}/takes")]
[HasPermission(Permissions.AcquisitionFileEdit, Permissions.PropertyEdit)]
[Produces("application/json")]
- [ProducesResponseType(typeof(IEnumerable), 200)]
+ [ProducesResponseType(typeof(TakeModel), 201)]
+ [SwaggerOperation(Tags = new[] { "take" })]
+ [TypeFilter(typeof(NullJsonResultFilter))]
+ public IActionResult AddAcquisitionPropertyTake(long acquisitionFilePropertyId, [FromBody] TakeModel take)
+ {
+ _logger.LogInformation(
+ "Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
+ nameof(TakeController),
+ nameof(AddAcquisitionPropertyTake),
+ User.GetUsername(),
+ DateTime.Now);
+
+ if (acquisitionFilePropertyId != take.PropertyAcquisitionFileId)
+ {
+ throw new BadRequestException("Invalid acquisition file property id.");
+ }
+
+ _logger.LogInformation("Dispatching to service: {Service}", _takeService.GetType());
+
+ var addedTake = _takeService.AddAcquisitionPropertyTake(acquisitionFilePropertyId, _mapper.Map(take));
+ return new JsonResult(_mapper.Map(addedTake));
+ }
+
+ ///
+ /// Update a take with the given take and acquisition file property id with the passed take.
+ ///
+ ///
+ [HttpPut("acquisition/property/{acquisitionFilePropertyId:long}/takes/{takeId:long}")]
+ [HasPermission(Permissions.AcquisitionFileEdit, Permissions.PropertyEdit)]
+ [Produces("application/json")]
+ [ProducesResponseType(typeof(TakeModel), 200)]
[SwaggerOperation(Tags = new[] { "take" })]
[TypeFilter(typeof(NullJsonResultFilter))]
- public IActionResult UpdateAcquisitionPropertyTakes(long acquisitionFilePropertyId, [FromBody] IEnumerable takes)
+ public IActionResult UpdateAcquisitionPropertyTake(long acquisitionFilePropertyId, long takeId, [FromBody] TakeModel take)
{
_logger.LogInformation(
"Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
nameof(TakeController),
- nameof(UpdateAcquisitionPropertyTakes),
+ nameof(UpdateAcquisitionPropertyTake),
User.GetUsername(),
DateTime.Now);
+ if (acquisitionFilePropertyId != take.PropertyAcquisitionFileId)
+ {
+ throw new BadRequestException("Invalid acquisition file property id.");
+ }
+ else if (takeId != take.Id)
+ {
+ throw new BadRequestException("Invalid take id.");
+ }
+
_logger.LogInformation("Dispatching to service: {Service}", _takeService.GetType());
- var updatedTakes = _takeService.UpdateAcquisitionPropertyTakes(acquisitionFilePropertyId, _mapper.Map>(takes));
- return new JsonResult(_mapper.Map>(updatedTakes));
+ var updatedTake = _takeService.UpdateAcquisitionPropertyTake(acquisitionFilePropertyId, _mapper.Map(take));
+ return new JsonResult(_mapper.Map(updatedTake));
+ }
+
+ ///
+ /// Delete a take with the given take id and acquisition file property id.
+ ///
+ [HttpDelete("acquisition/property/{acquisitionFilePropertyId:long}/takes/{takeId:long}")]
+ [HasPermission(Permissions.AcquisitionFileEdit, Permissions.PropertyEdit)]
+ [Produces("application/json")]
+ [ProducesResponseType(typeof(void), 200)]
+ [SwaggerOperation(Tags = new[] { "take" })]
+ [TypeFilter(typeof(NullJsonResultFilter))]
+ public void DeleteAcquisitionPropertyTake(long acquisitionFilePropertyId, long takeId, [FromQuery] string[] userOverrideCodes)
+ {
+ _logger.LogInformation(
+ "Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
+ nameof(TakeController),
+ nameof(DeleteAcquisitionPropertyTake),
+ User.GetUsername(),
+ DateTime.Now);
+
+ _logger.LogInformation("Dispatching to service: {Service}", _takeService.GetType());
+ var existingTake = _takeService.GetById(takeId);
+ if (existingTake.PropertyAcquisitionFileId != acquisitionFilePropertyId)
+ {
+ throw new BadRequestException("Invalid acquisition file property id.");
+ }
+ var deleted = _takeService.DeleteAcquisitionPropertyTake(takeId, userOverrideCodes.Select(oc => UserOverrideCode.Parse(oc)));
+ if (!deleted)
+ {
+ throw new InvalidOperationException($"Failed to delete take {takeId}.");
+ }
}
///
@@ -152,6 +225,34 @@ public IActionResult GetTakesCountByPropertyId([FromRoute] long propertyId)
return new JsonResult(count);
}
+ ///
+ /// GGet a take by id.
+ ///
+ ///
+ [HttpGet("acquisition/property/{acquisitionFilePropertyId:long}/takes/{takeId:long}")]
+ [HasPermission(Permissions.AcquisitionFileView, Permissions.PropertyView)]
+ [Produces("application/json")]
+ [ProducesResponseType(typeof(int), 200)]
+ [SwaggerOperation(Tags = new[] { "take" })]
+ public IActionResult GetTakeByPropertyFileId(long acquisitionFilePropertyId, long takeId)
+ {
+ _logger.LogInformation(
+ "Request received by Controller: {Controller}, Action: {ControllerAction}, User: {User}, DateTime: {DateTime}",
+ nameof(TakeController),
+ nameof(GetTakesCountByPropertyId),
+ User.GetUsername(),
+ DateTime.Now);
+
+ _logger.LogInformation("Dispatching to service: {Service}", _takeService.GetType());
+
+ var take = _takeService.GetById(takeId);
+ if(take.PropertyAcquisitionFileId != acquisitionFilePropertyId)
+ {
+ throw new BadRequestException("Invalid acquisition file property id.");
+ }
+ return new JsonResult(_mapper.Map(take));
+ }
+
#endregion
}
}
diff --git a/source/backend/api/Areas/Tools/Mappers/SitePidsResponseMap.cs b/source/backend/api/Areas/Tools/Mappers/SitePidsResponseMap.cs
index a7ec355323..c75a7c5ca1 100644
--- a/source/backend/api/Areas/Tools/Mappers/SitePidsResponseMap.cs
+++ b/source/backend/api/Areas/Tools/Mappers/SitePidsResponseMap.cs
@@ -18,9 +18,9 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.Pids, src => StringToList(src.Pids));
}
- private static IEnumerable StringToList(string commaSeparated)
+ private static IEnumerable StringToList(string delimSeperated)
{
- return commaSeparated != null ? commaSeparated.Split(",") : Array.Empty();
+ return delimSeperated != null ? delimSeperated.Split('|', ',') : Array.Empty();
}
}
}
diff --git a/source/backend/api/Constants/EnumDispositionFileStatusTypeCode.cs b/source/backend/api/Constants/EnumDispositionFileStatusTypeCode.cs
deleted file mode 100644
index 4f562bc2ce..0000000000
--- a/source/backend/api/Constants/EnumDispositionFileStatusTypeCode.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System.Runtime.Serialization;
-
-namespace Pims.Api.Constants
-{
- public enum EnumDispositionFileStatusTypeCode
- {
- [EnumMember(Value = "ACTIVE")]
- ACTIVE,
-
- [EnumMember(Value = "ARCHIVED")]
- ARCHIVED,
-
- [EnumMember(Value = "CANCELLED")]
- CANCELLED,
-
- [EnumMember(Value = "COMPLETE")]
- COMPLETE,
-
- [EnumMember(Value = "DRAFT")]
- DRAFT,
-
- [EnumMember(Value = "HOLD")]
- HOLD,
- }
-}
diff --git a/source/backend/api/Models/Configuration/MayanConfig.cs b/source/backend/api/Models/Configuration/MayanConfig.cs
index 0a34837759..9a9492002f 100644
--- a/source/backend/api/Models/Configuration/MayanConfig.cs
+++ b/source/backend/api/Models/Configuration/MayanConfig.cs
@@ -9,5 +9,7 @@ public class MayanConfig
public string ConnectionUser { get; set; }
public string ConnectionPassword { get; set; }
+
+ public int UploadRetries { get; set; }
}
}
diff --git a/source/backend/api/Pims.Api.csproj b/source/backend/api/Pims.Api.csproj
index 30514acdba..d59b215a43 100644
--- a/source/backend/api/Pims.Api.csproj
+++ b/source/backend/api/Pims.Api.csproj
@@ -2,9 +2,9 @@
0ef6255f-9ea0-49ec-8c65-c172304b4926
- 5.1.2-76.36
- 5.1.2-76.36
- 5.1.2.76
+ 5.2.4-79.18
+ 5.2.4-79.18
+ 5.2.4.79
true
16BC0468-78F6-4C91-87DA-7403C919E646
net8.0
@@ -76,4 +76,4 @@
-
\ No newline at end of file
+
diff --git a/source/backend/api/Services/AcquisitionFileService.cs b/source/backend/api/Services/AcquisitionFileService.cs
index aefa915477..d2b0118a32 100644
--- a/source/backend/api/Services/AcquisitionFileService.cs
+++ b/source/backend/api/Services/AcquisitionFileService.cs
@@ -15,7 +15,6 @@
using Pims.Dal.Exceptions;
using Pims.Dal.Helpers;
using Pims.Dal.Helpers.Extensions;
-using Pims.Dal.Models;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
@@ -23,8 +22,6 @@ namespace Pims.Api.Services
{
public class AcquisitionFileService : IAcquisitionFileService
{
- private static readonly string[] COREINVENTORYINTERESTCODES = { "Section 15", "Section 17", "NOI", "Section 66" };
-
private readonly ClaimsPrincipal _user;
private readonly ILogger _logger;
private readonly IAcquisitionFileRepository _acqFileRepository;
@@ -127,7 +124,7 @@ public List GetAcquisitionFileExport(AcquisitionFilt
FileFunding = fileProperty.file.AcquisitionFundingTypeCodeNavigation is not null ? fileProperty.file.AcquisitionFundingTypeCodeNavigation.Description : string.Empty,
FileAssignedDate = fileProperty.file.AssignedDate.HasValue ? fileProperty.file.AssignedDate.Value.ToString("dd-MMM-yyyy") : string.Empty,
FileDeliveryDate = fileProperty.file.DeliveryDate.HasValue ? fileProperty.file.DeliveryDate.Value.ToString("dd-MMM-yyyy") : string.Empty,
- FileAcquisitionCompleted = fileProperty.file.CompletionDate.HasValue ? fileProperty.file.CompletionDate.Value.ToString("dd-MMM-yyyy") : string.Empty,
+ //FileAcquisitionCompleted = fileProperty.file.CompletionDate.HasValue ? fileProperty.file.CompletionDate.Value.ToString("dd-MMM-yyyy") : string.Empty, TODO: Fix mappings
FilePhysicalStatus = fileProperty.file.AcqPhysFileStatusTypeCodeNavigation is not null ? fileProperty.file.AcqPhysFileStatusTypeCodeNavigation.Description : string.Empty,
FileAcquisitionType = fileProperty.file.AcquisitionTypeCodeNavigation is not null ? fileProperty.file.AcquisitionTypeCodeNavigation.Description : string.Empty,
FileAcquisitionTeam = string.Join(", ", fileProperty.file.PimsAcquisitionFileTeams.Select(x => x.PersonId.HasValue ? x.Person.GetFullName(true) : x.Organization.Name)),
@@ -253,12 +250,12 @@ public PimsAcquisitionFile Update(PimsAcquisitionFile acquisitionFile, IEnumerab
if (currentAcquisitionStatus != AcquisitionStatusTypes.COMPLT && acquisitionFile.AcquisitionFileStatusTypeCode == AcquisitionStatusTypes.COMPLT.ToString())
{
- ValidateDrafts(acquisitionFile);
+ ValidateDraftsOnComplete(acquisitionFile);
}
if (!_statusSolver.CanEditDetails(currentAcquisitionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
if (!userOverrides.Contains(UserOverrideCode.UpdateRegion))
@@ -266,11 +263,6 @@ public PimsAcquisitionFile Update(PimsAcquisitionFile acquisitionFile, IEnumerab
ValidateMinistryRegion(acquisitionFile.Internal_Id, acquisitionFile.RegionCode);
}
- if (acquisitionFile.AcquisitionFileStatusTypeCode == AcquisitionStatusTypes.COMPLT.ToString())
- {
- TransferPropertiesOfInterest(acquisitionFile, userOverrides.Contains(UserOverrideCode.PoiToInventory));
- }
-
ValidateStaff(acquisitionFile);
ValidateOrganizationStaff(acquisitionFile);
@@ -309,7 +301,7 @@ public PimsAcquisitionFile UpdateProperties(PimsAcquisitionFile acquisitionFile,
AcquisitionStatusTypes? currentAcquisitionStatus = GetCurrentAcquisitionStatus(acquisitionFile.Internal_Id);
if (!_statusSolver.CanEditProperties(currentAcquisitionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
// Get the current properties in the research file
@@ -345,18 +337,14 @@ public PimsAcquisitionFile UpdateProperties(PimsAcquisitionFile acquisitionFile,
throw new BusinessRuleViolationException("You must remove all takes and interest holders from an acquisition file property before removing that property from an acquisition file");
}
_acquisitionFilePropertyRepository.Delete(deletedProperty);
- if (deletedProperty.Property.IsPropertyOfInterest)
+
+ var totalAssociationCount = _propertyRepository.GetAllAssociationsCountById(deletedProperty.PropertyId);
+ if (totalAssociationCount <= 1)
{
- PimsProperty propertyWithAssociations = _propertyRepository.GetAllAssociationsById(deletedProperty.PropertyId);
- var leaseAssociationCount = propertyWithAssociations.PimsPropertyLeases.Count;
- var researchAssociationCount = propertyWithAssociations.PimsPropertyResearchFiles.Count;
- var acquisitionAssociationCount = propertyWithAssociations.PimsPropertyAcquisitionFiles.Count;
- if (leaseAssociationCount + researchAssociationCount == 0 && acquisitionAssociationCount <= 1 && deletedProperty?.Property?.IsPropertyOfInterest == true)
- {
- _acqFileRepository.CommitTransaction(); // TODO: this can only be removed if cascade deletes are implemented. EF executes deletes in alphabetic order.
- _propertyRepository.Delete(deletedProperty.Property);
- }
+ _acqFileRepository.CommitTransaction(); // TODO: this can only be removed if cascade deletes are implemented. EF executes deletes in alphabetic order.
+ _propertyRepository.Delete(deletedProperty.Property);
}
+
}
_acqFileRepository.CommitTransaction();
@@ -380,7 +368,7 @@ public PimsAcquisitionFile UpdateChecklistItems(IList UpdateInterestHolders(long acquisitionFil
var currentAcquisitionStatus = GetCurrentAcquisitionStatus(acquisitionFileId);
if (!_statusSolver.CanEditStakeholders(currentAcquisitionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
var currentInterestHolders = _interestHolderRepository.GetInterestHoldersByAcquisitionFile(acquisitionFileId);
@@ -717,7 +705,7 @@ private void ValidateMinistryRegion(long acqFileId, short updatedRegion)
}
}
- private void ValidateDrafts(PimsAcquisitionFile incomingFile)
+ private void ValidateDraftsOnComplete(PimsAcquisitionFile incomingFile)
{
var agreements = _agreementRepository.GetAgreementsByAcquisitionFile(incomingFile.AcquisitionFileId);
var compensations = _compensationRequisitionRepository.GetAllByAcquisitionFileId(incomingFile.AcquisitionFileId);
@@ -728,6 +716,12 @@ private void ValidateDrafts(PimsAcquisitionFile incomingFile)
}
var takes = _takeRepository.GetAllByAcquisitionFileId(incomingFile.AcquisitionFileId);
+
+ if (!takes.Any())
+ {
+ throw new BusinessRuleViolationException("You cannot complete an acquisition file that has no takes.");
+ }
+
if (takes.Any(t => t.TakeStatusTypeCode == AcquisitionTakeStatusTypes.INPROGRESS.ToString()))
{
throw new BusinessRuleViolationException("Please ensure all in-progress property takes have been completed or canceled before completing an Acquisition File.");
@@ -741,84 +735,7 @@ private void ValidateAcquisitionFileStatus(long acquisitionFileId, string agreem
if (!_statusSolver.CanEditOrDeleteAgreement(currentAcquisitionStatus, agreementStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
- }
- }
-
- ///
- /// Attempt to transfer properties of interest to core inventory when an acquisition file is deemed to be completed.
- ///
- /// By default, do not allow a property of interest to be modified unless the userOverride flag is true.
- ///
- ///
- ///
- private void TransferPropertiesOfInterest(PimsAcquisitionFile acquisitionFile, bool userOverride = false)
- {
- // Get the current properties in the research file
- var currentProperties = _acquisitionFilePropertyRepository.GetPropertiesByAcquisitionFileId(acquisitionFile.Internal_Id);
-
- // PSP-6111 Business rule: Transfer properties of interest to core inventory when acquisition file is completed
- // PSP-7892 Business rule: Process all properties in the acq file (not only properties of interest).
- foreach (var acquisitionProperty in currentProperties)
- {
- var property = acquisitionProperty.Property;
- var takes = _takeRepository.GetAllByPropertyAcquisitionFileId(acquisitionProperty.Internal_Id);
-
- var activeTakes = takes.Where(t =>
- !(t.IsNewLandAct && t.LandActEndDt.HasValue && t.LandActEndDt.Value < DateOnly.FromDateTime(DateTime.Now)) &&
- !(t.IsNewLicenseToConstruct && t.LtcEndDt.HasValue && t.LtcEndDt.Value < DateOnly.FromDateTime(DateTime.Now)) &&
- !(t.IsNewInterestInSrw && t.SrwEndDt.HasValue && t.SrwEndDt.Value < DateOnly.FromDateTime(DateTime.Now)));
-
- // see psp-6589 for business rules.
- var isOwned = !(activeTakes.All(t => (t.IsNewLandAct && COREINVENTORYINTERESTCODES.Contains(t.LandActTypeCode))
- || t.IsNewInterestInSrw
- || t.IsNewLicenseToConstruct) && activeTakes.Any()) || activeTakes.Any(x => x.IsThereSurplus);
- var isPropertyOfInterest = false;
- var isOtherInterest = !isOwned;
-
- // Override for dedication psp-7048.
- var doNotAcquire = takes.All(t =>
- t.IsNewHighwayDedication && !t.IsAcquiredForInventory);
-
- if (doNotAcquire)
- {
- isOwned = false;
- isPropertyOfInterest = true;
- isOtherInterest = false;
- }
-
- // PSP-7892: Follow ownership priority when updating an existing property
- if (property.IsOwned || isOwned)
- {
- isOwned = true;
- isOtherInterest = false;
- isPropertyOfInterest = false;
- }
- else if (property.IsOtherInterest || isOtherInterest)
- {
- isOwned = false;
- isOtherInterest = true;
- isPropertyOfInterest = false;
- }
- else if (property.IsPropertyOfInterest || isPropertyOfInterest)
- {
- isOwned = false;
- isOtherInterest = false;
- isPropertyOfInterest = true;
- }
-
- if (!userOverride && property.IsPropertyOfInterest && (isOwned || isOtherInterest))
- {
- throw new UserOverrideException(UserOverrideCode.PoiToInventory, "You have one or more take(s) that will be added to MoTI Inventory. Do you want to acknowledge and proceed?");
- }
-
- if (!userOverride && property.IsOtherInterest && isOwned)
- {
- throw new UserOverrideException(UserOverrideCode.PoiToInventory, "You have one or more take(s) that will be changed from 'Other Interest' to 'Core Inventory'. Do you want to acknowledge and proceed?");
- }
-
- PropertyOwnershipState ownership = new() { isOwned = isOwned, isPropertyOfInterest = isPropertyOfInterest, isOtherInterest = isOtherInterest, isDisposed = false };
- _propertyRepository.TransferFileProperty(property, ownership);
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
}
diff --git a/source/backend/api/Services/CompensationRequisitionService.cs b/source/backend/api/Services/CompensationRequisitionService.cs
index 08b170feec..8b4592540a 100644
--- a/source/backend/api/Services/CompensationRequisitionService.cs
+++ b/source/backend/api/Services/CompensationRequisitionService.cs
@@ -67,7 +67,7 @@ public PimsCompensationRequisition Update(PimsCompensationRequisition compensati
if (!_statusSolver.CanEditOrDeleteCompensation(currentAcquisitionStatus, currentCompensation.IsDraft) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
CheckTotalAllowableCompensation(currentAcquisitionFile, compensationRequisition);
@@ -106,7 +106,7 @@ public bool DeleteCompensation(long compensationId)
if (!_statusSolver.CanEditOrDeleteCompensation(currentAcquisitionStatus, currentCompensation.IsDraft) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
var fileFormToDelete = _compensationRequisitionRepository.TryDelete(compensationId);
diff --git a/source/backend/api/Services/DispositionFileService.cs b/source/backend/api/Services/DispositionFileService.cs
index c754cf9087..ae8dc4062c 100644
--- a/source/backend/api/Services/DispositionFileService.cs
+++ b/source/backend/api/Services/DispositionFileService.cs
@@ -71,8 +71,8 @@ public PimsDispositionFile Add(PimsDispositionFile dispositionFile, IEnumerable<
_user.ThrowIfNotAuthorized(Permissions.DispositionAdd);
dispositionFile.ThrowMissingContractorInTeam(_user, _userRepository);
- dispositionFile.DispositionStatusTypeCode ??= EnumDispositionStatusTypeCode.UNKNOWN.ToString();
- dispositionFile.DispositionFileStatusTypeCode ??= EnumDispositionFileStatusTypeCode.ACTIVE.ToString();
+ dispositionFile.DispositionStatusTypeCode ??= DispositionStatusTypes.UNKNOWN.ToString();
+ dispositionFile.DispositionFileStatusTypeCode ??= DispositionFileStatusTypes.ACTIVE.ToString();
ValidateStaff(dispositionFile);
MatchProperties(dispositionFile, userOverrides);
@@ -108,10 +108,10 @@ public PimsDispositionFile Update(long id, PimsDispositionFile dispositionFile,
throw new BadRequestException("Invalid dispositionFileId.");
}
- DispositionStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFile.Internal_Id);
+ DispositionFileStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFile.Internal_Id);
if (!_dispositionStatusSolver.CanEditDetails(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
ValidateVersion(id, dispositionFile.ConcurrencyControlNumber);
@@ -120,8 +120,8 @@ public PimsDispositionFile Update(long id, PimsDispositionFile dispositionFile,
var currentDispositionFile = _dispositionFileRepository.GetById(id);
ValidateFileBeforeUpdate(dispositionFile, currentDispositionFile, userOverrides);
- var isFileClosing = currentDispositionFile.DispositionFileStatusTypeCode != EnumDispositionFileStatusTypeCode.COMPLETE.ToString() &&
- dispositionFile.DispositionFileStatusTypeCode == EnumDispositionFileStatusTypeCode.COMPLETE.ToString();
+ var isFileClosing = currentDispositionFile.DispositionFileStatusTypeCode != DispositionFileStatusTypes.COMPLETE.ToString() &&
+ dispositionFile.DispositionFileStatusTypeCode == DispositionFileStatusTypes.COMPLETE.ToString();
if (isFileClosing && currentDispositionFile.PimsDispositionFileProperties?.Count > 0)
{
@@ -218,10 +218,10 @@ public PimsDispositionOffer AddDispositionFileOffer(long dispositionFileId, Pims
throw new BadRequestException("Invalid dispositionFileId.");
}
- DispositionStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFileParent.Internal_Id);
- if (!_dispositionStatusSolver.CanEditOrDeleteValuesOffersSales(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
+ DispositionFileStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFileParent.Internal_Id);
+ if (!_dispositionStatusSolver.CanEditDetails(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
ValidateDispositionOfferStatus(dispositionFileParent, dispositionOffer);
@@ -243,10 +243,10 @@ public PimsDispositionOffer UpdateDispositionFileOffer(long dispositionFileId, l
throw new BadRequestException("Invalid dispositionFileId.");
}
- DispositionStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFileParent.Internal_Id);
- if (!_dispositionStatusSolver.CanEditOrDeleteValuesOffersSales(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
+ DispositionFileStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFileParent.Internal_Id);
+ if (!_dispositionStatusSolver.CanEditDetails(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
ValidateDispositionOfferStatus(dispositionFileParent, dispositionOffer);
@@ -263,10 +263,10 @@ public bool DeleteDispositionFileOffer(long dispositionFileId, long offerId)
_user.ThrowIfNotAuthorized(Permissions.DispositionEdit);
var dispositionFile = _dispositionFileRepository.GetById(dispositionFileId);
- DispositionStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFile.Internal_Id);
- if (!_dispositionStatusSolver.CanEditOrDeleteValuesOffersSales(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
+ DispositionFileStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFile.Internal_Id);
+ if (!_dispositionStatusSolver.CanEditDetails(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
var deleteResult = _dispositionFileRepository.TryDeleteDispositionOffer(dispositionFileId, offerId);
@@ -288,10 +288,10 @@ public PimsDispositionSale UpdateDispositionFileSale(PimsDispositionSale disposi
_logger.LogInformation("Updating disposition file Sale with DispositionFileId: {id}", dispositionSale.DispositionSaleId);
_user.ThrowIfNotAuthorized(Permissions.DispositionEdit);
- DispositionStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionSale.DispositionFileId);
- if (!_dispositionStatusSolver.CanEditOrDeleteValuesOffersSales(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
+ DispositionFileStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionSale.DispositionFileId);
+ if (!_dispositionStatusSolver.CanEditDetails(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
var updatedSale = _dispositionFileRepository.UpdateDispositionFileSale(dispositionSale);
@@ -306,10 +306,10 @@ public PimsDispositionSale AddDispositionFileSale(PimsDispositionSale dispositio
_logger.LogInformation("Adding disposition file Sale to Disposition File with Id: {id}", dispositionSale.DispositionFileId);
_user.ThrowIfNotAuthorized(Permissions.DispositionEdit);
- DispositionStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionSale.DispositionFileId);
- if (!_dispositionStatusSolver.CanEditOrDeleteValuesOffersSales(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
+ DispositionFileStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionSale.DispositionFileId);
+ if (!_dispositionStatusSolver.CanEditDetails(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
var dispositionFileParent = _dispositionFileRepository.GetById(dispositionSale.DispositionFileId);
@@ -348,10 +348,10 @@ public PimsDispositionAppraisal AddDispositionFileAppraisal(long dispositionFile
throw new DuplicateEntityException("Invalid Disposition Appraisal. An Appraisal has been already created for this Disposition File");
}
- DispositionStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFileParent.Internal_Id);
- if (!_dispositionStatusSolver.CanEditOrDeleteValuesOffersSales(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
+ DispositionFileStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFileParent.Internal_Id);
+ if (!_dispositionStatusSolver.CanEditDetails(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
var newAppraisal = _dispositionFileRepository.AddDispositionFileAppraisal(dispositionAppraisal);
@@ -371,10 +371,10 @@ public PimsDispositionAppraisal UpdateDispositionFileAppraisal(long dispositionF
throw new BadRequestException("Invalid dispositionFileId.");
}
- DispositionStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFileParent.Internal_Id);
- if (!_dispositionStatusSolver.CanEditOrDeleteValuesOffersSales(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
+ DispositionFileStatusTypes? currentDispositionStatus = GetCurrentDispositionStatus(dispositionFileParent.Internal_Id);
+ if (!_dispositionStatusSolver.CanEditDetails(currentDispositionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("The file you are editing is not active or hold, so you cannot save changes. Refresh your browser to see file state.");
}
var updatedAppraisal = _dispositionFileRepository.UpdateDispositionFileAppraisal(appraisalId, dispositionAppraisal);
@@ -521,18 +521,12 @@ public PimsDispositionFile UpdateProperties(PimsDispositionFile dispositionFile,
foreach (var deletedProperty in differenceSet)
{
_dispositionFilePropertyRepository.Delete(deletedProperty);
- if (deletedProperty.Property.IsPropertyOfInterest)
+
+ var totalAssociationCount = _propertyRepository.GetAllAssociationsCountById(deletedProperty.PropertyId);
+ if (totalAssociationCount <= 1)
{
- PimsProperty propertyWithAssociations = _propertyRepository.GetAllAssociationsById(deletedProperty.PropertyId);
- var leaseAssociationCount = propertyWithAssociations.PimsPropertyLeases.Count;
- var researchAssociationCount = propertyWithAssociations.PimsPropertyResearchFiles.Count;
- var acquisitionAssociationCount = propertyWithAssociations.PimsPropertyAcquisitionFiles.Count;
- var dispositionAssociationCount = propertyWithAssociations.PimsDispositionFileProperties.Count;
- if (leaseAssociationCount + researchAssociationCount + acquisitionAssociationCount == 0 && dispositionAssociationCount <= 1 && deletedProperty?.Property?.IsPropertyOfInterest == true)
- {
- _dispositionFileRepository.CommitTransaction(); // TODO: this can only be removed if cascade deletes are implemented. EF executes deletes in alphabetic order.
- _propertyRepository.Delete(deletedProperty.Property);
- }
+ _dispositionFileRepository.CommitTransaction(); // TODO: this can only be removed if cascade deletes are implemented. EF executes deletes in alphabetic order.
+ _propertyRepository.Delete(deletedProperty.Property);
}
}
@@ -540,12 +534,48 @@ public PimsDispositionFile UpdateProperties(PimsDispositionFile dispositionFile,
return _dispositionFileRepository.GetById(dispositionFile.Internal_Id);
}
+ private static decimal CalculateNetProceedsBeforeSpp(PimsDispositionSale sale)
+ {
+ if (sale != null)
+ {
+ return (sale?.SaleFinalAmt ?? 0) - ((sale?.RealtorCommissionAmt ?? 0) + (sale.GstCollectedAmt ?? 0) + (sale.NetBookAmt ?? 0) + (sale.TotalCostAmt ?? 0));
+ }
+ return 0;
+ }
+
+ private static decimal CalculateNetProceedsAfterSpp(PimsDispositionSale sale)
+ {
+ if (sale != null)
+ {
+ return (sale?.SaleFinalAmt ?? 0) - ((sale?.RealtorCommissionAmt ?? 0) + (sale.GstCollectedAmt ?? 0) + (sale.NetBookAmt ?? 0) + (sale.TotalCostAmt ?? 0) + (sale.SppAmt ?? 0));
+ }
+ return 0;
+ }
+
+ private static void ValidateStaff(PimsDispositionFile dispositionFile)
+ {
+ bool duplicate = dispositionFile.PimsDispositionFileTeams.GroupBy(p => p.DspFlTeamProfileTypeCode).Any(g => g.Count() > 1);
+ if (duplicate)
+ {
+ throw new BadRequestException("Invalid Disposition team, each team member and role combination can only be added once.");
+ }
+ }
+
+ private static void ValidateDispositionOfferStatus(PimsDispositionFile dispositionFile, PimsDispositionOffer newOffer)
+ {
+ bool offerAlreadyAccepted = dispositionFile.PimsDispositionOffers.Any(x => x.DispositionOfferStatusTypeCode == EnumDispositionOfferStatusTypeCode.ACCCEPTED.ToString() && x.DispositionOfferId != newOffer.DispositionOfferId);
+ if (offerAlreadyAccepted && !string.IsNullOrEmpty(newOffer.DispositionOfferStatusTypeCode) && newOffer.DispositionOfferStatusTypeCode == EnumDispositionOfferStatusTypeCode.ACCCEPTED.ToString())
+ {
+ throw new DuplicateEntityException("Invalid Disposition Offer, an Offer has been already accepted for this Disposition File");
+ }
+ }
+
private void ValidateFileBeforeUpdate(PimsDispositionFile incomingDispositionFile, PimsDispositionFile currentDispositionFile, IEnumerable userOverrides)
{
// Implement file validation logic before proceeding to update. This includes file closing validation.
// The order of validation checks is important as it has been requested by business users.
- var isFileClosing = currentDispositionFile.DispositionFileStatusTypeCode != EnumDispositionFileStatusTypeCode.COMPLETE.ToString() &&
- incomingDispositionFile.DispositionFileStatusTypeCode == EnumDispositionFileStatusTypeCode.COMPLETE.ToString();
+ var isFileClosing = currentDispositionFile.DispositionFileStatusTypeCode != DispositionFileStatusTypes.COMPLETE.ToString() &&
+ incomingDispositionFile.DispositionFileStatusTypeCode == DispositionFileStatusTypes.COMPLETE.ToString();
var currentProperties = _dispositionFilePropertyRepository.GetPropertiesByDispositionFileId(incomingDispositionFile.Internal_Id);
@@ -573,9 +603,14 @@ private void ValidateFileBeforeUpdate(PimsDispositionFile incomingDispositionFil
ValidateMinistryRegion(incomingDispositionFile.Internal_Id, incomingDispositionFile.RegionCode);
}
- var nonEditableStatuses = new List() { EnumDispositionFileStatusTypeCode.COMPLETE.ToString(), EnumDispositionFileStatusTypeCode.ARCHIVED.ToString(), EnumDispositionFileStatusTypeCode.CANCELLED.ToString(), };
+ var nonEditableStatuses = new List() { DispositionFileStatusTypes.COMPLETE.ToString(), DispositionFileStatusTypes.ARCHIVED.ToString(), DispositionFileStatusTypes.CANCELLED.ToString(), };
var isFileChangingToNonEditableState = !nonEditableStatuses.Contains(currentDispositionFile.DispositionFileStatusTypeCode) && nonEditableStatuses.Contains(incomingDispositionFile.DispositionFileStatusTypeCode);
+ if (isFileClosing && incomingDispositionFile.DispositionStatusTypeCode != DispositionStatusTypes.SOLD.ToString())
+ {
+ throw new BusinessRuleViolationException("File Disposition Status has not been set to SOLD, so the related file properties cannot be Disposed. To proceed, set file disposition status to SOLD, or cancel the Disposition file.");
+ }
+
// confirm user action - file is changing to non-editable state
if (!userOverrides.Contains(UserOverrideCode.DispositionFileFinalStatus) && isFileChangingToNonEditableState)
{
@@ -602,43 +637,7 @@ private void DisposeOfProperties(PimsDispositionFile dispositionFile)
foreach (var dispositionProperty in ownedProperties)
{
var property = dispositionProperty.Property;
- _propertyRepository.TransferFileProperty(property, new Dal.Models.PropertyOwnershipState() { isDisposed = true, isPropertyOfInterest = false, isOtherInterest = false, isOwned = false });
- }
- }
-
- private static decimal CalculateNetProceedsBeforeSpp(PimsDispositionSale sale)
- {
- if (sale != null)
- {
- return (sale?.SaleFinalAmt ?? 0) - ((sale?.RealtorCommissionAmt ?? 0) + (sale.GstCollectedAmt ?? 0) + (sale.NetBookAmt ?? 0) + (sale.TotalCostAmt ?? 0));
- }
- return 0;
- }
-
- private static decimal CalculateNetProceedsAfterSpp(PimsDispositionSale sale)
- {
- if (sale != null)
- {
- return (sale?.SaleFinalAmt ?? 0) - ((sale?.RealtorCommissionAmt ?? 0) + (sale.GstCollectedAmt ?? 0) + (sale.NetBookAmt ?? 0) + (sale.TotalCostAmt ?? 0) + (sale.SppAmt ?? 0));
- }
- return 0;
- }
-
- private static void ValidateStaff(PimsDispositionFile dispositionFile)
- {
- bool duplicate = dispositionFile.PimsDispositionFileTeams.GroupBy(p => p.DspFlTeamProfileTypeCode).Any(g => g.Count() > 1);
- if (duplicate)
- {
- throw new BadRequestException("Invalid Disposition team, each team member and role combination can only be added once.");
- }
- }
-
- private static void ValidateDispositionOfferStatus(PimsDispositionFile dispositionFile, PimsDispositionOffer newOffer)
- {
- bool offerAlreadyAccepted = dispositionFile.PimsDispositionOffers.Any(x => x.DispositionOfferStatusTypeCode == EnumDispositionOfferStatusTypeCode.ACCCEPTED.ToString() && x.DispositionOfferId != newOffer.DispositionOfferId);
- if (offerAlreadyAccepted && !string.IsNullOrEmpty(newOffer.DispositionOfferStatusTypeCode) && newOffer.DispositionOfferStatusTypeCode == EnumDispositionOfferStatusTypeCode.ACCCEPTED.ToString())
- {
- throw new DuplicateEntityException("Invalid Disposition Offer, an Offer has been already accepted for this Disposition File");
+ _propertyRepository.TransferFileProperty(property, false);
}
}
@@ -816,17 +815,17 @@ private void ValidateVersion(long dispositionFileId, long dispositionFileVersion
}
}
- private DispositionStatusTypes? GetCurrentDispositionStatus(long dispositionFileId)
+ private DispositionFileStatusTypes? GetCurrentDispositionStatus(long dispositionFileId)
{
var currentDispositionFile = _dispositionFileRepository.GetById(dispositionFileId);
- DispositionStatusTypes currentDispositionStatus;
+ DispositionFileStatusTypes currentDispositionFileStatus;
- if (Enum.TryParse(currentDispositionFile.DispositionFileStatusTypeCode, out currentDispositionStatus))
+ if (Enum.TryParse(currentDispositionFile.DispositionFileStatusTypeCode, out currentDispositionFileStatus))
{
- return currentDispositionStatus;
+ return currentDispositionFileStatus;
}
- return currentDispositionStatus;
+ return currentDispositionFileStatus;
}
}
}
diff --git a/source/backend/api/Services/DocumentService.cs b/source/backend/api/Services/DocumentService.cs
index 411728d329..2ca5be875a 100644
--- a/source/backend/api/Services/DocumentService.cs
+++ b/source/backend/api/Services/DocumentService.cs
@@ -1,4 +1,6 @@
+using System;
using System.Collections.Generic;
+using System.Configuration;
using System.IO;
using System.Linq;
using System.Net;
@@ -6,12 +8,13 @@
using System.Threading.Tasks;
using MapsterMapper;
using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Pims.Api.Helpers.Exceptions;
using Pims.Api.Models.CodeTypes;
using Pims.Api.Models.Concepts.Document;
-
+using Pims.Api.Models.Config;
using Pims.Api.Models.Mayan;
using Pims.Api.Models.Mayan.Document;
using Pims.Api.Models.Requests.Document.UpdateMetadata;
@@ -23,6 +26,7 @@
using Pims.Dal.Helpers.Extensions;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
+using Polly;
namespace Pims.Api.Services
{
@@ -31,6 +35,7 @@ namespace Pims.Api.Services
///
public class DocumentService : BaseService, IDocumentService
{
+
private static readonly string[] ValidExtensions =
{
"txt",
@@ -55,6 +60,9 @@ public class DocumentService : BaseService, IDocumentService
"msg",
};
+ private static readonly string MayanConfigSectionKey = "Mayan";
+ private readonly MayanConfig _config;
+
private readonly IDocumentRepository documentRepository;
private readonly IEdmsDocumentRepository documentStorageRepository;
private readonly IDocumentTypeRepository documentTypeRepository;
@@ -63,6 +71,7 @@ public class DocumentService : BaseService, IDocumentService
public DocumentService(
ClaimsPrincipal user,
+ IConfiguration configuration,
ILogger logger,
IDocumentRepository documentRepository,
IEdmsDocumentRepository documentStorageRepository,
@@ -76,6 +85,8 @@ public DocumentService(
this.documentTypeRepository = documentTypeRepository;
this.avService = avService;
this.mapper = mapper;
+ _config = new MayanConfig();
+ configuration.Bind(MayanConfigSectionKey, _config);
}
public IList GetPimsDocumentTypes()
@@ -133,7 +144,20 @@ public async Task UploadDocumentAsync(DocumentUploadRequ
if (externalResponse.Status == ExternalResponseStatus.Success)
{
var externalDocument = externalResponse.Payload;
+ if (externalDocument.FileLatest == null && _config.UploadRetries > 0)
+ {
+ var retryPolicy = Policy>
+ .HandleResult(result => result.HttpStatusCode != HttpStatusCode.OK || result.Payload.FileLatest == null)
+ .WaitAndRetryAsync(_config.UploadRetries, (int retry) => TimeSpan.FromSeconds(Math.Pow(2, retry)));
+ var detail = await retryPolicy.ExecuteAsync(async () => await GetStorageDocumentDetail(externalDocument.Id));
+ if(detail?.Payload?.FileLatest == null)
+ {
+ response.DocumentExternalResponse.Status = ExternalResponseStatus.Error;
+ response.DocumentExternalResponse.Message = "Timed out waiting for Mayan to process document";
+ return response;
+ }
+ }
// Create metadata of document
if (uploadRequest.DocumentMetadata != null)
{
diff --git a/source/backend/api/Services/IPropertyService.cs b/source/backend/api/Services/IPropertyService.cs
index ee126f4d21..87bc19c31e 100644
--- a/source/backend/api/Services/IPropertyService.cs
+++ b/source/backend/api/Services/IPropertyService.cs
@@ -13,6 +13,8 @@ public interface IPropertyService
PimsProperty GetByPid(string pid);
+ PimsProperty GetByPin(int pin);
+
PimsProperty Update(PimsProperty property, bool commitTransaction = true);
PimsProperty RetireProperty(PimsProperty property, bool commitTransaction = true);
diff --git a/source/backend/api/Services/ITakeService.cs b/source/backend/api/Services/ITakeService.cs
index 5758235c33..6548486492 100644
--- a/source/backend/api/Services/ITakeService.cs
+++ b/source/backend/api/Services/ITakeService.cs
@@ -1,16 +1,24 @@
using System.Collections.Generic;
using Pims.Dal.Entities;
+using Pims.Dal.Exceptions;
namespace Pims.Api.Services
{
public interface ITakeService
{
+
+ PimsTake GetById(long takeId);
+
+ PimsTake AddAcquisitionPropertyTake(long acquisitionFilePropertyId, PimsTake take);
+
+ PimsTake UpdateAcquisitionPropertyTake(long acquisitionFilePropertyId, PimsTake take);
+
+ bool DeleteAcquisitionPropertyTake(long takeId, IEnumerable userOverrides);
+
IEnumerable GetByFileId(long fileId);
IEnumerable GetByPropertyId(long fileId, long acquisitionFilePropertyId);
int GetCountByPropertyId(long propertyId);
-
- IEnumerable UpdateAcquisitionPropertyTakes(long acquisitionFilePropertyId, IEnumerable takes);
}
}
diff --git a/source/backend/api/Services/LeaseService.cs b/source/backend/api/Services/LeaseService.cs
index ee0cae3e0f..17e562e78a 100644
--- a/source/backend/api/Services/LeaseService.cs
+++ b/source/backend/api/Services/LeaseService.cs
@@ -210,6 +210,12 @@ public PimsLease Update(PimsLease lease, IEnumerable userOverr
pimsUser.ThrowInvalidAccessToLeaseFile(lease.RegionCode);
var currentProperties = _propertyLeaseRepository.GetAllByLeaseId(lease.LeaseId);
+ var newPropertiesAdded = lease.PimsPropertyLeases.Where(x => !currentProperties.Any(y => y.Internal_Id == x.Internal_Id)).ToList();
+
+ if (newPropertiesAdded.Any(x => x.Property.IsRetired.HasValue && x.Property.IsRetired.Value))
+ {
+ throw new BusinessRuleViolationException("Retired property can not be selected.");
+ }
if (currentLease.LeaseStatusTypeCode != lease.LeaseStatusTypeCode)
{
@@ -238,17 +244,11 @@ public PimsLease Update(PimsLease lease, IEnumerable userOverr
List differenceSet = currentProperties.Where(x => !lease.PimsPropertyLeases.Any(y => y.Internal_Id == x.Internal_Id)).ToList();
foreach (var deletedProperty in differenceSet)
{
- if (deletedProperty.Property.IsPropertyOfInterest)
+ var totalAssociationCount = _propertyRepository.GetAllAssociationsCountById(deletedProperty.PropertyId);
+ if (totalAssociationCount <= 1)
{
- PimsProperty propertyWithAssociations = _propertyRepository.GetAllAssociationsById(deletedProperty.PropertyId);
- var leaseAssociationCount = propertyWithAssociations.PimsPropertyLeases.Count;
- var researchAssociationCount = propertyWithAssociations.PimsPropertyResearchFiles.Count;
- var acquisitionAssociationCount = propertyWithAssociations.PimsPropertyAcquisitionFiles.Count;
- if (researchAssociationCount + acquisitionAssociationCount == 0 && leaseAssociationCount <= 1 && deletedProperty?.Property?.IsPropertyOfInterest == true)
- {
- _leaseRepository.CommitTransaction(); // TODO: this can only be removed if cascade deletes are implemented. EF executes deletes in alphabetic order.
- _propertyRepository.Delete(deletedProperty.Property);
- }
+ _leaseRepository.CommitTransaction(); // TODO: this can only be removed if cascade deletes are implemented. EF executes deletes in alphabetic order.
+ _propertyRepository.Delete(deletedProperty.Property);
}
}
diff --git a/source/backend/api/Services/PropertyOperationService.cs b/source/backend/api/Services/PropertyOperationService.cs
index a606b503fa..c9537712a2 100644
--- a/source/backend/api/Services/PropertyOperationService.cs
+++ b/source/backend/api/Services/PropertyOperationService.cs
@@ -3,6 +3,7 @@
using System.Security.Claims;
using LinqKit;
using Microsoft.Extensions.Logging;
+using Pims.Api.Helpers.Exceptions;
using Pims.Core.Exceptions;
using Pims.Dal.Entities;
using Pims.Dal.Helpers.Extensions;
@@ -48,7 +49,7 @@ public IEnumerable SubdivideProperty(IEnumerable() { dbSourceProperty });
if (dbSourceProperty.IsRetired == true)
{
throw new BusinessRuleViolationException("Retired properties cannot be subdivided.");
@@ -74,7 +75,6 @@ public IEnumerable SubdivideProperty(IEnumerable ConsolidateProperty(IEnumerable sourceProperties = operations.Select(p => p.SourceProperty);
IEnumerable dbSourceProperties = _propertyService.GetMultipleById(sourceProperties.Select(sp => sp.PropertyId).ToList());
- CommonPropertyOperationValidation(operations);
+ CommonPropertyOperationValidation(operations, sourceProperties);
if (destinationProperty?.Pid == null)
{
throw new BusinessRuleViolationException("Consolidation child must have a property with a valid PID.");
@@ -165,8 +165,27 @@ public IEnumerable ConsolidateProperty(IEnumerable operations)
+ private static void CommonPropertyOperationValidation(IEnumerable operations, IEnumerable dbSourceProperties)
{
+
+ foreach (var sourceProperty in dbSourceProperties)
+ {
+ var operation = operations.FirstOrDefault(p => p.SourcePropertyId == sourceProperty.PropertyId);
+ if (operation == null)
+ {
+ throw new BadRequestException("All source properties must exist in the system.");
+ }
+ if (sourceProperty.IsOwned != operation.SourceProperty.IsOwned)
+ {
+ throw new BusinessRuleViolationException("All source properties must match existing properties in the system.");
+ }
+ }
+
+ if (operations.Any(op => op.SourceProperty?.IsOwned != true))
+ {
+ throw new BusinessRuleViolationException("All source properties must be owned.");
+ }
+
if (operations.Any(op => op.PropertyOperationNo != operations.FirstOrDefault().PropertyOperationNo))
{
throw new BusinessRuleViolationException("All property operations must have matching operation numbers.");
diff --git a/source/backend/api/Services/PropertyService.cs b/source/backend/api/Services/PropertyService.cs
index 0eaab44521..12a73b5099 100644
--- a/source/backend/api/Services/PropertyService.cs
+++ b/source/backend/api/Services/PropertyService.cs
@@ -98,6 +98,21 @@ public PimsProperty GetByPid(string pid)
return property;
}
+ public PimsProperty GetByPin(int pin)
+ {
+ _logger.LogInformation("Getting property with pin {pin}", pin);
+ _user.ThrowIfNotAuthorized(Permissions.PropertyView);
+
+ // return property spatial location in lat/long (4326)
+ var property = _propertyRepository.GetByPin(pin);
+ if (property?.Location != null)
+ {
+ var newCoords = _coordinateService.TransformCoordinates(SpatialReference.BCALBERS, SpatialReference.WGS84, property.Location.Coordinate);
+ property.Location = GeometryHelper.CreatePoint(newCoords, SpatialReference.WGS84);
+ }
+ return property;
+ }
+
public PimsProperty Update(PimsProperty property, bool commitTransaction = true)
{
_logger.LogInformation("Updating property with id {id}", property.Internal_Id);
@@ -307,7 +322,6 @@ public PimsProperty PopulateNewProperty(PimsProperty property, bool isOwned = fa
property.PropertyStatusTypeCode = "UNKNOWN";
property.SurplusDeclarationTypeCode = "UNKNOWN";
- property.IsPropertyOfInterest = isPropertyOfInterest;
property.IsOwned = isOwned;
if (property.Address != null)
diff --git a/source/backend/api/Services/ResearchFileService.cs b/source/backend/api/Services/ResearchFileService.cs
index f6a85be3c2..5032c4b889 100644
--- a/source/backend/api/Services/ResearchFileService.cs
+++ b/source/backend/api/Services/ResearchFileService.cs
@@ -26,6 +26,7 @@ public class ResearchFileService : IResearchFileService
private readonly ICoordinateTransformService _coordinateService;
private readonly ILookupRepository _lookupRepository;
private readonly IEntityNoteRepository _entityNoteRepository;
+ private readonly IPropertyService _propertyService;
public ResearchFileService(
ClaimsPrincipal user,
@@ -35,7 +36,8 @@ public ResearchFileService(
IPropertyRepository propertyRepository,
ICoordinateTransformService coordinateService,
ILookupRepository lookupRepository,
- IEntityNoteRepository entityNoteRepository)
+ IEntityNoteRepository entityNoteRepository,
+ IPropertyService propertyService)
{
_user = user;
_logger = logger;
@@ -45,6 +47,7 @@ public ResearchFileService(
_coordinateService = coordinateService;
_lookupRepository = lookupRepository;
_entityNoteRepository = entityNoteRepository;
+ _propertyService = propertyService;
}
public PimsResearchFile GetById(long id)
@@ -133,17 +136,11 @@ public PimsResearchFile UpdateProperties(PimsResearchFile researchFile, IEnumera
foreach (var deletedProperty in differenceSet)
{
_researchFilePropertyRepository.Delete(deletedProperty);
- if (deletedProperty.Property.IsPropertyOfInterest == true)
+ var totalAssociationCount = _propertyRepository.GetAllAssociationsCountById(deletedProperty.PropertyId);
+ if (totalAssociationCount <= 1)
{
- PimsProperty propertyWithAssociations = _propertyRepository.GetAllAssociationsById(deletedProperty.PropertyId);
- var leaseAssociationCount = propertyWithAssociations.PimsPropertyLeases.Count;
- var researchAssociationCount = propertyWithAssociations.PimsPropertyResearchFiles.Count;
- var acquisitionAssociationCount = propertyWithAssociations.PimsPropertyAcquisitionFiles.Count;
- if (leaseAssociationCount + acquisitionAssociationCount == 0 && researchAssociationCount <= 1 && deletedProperty?.Property?.IsPropertyOfInterest == true)
- {
- _researchFilePropertyRepository.CommitTransaction(); // TODO: this can only be removed if cascade deletes are implemented. EF executes deletes in alphabetic order.
- _propertyRepository.Delete(deletedProperty.Property);
- }
+ _researchFilePropertyRepository.CommitTransaction(); // TODO: this can only be removed if cascade deletes are implemented. EF executes deletes in alphabetic order.
+ _propertyRepository.Delete(deletedProperty.Property);
}
}
@@ -228,7 +225,7 @@ private void MatchProperties(PimsResearchFile researchFile, IEnumerable p.ProvinceStateCode == "BC")?.Id;
- if (provinceId.HasValue)
- {
- property.Address.ProvinceStateId = provinceId.Value;
- }
- property.Address.CountryId = _lookupRepository.GetAllCountries().FirstOrDefault(p => p.CountryCode == "CA")?.Id;
- }
-
- // convert spatial location from lat/long (4326) to BC Albers (3005) for database storage
- var geom = property.Location;
- if (geom.SRID != SpatialReference.BCALBERS)
- {
- var newCoords = _coordinateService.TransformCoordinates(geom.SRID, SpatialReference.BCALBERS, geom.Coordinate);
- property.Location = GeometryHelper.CreatePoint(newCoords, SpatialReference.BCALBERS);
- }
-
- // apply similar logic to the boundary
- var boundaryGeom = property.Boundary;
- if (boundaryGeom != null && boundaryGeom.SRID != SpatialReference.BCALBERS)
- {
- var newCoords = property.Boundary.Coordinates.Select(coord => _coordinateService.TransformCoordinates(boundaryGeom.SRID, SpatialReference.BCALBERS, coord));
- var gf = NetTopologySuite.NtsGeometryServices.Instance.CreateGeometryFactory(SpatialReference.BCALBERS);
- property.Boundary = gf.CreatePolygon(newCoords.ToArray());
- }
- }
-
private void ValidateVersion(long researchFileId, long? researchFileVersion)
{
long currentRowVersion = _researchFileRepository.GetRowVersion(researchFileId);
diff --git a/source/backend/api/Services/TakeService.cs b/source/backend/api/Services/TakeService.cs
index e179a27f98..32ee1cf31f 100644
--- a/source/backend/api/Services/TakeService.cs
+++ b/source/backend/api/Services/TakeService.cs
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Security.Claims;
using Microsoft.Extensions.Logging;
using Pims.Api.Constants;
using Pims.Api.Models.CodeTypes;
using Pims.Core.Exceptions;
using Pims.Dal.Entities;
+using Pims.Dal.Exceptions;
using Pims.Dal.Helpers.Extensions;
using Pims.Dal.Repositories;
using Pims.Dal.Security;
@@ -14,24 +16,39 @@ namespace Pims.Api.Services
{
public class TakeService : ITakeService
{
+
+
private readonly ClaimsPrincipal _user;
private readonly ILogger _logger;
private readonly IAcquisitionFileRepository _acqFileRepository;
private readonly ITakeRepository _takeRepository;
private readonly IAcquisitionStatusSolver _statusSolver;
+ private readonly ITakeInteractionSolver _takeInteractionSolver;
+ private readonly IPropertyRepository _propertyRepository;
public TakeService(
ClaimsPrincipal user,
ILogger logger,
IAcquisitionFileRepository acqFileRepository,
ITakeRepository repository,
- IAcquisitionStatusSolver statusSolver)
+ IAcquisitionStatusSolver statusSolver,
+ ITakeInteractionSolver takeInteractionSolver,
+ IPropertyRepository propertyRepository)
{
_user = user;
_logger = logger;
_acqFileRepository = acqFileRepository;
_takeRepository = repository;
_statusSolver = statusSolver;
+ _takeInteractionSolver = takeInteractionSolver;
+ _propertyRepository = propertyRepository;
+ }
+
+ public PimsTake GetById(long takeId)
+ {
+ _logger.LogInformation("Getting take with takeId {takeId}", takeId);
+ _user.ThrowIfNotAuthorized(Permissions.PropertyView, Permissions.AcquisitionFileView);
+ return _takeRepository.GetById(takeId);
}
public IEnumerable GetByFileId(long fileId)
@@ -45,7 +62,7 @@ public IEnumerable GetByPropertyId(long fileId, long acquisitionFilePr
{
_logger.LogInformation($"Getting takes with fileId {fileId} and propertyId {acquisitionFilePropertyId}");
_user.ThrowIfNotAuthorized(Permissions.PropertyView, Permissions.AcquisitionFileView);
- return _takeRepository.GetAllByPropertyId(fileId, acquisitionFilePropertyId);
+ return _takeRepository.GetAllByAcqPropertyId(fileId, acquisitionFilePropertyId);
}
public int GetCountByPropertyId(long propertyId)
@@ -55,23 +72,183 @@ public int GetCountByPropertyId(long propertyId)
return _takeRepository.GetCountByPropertyId(propertyId);
}
- public IEnumerable UpdateAcquisitionPropertyTakes(long acquisitionFilePropertyId, IEnumerable takes)
+ public PimsTake AddAcquisitionPropertyTake(long acquisitionFilePropertyId, PimsTake take)
{
- _logger.LogInformation("updating takes with propertyFileId {propertyFileId}", acquisitionFilePropertyId);
+ _logger.LogInformation("adding take with propertyFileId {propertyFileId}", acquisitionFilePropertyId);
_user.ThrowIfNotAuthorized(Permissions.PropertyView, Permissions.AcquisitionFileView);
- var currentAcquistionFile = _acqFileRepository.GetByAcquisitionFilePropertyId(acquisitionFilePropertyId);
+ ValidateTakeRules(acquisitionFilePropertyId, take);
+
+ // Add take
+ var addedTake = _takeRepository.AddTake(take);
+
+ RecalculateOwnership(acquisitionFilePropertyId, take);
+
+ _takeRepository.CommitTransaction();
+ return addedTake;
+ }
+
+ public PimsTake UpdateAcquisitionPropertyTake(long acquisitionFilePropertyId, PimsTake take)
+ {
+ _logger.LogInformation("updating take with propertyFileId {propertyFileId}", acquisitionFilePropertyId);
+ _user.ThrowIfNotAuthorized(Permissions.PropertyView, Permissions.AcquisitionFileView);
+
+ ValidateTakeRules(acquisitionFilePropertyId, take);
+
+ // Update take
+ var updatedTake = _takeRepository.UpdateTake(take);
+
+ RecalculateOwnership(acquisitionFilePropertyId, take);
+
+ _takeRepository.CommitTransaction();
+ return updatedTake;
+ }
+
+ public bool DeleteAcquisitionPropertyTake(long takeId, IEnumerable userOverrides)
+ {
+ _logger.LogInformation("deleting take with {takeId}", takeId);
+ _user.ThrowIfNotAuthorized(Permissions.PropertyView, Permissions.AcquisitionFileView);
+
+ var takeToDelete = _takeRepository.GetById(takeId);
+ var propertyWithAssociations = _propertyRepository.GetAllAssociationsById(takeToDelete.PropertyAcquisitionFile.PropertyId);
+ var currentAcquisitionFile = _acqFileRepository.GetByAcquisitionFilePropertyId(takeToDelete.PropertyAcquisitionFileId);
+ var allTakesForProperty = _takeRepository.GetAllByPropertyId(takeToDelete.PropertyAcquisitionFile.PropertyId);
+ if ((!_statusSolver.CanEditTakes(Enum.Parse(currentAcquisitionFile.AcquisitionFileStatusTypeCode)) || takeToDelete.TakeStatusTypeCode == AcquisitionTakeStatusTypes.COMPLETE.ToString())
+ && !_user.HasPermission(Permissions.SystemAdmin))
+ {
+ throw new BusinessRuleViolationException("Retired records are referenced for historical purposes only and cannot be edited or deleted. If the take has been added in error, contact your system administrator to re-open the file, which will allow take deletion.");
+ }
+ else if (propertyWithAssociations?.PimsDispositionFileProperties?.Any(d => d.DispositionFile.DispositionFileStatusTypeCode == DispositionFileStatusTypes.COMPLETE.ToString()) == true)
+ {
+ throw new BusinessRuleViolationException("You cannot delete a take that has a completed disposition attached to the same property.");
+ }
+ else if (propertyWithAssociations?.IsRetired == true)
+ {
+ throw new BusinessRuleViolationException("You cannot delete a take from a retired property.");
+ }
+
+ // user overrides
+ if (takeToDelete.TakeStatusTypeCode == AcquisitionTakeStatusTypes.COMPLETE.ToString() && _user.HasPermission(Permissions.SystemAdmin))
+ {
+ if (propertyWithAssociations?.PimsDispositionFileProperties?.Any(d => d.DispositionFile.DispositionFileStatusTypeCode == DispositionFileStatusTypes.ACTIVE.ToString()) == true && !userOverrides.Contains(UserOverrideCode.DeleteTakeActiveDisposition))
+ {
+ throw new UserOverrideException(UserOverrideCode.DeleteTakeActiveDisposition, "You are deleting a take. Property ownership state will be recalculated based upon any remaining completed takes. It should be noted that one or more related dispositions are in progress that should also be reviewed. \n\nDo you want to acknowledge and proceed?");
+ }
+ else if (allTakesForProperty.Count(t => !IsTakeExpired(t) && t.TakeStatusTypeCode == AcquisitionTakeStatusTypes.COMPLETE.ToString()) == 1 && allTakesForProperty.FirstOrDefault().TakeId == takeId && !userOverrides.Contains(UserOverrideCode.DeleteLastTake))
+ {
+ throw new UserOverrideException(UserOverrideCode.DeleteLastTake, "You are deleting the last non-expired completed take on this property. This property will become a property of interest.\n\nDo you want to acknowledge and proceed?");
+ }
+ else if (!userOverrides.Contains(UserOverrideCode.DeleteCompletedTake) && !userOverrides.Contains(UserOverrideCode.DeleteLastTake) && !userOverrides.Contains(UserOverrideCode.DeleteTakeActiveDisposition))
+ {
+ throw new UserOverrideException(UserOverrideCode.DeleteCompletedTake, "You are deleting a completed take. Property ownership state will be recalculated based upon any remaining completed takes.\n\nDo you want to acknowledge and proceed?");
+ }
+ }
+
+ var wasTakeDeleted = _takeRepository.TryDeleteTake(takeId);
+ if (wasTakeDeleted)
+ {
+ // Evaluate if the property needs to be updated
+ var currentProperty = _acqFileRepository.GetProperty(takeToDelete.PropertyAcquisitionFileId);
+ var currentTakes = _takeRepository.GetAllByPropertyId(currentProperty.PropertyId);
+
+ var completedTakes = currentTakes
+ .Where(x => x.TakeStatusTypeCode == AcquisitionTakeStatusTypes.COMPLETE.ToString() && x.TakeId != takeId).ToList();
+
+ if (completedTakes.Count > 0 || takeToDelete.TakeStatusTypeCode == AcquisitionTakeStatusTypes.COMPLETE.ToString())
+ {
+ if (_takeInteractionSolver.ResultsInOwnedProperty(completedTakes))
+ {
+ _propertyRepository.TransferFileProperty(currentProperty, true);
+ }
+ else
+ {
+ _propertyRepository.TransferFileProperty(currentProperty, false);
+ }
+ }
+ }
+
+ _takeRepository.CommitTransaction();
+ return wasTakeDeleted;
+ }
+
+ private static bool IsTakeExpired(PimsTake take)
+ {
+ return (take.IsActiveLease && take.ActiveLeaseEndDt > DateOnly.FromDateTime(DateTime.Now))
+ || (take.IsNewLandAct && take.LandActEndDt > DateOnly.FromDateTime(DateTime.Now))
+ || (take.IsNewLicenseToConstruct && take.LtcEndDt > DateOnly.FromDateTime(DateTime.Now))
+ || (take.IsNewInterestInSrw && take.SrwEndDt > DateOnly.FromDateTime(DateTime.Now));
+ }
+
+ private void ValidateTakeRules(long acquisitionFilePropertyId, PimsTake take)
+ {
+ var currentFilePropertyTakes = _takeRepository.GetAllByPropertyAcquisitionFileId(acquisitionFilePropertyId);
+
+ var currentAcquistionFile = _acqFileRepository.GetByAcquisitionFilePropertyId(acquisitionFilePropertyId);
var currentAcquisitionStatus = Enum.Parse(currentAcquistionFile.AcquisitionFileStatusTypeCode);
+
if (!_statusSolver.CanEditTakes(currentAcquisitionStatus) && !_user.HasPermission(Permissions.SystemAdmin))
{
- throw new BusinessRuleViolationException("The file you are editing is not active or draft, so you cannot save changes. Refresh your browser to see file state.");
+ throw new BusinessRuleViolationException("Retired records are referenced for historical purposes only and cannot be edited or deleted. If the take has been added in error, contact your system administrator to re-open the file, which will allow take deletion.");
+ }
+ else if (take.TakeStatusTypeCode == AcquisitionTakeStatusTypes.COMPLETE.ToString() && take.CompletionDt == null)
+ {
+ throw new BusinessRuleViolationException("A completed take must have a completion date.");
}
+ else if (take.IsNewLandAct && take.LandActEndDt != null && (take.LandActTypeCode == LandActTypes.CROWN_GRANT.ToString() || take.LandActTypeCode == LandActTypes.TRANSFER_OF_ADMIN_AND_CONTROL.ToString()))
+ {
+ throw new BusinessRuleViolationException("'Crown Grant' and 'Transfer' Land Acts cannot have an end date.");
+ }
+ else
+ {
+ // Complete Takes can only be set to InProgress by Admins when File is Active/Draft
+ var currentCompleteTakes = currentFilePropertyTakes
+ .Where(x => x.TakeStatusTypeCode == AcquisitionTakeStatusTypes.COMPLETE.ToString()).ToList();
- _takeRepository.UpdateAcquisitionPropertyTakes(acquisitionFilePropertyId, takes);
- _takeRepository.CommitTransaction();
+ if (currentCompleteTakes.Count > 0)
+ {
+ var updatedTake = currentCompleteTakes.FirstOrDefault(x => x.TakeId == take.TakeId);
+ if (!_user.HasPermission(Permissions.SystemAdmin) && (updatedTake is not null && updatedTake.TakeStatusTypeCode != take.TakeStatusTypeCode))
+ {
+ throw new BusinessRuleViolationException("Retired records are referenced for historical purposes only and cannot be edited or deleted. If the take has been added in error, contact your system administrator to re-open the file, which will allow take deletion.");
+ }
+ }
+ }
+ }
+
+ private void RecalculateOwnership(long acquisitionFilePropertyId, PimsTake take)
+ {
+ // Evaluate if the property needs to be updated
+ var currentProperty = _acqFileRepository.GetProperty(acquisitionFilePropertyId);
+ var currentTakes = _takeRepository.GetAllByPropertyId(currentProperty.PropertyId);
+
+ var allTakes = currentTakes;
- return _takeRepository.GetAllByPropertyAcquisitionFileId(acquisitionFilePropertyId);
+ // If the take is being modified, update the one in the list to use the incoming one.
+ var existingTake = allTakes.FirstOrDefault(t => t.TakeId == take.TakeId);
+ if (existingTake != null)
+ {
+ allTakes = allTakes.Select(t => t.TakeId == take.TakeId ? take : t);
+ }
+ else if (take != null)
+ {
+ allTakes = allTakes.Append(take);
+ }
+
+ var completedTakes = allTakes
+ .Where(x => x.TakeStatusTypeCode == AcquisitionTakeStatusTypes.COMPLETE.ToString()).ToList();
+
+ if (completedTakes.Count > 0)
+ {
+ if (_takeInteractionSolver.ResultsInOwnedProperty(completedTakes))
+ {
+ _propertyRepository.TransferFileProperty(currentProperty, true);
+ }
+ else
+ {
+ _propertyRepository.TransferFileProperty(currentProperty, false);
+ }
+ }
}
}
}
diff --git a/source/backend/api/Solvers/DispositionStatusSolver.cs b/source/backend/api/Solvers/DispositionStatusSolver.cs
index a77f9c0ffc..a834e5f880 100644
--- a/source/backend/api/Solvers/DispositionStatusSolver.cs
+++ b/source/backend/api/Solvers/DispositionStatusSolver.cs
@@ -1,69 +1,10 @@
-using Pims.Api.Constants;
+using Pims.Api.Models.CodeTypes;
namespace Pims.Api.Services
{
public class DispositionStatusSolver : IDispositionStatusSolver
{
-
- public bool CanEditDetails(DispositionStatusTypes? dispositionStatus)
- {
- if (dispositionStatus == null)
- {
- return false;
- }
-
- bool canEdit;
- switch (dispositionStatus)
- {
- case DispositionStatusTypes.ACTIVE:
- case DispositionStatusTypes.DRAFT:
- canEdit = true;
- break;
- case DispositionStatusTypes.ARCHIVED:
- case DispositionStatusTypes.CANCELLED:
- case DispositionStatusTypes.CLOSED:
- case DispositionStatusTypes.COMPLETE:
- case DispositionStatusTypes.HOLD:
- canEdit = false;
- break;
- default:
- canEdit = false;
- break;
- }
-
- return canEdit;
- }
-
- public bool CanEditProperties(DispositionStatusTypes? dispositionStatus)
- {
- if (dispositionStatus == null)
- {
- return false;
- }
-
- bool canEdit;
- switch (dispositionStatus)
- {
- case DispositionStatusTypes.ACTIVE:
- case DispositionStatusTypes.DRAFT:
- canEdit = true;
- break;
- case DispositionStatusTypes.ARCHIVED:
- case DispositionStatusTypes.CANCELLED:
- case DispositionStatusTypes.CLOSED:
- case DispositionStatusTypes.COMPLETE:
- case DispositionStatusTypes.HOLD:
- canEdit = false;
- break;
- default:
- canEdit = false;
- break;
- }
-
- return canEdit;
- }
-
- public bool CanEditOrDeleteValuesOffersSales(DispositionStatusTypes? dispositionStatus)
+ public bool CanEditDetails(DispositionFileStatusTypes? dispositionStatus)
{
if (dispositionStatus == null)
{
@@ -73,15 +14,14 @@ public bool CanEditOrDeleteValuesOffersSales(DispositionStatusTypes? disposition
bool canEdit;
switch (dispositionStatus)
{
- case DispositionStatusTypes.ACTIVE:
- case DispositionStatusTypes.DRAFT:
+ case DispositionFileStatusTypes.ACTIVE:
+ case DispositionFileStatusTypes.DRAFT:
+ case DispositionFileStatusTypes.HOLD:
canEdit = true;
break;
- case DispositionStatusTypes.ARCHIVED:
- case DispositionStatusTypes.CANCELLED:
- case DispositionStatusTypes.CLOSED:
- case DispositionStatusTypes.COMPLETE:
- case DispositionStatusTypes.HOLD:
+ case DispositionFileStatusTypes.ARCHIVED:
+ case DispositionFileStatusTypes.CANCELLED:
+ case DispositionFileStatusTypes.COMPLETE:
canEdit = false;
break;
default:
diff --git a/source/backend/api/Solvers/IDispositionStatusSolver.cs b/source/backend/api/Solvers/IDispositionStatusSolver.cs
index fb977e9b3e..b8fbebfbd9 100644
--- a/source/backend/api/Solvers/IDispositionStatusSolver.cs
+++ b/source/backend/api/Solvers/IDispositionStatusSolver.cs
@@ -1,13 +1,9 @@
-using Pims.Api.Constants;
+using Pims.Api.Models.CodeTypes;
namespace Pims.Api.Services
{
public interface IDispositionStatusSolver
{
- bool CanEditDetails(DispositionStatusTypes? dispositionStatus);
-
- bool CanEditProperties(DispositionStatusTypes? dispositionStatus);
-
- bool CanEditOrDeleteValuesOffersSales(DispositionStatusTypes? dispositionStatus);
+ bool CanEditDetails(DispositionFileStatusTypes? dispositionStatus);
}
}
diff --git a/source/backend/api/Solvers/ITakeInteractionSolver.cs b/source/backend/api/Solvers/ITakeInteractionSolver.cs
new file mode 100644
index 0000000000..b636500c2c
--- /dev/null
+++ b/source/backend/api/Solvers/ITakeInteractionSolver.cs
@@ -0,0 +1,10 @@
+using System.Collections.Generic;
+using Pims.Dal.Entities;
+
+namespace Pims.Api.Services
+{
+ public interface ITakeInteractionSolver
+ {
+ bool ResultsInOwnedProperty(IEnumerable takes);
+ }
+}
diff --git a/source/backend/api/Solvers/TakeInteractionSolver.cs b/source/backend/api/Solvers/TakeInteractionSolver.cs
new file mode 100644
index 0000000000..66c3be8837
--- /dev/null
+++ b/source/backend/api/Solvers/TakeInteractionSolver.cs
@@ -0,0 +1,43 @@
+using System.Collections.Generic;
+using Pims.Dal.Entities;
+
+namespace Pims.Api.Services
+{
+ public class TakeInteractionSolver : ITakeInteractionSolver
+ {
+ private readonly HashSet LandActWithOwnership;
+
+ public TakeInteractionSolver()
+ {
+ LandActWithOwnership = new HashSet() { "Crown Grant", "Transfer Admin" };
+ }
+
+ ///
+ /// Evaluates if the takes passed as an argument will result in an property owned (Core Inventory).
+ /// Note: This method does not validate the take status, nor if the takes belong to the same property.
+ ///
+ ///
+ public bool ResultsInOwnedProperty(IEnumerable takes)
+ {
+ foreach (var take in takes)
+ {
+ if (take.IsNewHighwayDedication && take.IsAcquiredForInventory)
+ {
+ return true;
+ }
+
+ if (take.IsThereSurplus)
+ {
+ return true;
+ }
+
+ if (take.IsNewLandAct && LandActWithOwnership.Contains(take.LandActTypeCode))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/source/backend/api/Startup.cs b/source/backend/api/Startup.cs
index 01eb2ebd16..26c860cd1a 100644
--- a/source/backend/api/Startup.cs
+++ b/source/backend/api/Startup.cs
@@ -434,6 +434,7 @@ private static void AddPimsApiServices(IServiceCollection services)
services.AddScoped();
services.AddScoped();
services.AddScoped();
+ services.AddScoped();
}
///
diff --git a/source/backend/api/appsettings.json b/source/backend/api/appsettings.json
index 993f40b0d1..c49fd76c32 100644
--- a/source/backend/api/appsettings.json
+++ b/source/backend/api/appsettings.json
@@ -98,7 +98,8 @@
"Mayan": {
"BaseUri": "[MAYAN_BASE_URI]",
"ConnectionUser": "[MAYAN_USER]",
- "ConnectionPassword": "[MAYAN_USER_PASSWORD]"
+ "ConnectionPassword": "[MAYAN_USER_PASSWORD]",
+ "UploadRetries": 4
},
"Cdogs": {
"AuthEndpoint": "[AUTH_ENDPOINT]",
diff --git a/source/backend/api/Constants/DispositionStatusTypes.cs b/source/backend/apimodels/CodeTypes/DispositionFileStatusTypes.cs
similarity index 79%
rename from source/backend/api/Constants/DispositionStatusTypes.cs
rename to source/backend/apimodels/CodeTypes/DispositionFileStatusTypes.cs
index 46c97dcf88..2727652a67 100644
--- a/source/backend/api/Constants/DispositionStatusTypes.cs
+++ b/source/backend/apimodels/CodeTypes/DispositionFileStatusTypes.cs
@@ -1,10 +1,10 @@
using System.Runtime.Serialization;
using System.Text.Json.Serialization;
-namespace Pims.Api.Constants
+namespace Pims.Api.Models.CodeTypes
{
[JsonConverter(typeof(JsonStringEnumMemberConverter))]
- public enum DispositionStatusTypes
+ public enum DispositionFileStatusTypes
{
[EnumMember(Value = "ACTIVE")]
ACTIVE,
@@ -15,9 +15,6 @@ public enum DispositionStatusTypes
[EnumMember(Value = "CANCELLED")]
CANCELLED,
- [EnumMember(Value = "CLOSED")]
- CLOSED,
-
[EnumMember(Value = "COMPLETE")]
COMPLETE,
diff --git a/source/backend/api/Constants/EnumDispositionStatusTypeCode.cs b/source/backend/apimodels/CodeTypes/DispositionStatusTypes.cs
similarity index 69%
rename from source/backend/api/Constants/EnumDispositionStatusTypeCode.cs
rename to source/backend/apimodels/CodeTypes/DispositionStatusTypes.cs
index 7345b518da..b587cf58fb 100644
--- a/source/backend/api/Constants/EnumDispositionStatusTypeCode.cs
+++ b/source/backend/apimodels/CodeTypes/DispositionStatusTypes.cs
@@ -1,8 +1,11 @@
using System.Runtime.Serialization;
+using System.Text.Json.Serialization;
-namespace Pims.Api.Constants
+namespace Pims.Api.Models.CodeTypes
{
- public enum EnumDispositionStatusTypeCode
+ [JsonConverter(typeof(JsonStringEnumMemberConverter))]
+
+ public enum DispositionStatusTypes
{
[EnumMember(Value = "LISTED")]
LISTED,
diff --git a/source/backend/apimodels/CodeTypes/DocumentRelationType.cs b/source/backend/apimodels/CodeTypes/DocumentRelationType.cs
index 237e40e91b..fba970499d 100644
--- a/source/backend/apimodels/CodeTypes/DocumentRelationType.cs
+++ b/source/backend/apimodels/CodeTypes/DocumentRelationType.cs
@@ -6,19 +6,19 @@ namespace Pims.Api.Models.CodeTypes
[JsonConverter(typeof(JsonStringEnumMemberConverter))]
public enum DocumentRelationType
{
- [EnumMember(Value = "templates")]
+ [EnumMember(Value = "Templates")]
Templates,
- [EnumMember(Value = "researchfiles")]
+ [EnumMember(Value = "ResearchFiles")]
ResearchFiles,
- [EnumMember(Value = "acquisitionfiles")]
+ [EnumMember(Value = "AcquisitionFiles")]
AcquisitionFiles,
- [EnumMember(Value = "leases")]
+ [EnumMember(Value = "Leases")]
Leases,
- [EnumMember(Value = "projects")]
+ [EnumMember(Value = "Projects")]
Projects,
- [EnumMember(Value = "managementfiles")]
+ [EnumMember(Value = "ManagementFiles")]
ManagementFiles,
- [EnumMember(Value = "dispositionfiles")]
+ [EnumMember(Value = "DispositionFiles")]
DispositionFiles,
}
}
diff --git a/source/backend/apimodels/CodeTypes/ExternalResultStatus.cs b/source/backend/apimodels/CodeTypes/ExternalResultStatus.cs
index e642f06710..9fafa73a6d 100644
--- a/source/backend/apimodels/CodeTypes/ExternalResultStatus.cs
+++ b/source/backend/apimodels/CodeTypes/ExternalResultStatus.cs
@@ -12,19 +12,19 @@ public enum ExternalResponseStatus
///
/// The call was successful.
///
- [EnumMember(Value = "success")]
+ [EnumMember(Value = "Success")]
Success,
///
/// Error occured.
///
- [EnumMember(Value = "error")]
+ [EnumMember(Value = "Error")]
Error,
///
/// The external call was not executed.
///
- [EnumMember(Value = "not-executed")]
+ [EnumMember(Value = "NotExecuted")]
NotExecuted,
}
}
diff --git a/source/backend/apimodels/CodeTypes/FormDocumentType.cs b/source/backend/apimodels/CodeTypes/FormDocumentType.cs
index 8df3d1ec60..165c9098ed 100644
--- a/source/backend/apimodels/CodeTypes/FormDocumentType.cs
+++ b/source/backend/apimodels/CodeTypes/FormDocumentType.cs
@@ -23,7 +23,7 @@ public enum FormDocumentType
H179T,
// Letter
- [EnumMember(Value = "Letter")]
+ [EnumMember(Value = "LETTER")]
LETTER,
// Conditions of Entry (H0443)
diff --git a/source/backend/apimodels/CodeTypes/LandActTypes.cs b/source/backend/apimodels/CodeTypes/LandActTypes.cs
new file mode 100644
index 0000000000..0bb658f732
--- /dev/null
+++ b/source/backend/apimodels/CodeTypes/LandActTypes.cs
@@ -0,0 +1,30 @@
+using System.Runtime.Serialization;
+using System.Text.Json.Serialization;
+
+namespace Pims.Api.Models.CodeTypes
+{
+ [JsonConverter(typeof(JsonStringEnumMemberConverter))]
+ public enum LandActTypes
+ {
+ [EnumMember(Value = "Crown Grant")]
+ CROWN_GRANT,
+
+ [EnumMember(Value = "NOI")]
+ NOI,
+
+ [EnumMember(Value = "Section 15")]
+ SECTION_15,
+
+ [EnumMember(Value = "Section 16")]
+ SECTION_16,
+
+ [EnumMember(Value = "Section 17")]
+ SECTION_17,
+
+ [EnumMember(Value = "Section 66")]
+ SECTION_66,
+
+ [EnumMember(Value = "Transfer Admin")]
+ TRANSFER_OF_ADMIN_AND_CONTROL,
+ }
+}
diff --git a/source/backend/apimodels/CodeTypes/PropertyPPHStatusTypes.cs b/source/backend/apimodels/CodeTypes/PropertyPPHStatusTypes.cs
new file mode 100644
index 0000000000..4cdb89f28e
--- /dev/null
+++ b/source/backend/apimodels/CodeTypes/PropertyPPHStatusTypes.cs
@@ -0,0 +1,24 @@
+using System.Runtime.Serialization;
+using System.Text.Json.Serialization;
+
+namespace Pims.Api.Models.CodeTypes
+{
+ [JsonConverter(typeof(JsonStringEnumMemberConverter))]
+ public enum PropertyPPHStatusTypes
+ {
+ [EnumMember(Value = "ARTERY")]
+ ARTERY,
+
+ [EnumMember(Value = "COMBO")]
+ COMBO,
+
+ [EnumMember(Value = "NONPPH")]
+ NONPPH,
+
+ [EnumMember(Value = "PPH")]
+ PPH,
+
+ [EnumMember(Value = "UNKNOWN")]
+ UNKNOWN,
+ }
+}
diff --git a/source/backend/apimodels/CodeTypes/TakeTypes.cs b/source/backend/apimodels/CodeTypes/TakeTypes.cs
new file mode 100644
index 0000000000..843e528b32
--- /dev/null
+++ b/source/backend/apimodels/CodeTypes/TakeTypes.cs
@@ -0,0 +1,15 @@
+using System.Runtime.Serialization;
+using System.Text.Json.Serialization;
+
+namespace Pims.Api.Models.CodeTypes
+{
+ [JsonConverter(typeof(JsonStringEnumMemberConverter))]
+ public enum TakeTypes
+ {
+ [EnumMember(Value = "TOTAL")]
+ TOTAL,
+
+ [EnumMember(Value = "PARTIAL")]
+ PARTIAL,
+ }
+}
diff --git a/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileMap.cs b/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileMap.cs
index 533da31c3e..5af9619ae1 100644
--- a/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileMap.cs
+++ b/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileMap.cs
@@ -26,7 +26,6 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.FundingOther, src => src.FundingOther)
.Map(dest => dest.AssignedDate, src => src.AssignedDate)
.Map(dest => dest.DeliveryDate, src => src.DeliveryDate.ToNullableDateOnly())
- .Map(dest => dest.CompletionDate, src => src.CompletionDate.ToNullableDateOnly())
.Map(dest => dest.TotalAllowableCompensation, src => src.TotalAllowableCompensation)
.Map(dest => dest.FileStatusTypeCode, src => src.AcquisitionFileStatusTypeCodeNavigation)
.Map(dest => dest.AcquisitionPhysFileStatusTypeCode, src => src.AcqPhysFileStatusTypeCodeNavigation)
@@ -54,7 +53,6 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.FundingOther, src => src.FundingOther)
.Map(dest => dest.AssignedDate, src => src.AssignedDate)
.Map(dest => dest.DeliveryDate, src => src.DeliveryDate.ToNullableDateTime())
- .Map(dest => dest.CompletionDate, src => src.CompletionDate.ToNullableDateTime())
.Map(dest => dest.TotalAllowableCompensation, src => src.TotalAllowableCompensation)
.Map(dest => dest.AcquisitionFileStatusTypeCode, src => src.FileStatusTypeCode.Id)
.Map(dest => dest.AcqPhysFileStatusTypeCode, src => src.AcquisitionPhysFileStatusTypeCode.Id)
diff --git a/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileModel.cs b/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileModel.cs
index 4fdad731ef..10144fe693 100644
--- a/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileModel.cs
+++ b/source/backend/apimodels/Models/Concepts/AcquisitionFile/AcquisitionFileModel.cs
@@ -33,11 +33,6 @@ public class AcquisitionFileModel : FileWithChecklistModel
///
public DateOnly? DeliveryDate { get; set; }
- ///
- /// The date of acquisition file completion.
- ///
- public DateOnly? CompletionDate { get; set; }
-
///
/// get/set - The acquisition physical file status type.
///
diff --git a/source/backend/apimodels/Models/Concepts/FinancialCode/FinancialCodeTypes.cs b/source/backend/apimodels/Models/Concepts/FinancialCode/FinancialCodeTypes.cs
index 67f4347776..63450b60e4 100644
--- a/source/backend/apimodels/Models/Concepts/FinancialCode/FinancialCodeTypes.cs
+++ b/source/backend/apimodels/Models/Concepts/FinancialCode/FinancialCodeTypes.cs
@@ -9,25 +9,25 @@ namespace Pims.Api.Models.Concepts.FinancialCode
[JsonConverter(typeof(JsonStringEnumMemberConverter))]
public enum FinancialCodeTypes
{
- [EnumMember(Value = "business-function")]
+ [EnumMember(Value = "BusinessFunction")]
BusinessFunction,
- [EnumMember(Value = "cost-types")]
+ [EnumMember(Value = "CostType")]
CostType,
- [EnumMember(Value = "work-activity")]
+ [EnumMember(Value = "WorkActivity")]
WorkActivity,
- [EnumMember(Value = "chart-of-accounts")]
+ [EnumMember(Value = "ChartOfAccounts")]
ChartOfAccounts,
- [EnumMember(Value = "financial-activity")]
+ [EnumMember(Value = "FinancialActivity")]
FinancialActivity,
- [EnumMember(Value = "responsibility")]
+ [EnumMember(Value = "Responsibility")]
Responsibility,
- [EnumMember(Value = "yearly-financial")]
+ [EnumMember(Value = "YearlyFinancial")]
YearlyFinancial,
}
}
diff --git a/source/backend/apimodels/Models/Concepts/Property/PropertyMap.cs b/source/backend/apimodels/Models/Concepts/Property/PropertyMap.cs
index 228e24c647..9ddf744f46 100644
--- a/source/backend/apimodels/Models/Concepts/Property/PropertyMap.cs
+++ b/source/backend/apimodels/Models/Concepts/Property/PropertyMap.cs
@@ -38,9 +38,6 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.PphStatusUpdateUserGuid, src => src.PphStatusUpdateUserGuid)
.Map(dest => dest.Notes, src => src.Notes)
.Map(dest => dest.IsOwned, src => src.IsOwned)
- .Map(dest => dest.IsPropertyOfInterest, src => src.IsPropertyOfInterest)
- .Map(dest => dest.IsOtherInterest, src => src.IsOtherInterest)
- .Map(dest => dest.IsDisposed, src => src.IsDisposed)
.Map(dest => dest.IsVisibleToOtherAgencies, src => src.IsVisibleToOtherAgencies)
// multi-selects
@@ -95,9 +92,6 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.Notes, src => src.Notes)
.Map(dest => dest.IsOwned, src => src.IsOwned)
- .Map(dest => dest.IsPropertyOfInterest, src => src.IsPropertyOfInterest)
- .Map(dest => dest.IsOtherInterest, src => src.IsOtherInterest)
- .Map(dest => dest.IsDisposed, src => src.IsDisposed)
.Map(dest => dest.IsVisibleToOtherAgencies, src => src.IsVisibleToOtherAgencies)
// multi-selects
diff --git a/source/backend/apimodels/Models/Concepts/Property/PropertyModel.cs b/source/backend/apimodels/Models/Concepts/Property/PropertyModel.cs
index b0290acf55..2b74157080 100644
--- a/source/backend/apimodels/Models/Concepts/Property/PropertyModel.cs
+++ b/source/backend/apimodels/Models/Concepts/Property/PropertyModel.cs
@@ -154,21 +154,6 @@ public class PropertyModel : BaseConcurrentModel
///
public bool IsOwned { get; set; }
- ///
- /// get/set - Whether this parcel is a property of interest to the ministry.
- ///
- public bool IsPropertyOfInterest { get; set; }
-
- ///
- /// get/set - Whether this parcel is part of other types of interests for the ministry. i.e legal rights.
- ///
- public bool IsOtherInterest { get; set; }
-
- ///
- /// get/set - Whether this parcel is part has been disposed.
- ///
- public bool IsDisposed { get; set; }
-
///
/// get/set - Whether or not other agencies can view this property.
///
diff --git a/source/backend/apimodels/Models/Concepts/Property/PropertyViewMap.cs b/source/backend/apimodels/Models/Concepts/Property/PropertyViewMap.cs
new file mode 100644
index 0000000000..c6e5c98d80
--- /dev/null
+++ b/source/backend/apimodels/Models/Concepts/Property/PropertyViewMap.cs
@@ -0,0 +1,101 @@
+using Mapster;
+using Entity = Pims.Dal.Entities;
+
+namespace Pims.Api.Models.Concepts.Property
+{
+ public class PropertyViewMap : IRegister
+ {
+ public void Register(TypeAdapterConfig config)
+ {
+ config.NewConfig()
+ .Map(dest => dest.Id, src => src.PropertyId)
+ .Map(dest => dest.Pid, src => src.Pid)
+.Map(dest => dest.PidPadded, src => src.PidPadded)
+.Map(dest => dest.Pin, src => src.Pin)
+.Map(dest => dest.PropertyTypeCode, src => src.PropertyTypeCode)
+.Map(dest => dest.PropertyStatusTypeCode, src => src.PropertyStatusTypeCode)
+.Map(dest => dest.PropertyDataSourceTypeCode, src => src.PropertyDataSourceTypeCode)
+.Map(dest => dest.PropertyDataSourceEffectiveDate, src => src.PropertyDataSourceEffectiveDate)
+.Map(dest => dest.PropertyClassificationTypeCode, src => src.PropertyClassificationTypeCode)
+.Map(dest => dest.PropertyTenureTypeCode, src => src.PropertyTenureTypeCode)
+.Map(dest => dest.StreetAddress1, src => src.StreetAddress1)
+.Map(dest => dest.StreetAddress2, src => src.StreetAddress2)
+.Map(dest => dest.StreetAddress3, src => src.StreetAddress3)
+.Map(dest => dest.MunicipalityName, src => src.MunicipalityName)
+.Map(dest => dest.PostalCode, src => src.PostalCode)
+.Map(dest => dest.ProvinceStateCode, src => src.ProvinceStateCode)
+.Map(dest => dest.ProvinceName, src => src.ProvinceName)
+.Map(dest => dest.CountryCode, src => src.CountryCode)
+.Map(dest => dest.CountryName, src => src.CountryName)
+.Map(dest => dest.Name, src => src.Name)
+.Map(dest => dest.Description, src => src.Description)
+.Map(dest => dest.AddressId, src => src.AddressId)
+.Map(dest => dest.RegionCode, src => src.RegionCode)
+.Map(dest => dest.DistrictCode, src => src.DistrictCode)
+.Map(dest => dest.PropertyAreaUnitTypeCode, src => src.PropertyAreaUnitTypeCode)
+.Map(dest => dest.LandArea, src => src.LandArea)
+.Map(dest => dest.LandLegalDescription, src => src.LandLegalDescription)
+.Map(dest => dest.SurveyPlanNumber, src => src.SurveyPlanNumber)
+.Map(dest => dest.EncumbranceReason, src => src.EncumbranceReason)
+.Map(dest => dest.IsSensitive, src => src.IsSensitive)
+.Map(dest => dest.IsOwned, src => src.IsOwned)
+.Map(dest => dest.IsRetired, src => src.IsRetired)
+.Map(dest => dest.IsVisibleToOtherAgencies, src => src.IsVisibleToOtherAgencies)
+.Map(dest => dest.Zoning, src => src.Zoning)
+.Map(dest => dest.ZoningPotential, src => src.ZoningPotential)
+.Map(dest => dest.IsDisposed, src => src.IsDisposed)
+.Map(dest => dest.IsOtherInterest, src => src.IsOtherInterest)
+.Map(dest => dest.HasActiveAcquisitionFile, src => src.HasActiveAcquisitionFile)
+.Map(dest => dest.HasActiveResearchFile, src => src.HasActiveResearchFile)
+.Map(dest => dest.IsPayableLease, src => src.IsPayableLease)
+.Map(dest => dest.IsActivePayableLease, src => src.IsActivePayableLease)
+.Map(dest => dest.IsReceivableLease, src => src.IsReceivableLease)
+.Map(dest => dest.IsActiveReceivableLease, src => src.IsActiveReceivableLease);
+
+ config.NewConfig()
+ .Map(dest => dest.PropertyId, src => src.Id)
+ .Map(dest => dest.Pid, src => src.Pid)
+.Map(dest => dest.PidPadded, src => src.PidPadded)
+.Map(dest => dest.Pin, src => src.Pin)
+.Map(dest => dest.PropertyTypeCode, src => src.PropertyTypeCode)
+.Map(dest => dest.PropertyStatusTypeCode, src => src.PropertyStatusTypeCode)
+.Map(dest => dest.PropertyDataSourceTypeCode, src => src.PropertyDataSourceTypeCode)
+.Map(dest => dest.PropertyDataSourceEffectiveDate, src => src.PropertyDataSourceEffectiveDate)
+.Map(dest => dest.PropertyClassificationTypeCode, src => src.PropertyClassificationTypeCode)
+.Map(dest => dest.PropertyTenureTypeCode, src => src.PropertyTenureTypeCode)
+.Map(dest => dest.StreetAddress1, src => src.StreetAddress1)
+.Map(dest => dest.StreetAddress2, src => src.StreetAddress2)
+.Map(dest => dest.StreetAddress3, src => src.StreetAddress3)
+.Map(dest => dest.MunicipalityName, src => src.MunicipalityName)
+.Map(dest => dest.PostalCode, src => src.PostalCode)
+.Map(dest => dest.ProvinceStateCode, src => src.ProvinceStateCode)
+.Map(dest => dest.ProvinceName, src => src.ProvinceName)
+.Map(dest => dest.CountryCode, src => src.CountryCode)
+.Map(dest => dest.CountryName, src => src.CountryName)
+.Map(dest => dest.Name, src => src.Name)
+.Map(dest => dest.Description, src => src.Description)
+.Map(dest => dest.AddressId, src => src.AddressId)
+.Map(dest => dest.RegionCode, src => src.RegionCode)
+.Map(dest => dest.DistrictCode, src => src.DistrictCode)
+.Map(dest => dest.PropertyAreaUnitTypeCode, src => src.PropertyAreaUnitTypeCode)
+.Map(dest => dest.LandArea, src => src.LandArea)
+.Map(dest => dest.LandLegalDescription, src => src.LandLegalDescription)
+.Map(dest => dest.SurveyPlanNumber, src => src.SurveyPlanNumber)
+.Map(dest => dest.EncumbranceReason, src => src.EncumbranceReason)
+.Map(dest => dest.IsSensitive, src => src.IsSensitive)
+.Map(dest => dest.IsOwned, src => src.IsOwned)
+.Map(dest => dest.IsRetired, src => src.IsRetired)
+.Map(dest => dest.IsVisibleToOtherAgencies, src => src.IsVisibleToOtherAgencies)
+.Map(dest => dest.Zoning, src => src.Zoning)
+.Map(dest => dest.ZoningPotential, src => src.ZoningPotential)
+.Map(dest => dest.IsDisposed, src => src.IsDisposed)
+.Map(dest => dest.IsOtherInterest, src => src.IsOtherInterest)
+.Map(dest => dest.HasActiveAcquisitionFile, src => src.HasActiveAcquisitionFile)
+.Map(dest => dest.HasActiveResearchFile, src => src.HasActiveResearchFile)
+.Map(dest => dest.IsPayableLease, src => src.IsPayableLease)
+.Map(dest => dest.IsActivePayableLease, src => src.IsActivePayableLease)
+.Map(dest => dest.IsReceivableLease, src => src.IsReceivableLease)
+.Map(dest => dest.IsActiveReceivableLease, src => src.IsActiveReceivableLease);
+ }
+ }
+}
diff --git a/source/backend/apimodels/Models/Concepts/Property/PropertyViewModel.cs b/source/backend/apimodels/Models/Concepts/Property/PropertyViewModel.cs
new file mode 100644
index 0000000000..c1ba480e84
--- /dev/null
+++ b/source/backend/apimodels/Models/Concepts/Property/PropertyViewModel.cs
@@ -0,0 +1,100 @@
+using System;
+
+namespace Pims.Api.Models.Concepts.Property
+{
+ ///
+ /// PropertyViewModel class, provides a model to represent the property view.
+ ///
+ public class PropertyViewModel
+ {
+ #region Properties
+
+ public long Id { get; set; }
+
+ public int? Pid { get; set; }
+
+ public string PidPadded { get; set; }
+
+ public int? Pin { get; set; }
+
+ public string PropertyTypeCode { get; set; }
+
+ public string PropertyStatusTypeCode { get; set; }
+
+ public string PropertyDataSourceTypeCode { get; set; }
+
+ public DateOnly PropertyDataSourceEffectiveDate { get; set; }
+
+ public string PropertyClassificationTypeCode { get; set; }
+
+ public string PropertyTenureTypeCode { get; set; }
+
+ public string StreetAddress1 { get; set; }
+
+ public string StreetAddress2 { get; set; }
+
+ public string StreetAddress3 { get; set; }
+
+ public string MunicipalityName { get; set; }
+
+ public string PostalCode { get; set; }
+
+ public string ProvinceStateCode { get; set; }
+
+ public string ProvinceName { get; set; }
+
+ public string CountryCode { get; set; }
+
+ public string CountryName { get; set; }
+
+ public string Name { get; set; }
+
+ public string Description { get; set; }
+
+ public long? AddressId { get; set; }
+
+ public short RegionCode { get; set; }
+
+ public short DistrictCode { get; set; }
+
+ public string PropertyAreaUnitTypeCode { get; set; }
+
+ public float? LandArea { get; set; }
+
+ public string LandLegalDescription { get; set; }
+
+ public string SurveyPlanNumber { get; set; }
+
+ public string EncumbranceReason { get; set; }
+
+ public bool IsSensitive { get; set; }
+
+ public bool IsOwned { get; set; }
+
+ public bool? IsRetired { get; set; }
+
+ public bool IsVisibleToOtherAgencies { get; set; }
+
+ public string Zoning { get; set; }
+
+ public string ZoningPotential { get; set; }
+
+ public bool? IsDisposed { get; set; }
+
+ public bool? IsOtherInterest { get; set; }
+
+ public bool? HasActiveAcquisitionFile { get; set; }
+
+ public bool? HasActiveResearchFile { get; set; }
+
+ public bool? IsPayableLease { get; set; }
+
+ public bool? IsActivePayableLease { get; set; }
+
+ public bool? IsReceivableLease { get; set; }
+
+ public bool? IsActiveReceivableLease { get; set; }
+
+ #endregion
+ }
+}
diff --git a/source/backend/apimodels/Models/Concepts/Take/TakeMap.cs b/source/backend/apimodels/Models/Concepts/Take/TakeMap.cs
index 92feeb3f5e..47d98f19be 100644
--- a/source/backend/apimodels/Models/Concepts/Take/TakeMap.cs
+++ b/source/backend/apimodels/Models/Concepts/Take/TakeMap.cs
@@ -32,6 +32,10 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.TakeTypeCode, src => src.TakeTypeCodeNavigation)
.Map(dest => dest.TakeStatusTypeCode, src => src.TakeStatusTypeCodeNavigation)
.Map(dest => dest.LandActTypeCode, src => src.LandActTypeCodeNavigation)
+ .Map(dest => dest.CompletionDt, src => src.CompletionDt)
+ .Map(dest => dest.IsLeasePayable, src => src.IsActiveLease)
+ .Map(dest => dest.LeasePayableArea, src => src.ActiveLeaseArea)
+ .Map(dest => dest.LeasePayableEndDt, src => src.ActiveLeaseEndDt)
.Inherits();
config.NewConfig()
@@ -58,6 +62,10 @@ public void Register(TypeAdapterConfig config)
.Map(dest => dest.TakeTypeCode, src => src.TakeTypeCode.Id)
.Map(dest => dest.TakeStatusTypeCode, src => src.TakeStatusTypeCode.Id)
.Map(dest => dest.LandActTypeCode, src => src.LandActTypeCode.Id)
+ .Map(dest => dest.CompletionDt, src => src.CompletionDt)
+ .Map(dest => dest.IsActiveLease, src => src.IsLeasePayable)
+ .Map(dest => dest.ActiveLeaseArea, src => src.LeasePayableArea)
+ .Map(dest => dest.ActiveLeaseEndDt, src => src.LeasePayableEndDt)
.Inherits();
}
}
diff --git a/source/backend/apimodels/Models/Concepts/Take/TakeModel.cs b/source/backend/apimodels/Models/Concepts/Take/TakeModel.cs
index 5922f6ca62..1be825c9ef 100644
--- a/source/backend/apimodels/Models/Concepts/Take/TakeModel.cs
+++ b/source/backend/apimodels/Models/Concepts/Take/TakeModel.cs
@@ -31,24 +31,32 @@ public class TakeModel : BaseAuditModel
public bool? IsNewInterestInSrw { get; set; }
+ public bool? IsLeasePayable { get; set; }
+
public float? LicenseToConstructArea { get; set; }
public DateOnly? LtcEndDt { get; set; }
- public float? LandActArea { get; set; }
-
public DateOnly? LandActEndDt { get; set; }
+ public DateOnly? CompletionDt { get; set; }
+
+ public DateOnly? SrwEndDt { get; set; }
+
+ public DateOnly? LeasePayableEndDt { get; set; }
+
public AcquisitionFileModel PropertyAcquisitionFile { get; set; }
public long PropertyAcquisitionFileId { get; set; }
public float? StatutoryRightOfWayArea { get; set; }
- public DateOnly? SrwEndDt { get; set; }
+ public float? LandActArea { get; set; }
public float? SurplusArea { get; set; }
+ public float? LeasePayableArea { get; set; }
+
public CodeTypeModel TakeSiteContamTypeCode { get; set; }
public CodeTypeModel TakeTypeCode { get; set; }
diff --git a/source/backend/dal/Exceptions/OverrideExceptions.cs b/source/backend/dal/Exceptions/OverrideExceptions.cs
index cfd4fa58b7..df35cd7bec 100644
--- a/source/backend/dal/Exceptions/OverrideExceptions.cs
+++ b/source/backend/dal/Exceptions/OverrideExceptions.cs
@@ -50,6 +50,21 @@ public static UserOverrideCode DisposeOfProperties
get { return new UserOverrideCode("DISPOSE_OF_PROPERTIES"); }
}
+ public static UserOverrideCode DeleteCompletedTake
+ {
+ get { return new UserOverrideCode("DELETE_COMPLETED_TAKE"); }
+ }
+
+ public static UserOverrideCode DeleteLastTake
+ {
+ get { return new UserOverrideCode("DELETE_LAST_TAKE"); }
+ }
+
+ public static UserOverrideCode DeleteTakeActiveDisposition
+ {
+ get { return new UserOverrideCode("DELETE_TAKE_ACTIVE_DISPOSITION"); }
+ }
+
public string Code { get; private set; }
private static List UserOverrideCodes => new List()
@@ -63,6 +78,9 @@ public static UserOverrideCode DisposeOfProperties
UserOverrideCode.DisposingPropertyNotInventoried,
UserOverrideCode.DispositionFileFinalStatus,
UserOverrideCode.DisposeOfProperties,
+ UserOverrideCode.DeleteCompletedTake,
+ UserOverrideCode.DeleteLastTake,
+ UserOverrideCode.DeleteTakeActiveDisposition,
};
private UserOverrideCode(string code)
diff --git a/source/backend/dal/Helpers/Extensions/PropertyExtensions.cs b/source/backend/dal/Helpers/Extensions/PropertyExtensions.cs
index 7ea2852b30..1d90dda435 100644
--- a/source/backend/dal/Helpers/Extensions/PropertyExtensions.cs
+++ b/source/backend/dal/Helpers/Extensions/PropertyExtensions.cs
@@ -4,7 +4,6 @@
using System.Text.RegularExpressions;
using LinqKit;
using Microsoft.EntityFrameworkCore;
-using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Pims.Core.Extensions;
using Pims.Dal.Entities;
using Pims.Dal.Security;
@@ -25,21 +24,12 @@ public static class PropertyExtensions
///
///
///
- public static IQueryable GeneratePropertyQuery(this PimsContext context, ClaimsPrincipal user, Entity.Models.PropertyFilter filter)
+ public static IQueryable GeneratePropertyQuery(this PimsContext context, ClaimsPrincipal user, Entity.Models.PropertyFilter filter)
{
filter.ThrowIfNull(nameof(filter));
filter.ThrowIfNull(nameof(user));
- var query = context.PimsProperties
- .Include(p => p.Address)
- .ThenInclude(a => a.RegionCodeNavigation)
- .Include(p => p.Address)
- .ThenInclude(a => a.DistrictCodeNavigation)
- .Include(p => p.Address)
- .ThenInclude(a => a.ProvinceState)
- .Include(p => p.Address)
- .ThenInclude(a => a.Country)
- .Include(p => p.PropertyAreaUnitTypeCodeNavigation)
+ var query = context.PimsPropertyVws
.AsNoTracking();
var predicate = GenerateCommonPropertyQuery(user, filter);
@@ -63,7 +53,7 @@ public static class PropertyExtensions
///
///
///
- private static ExpressionStarter GenerateCommonPropertyQuery(ClaimsPrincipal user, Entity.Models.PropertyFilter filter)
+ private static ExpressionStarter GenerateCommonPropertyQuery(ClaimsPrincipal user, Entity.Models.PropertyFilter filter)
{
filter.ThrowIfNull(nameof(filter));
filter.ThrowIfNull(nameof(user));
@@ -71,7 +61,7 @@ private static ExpressionStarter GenerateCommonPropertyQuery(Claim
// Check if user has the ability to view sensitive properties.
var viewSensitive = user.HasPermission(Permissions.SensitiveView);
- var predicateBuilder = PredicateBuilder.New(p => true);
+ var predicateBuilder = PredicateBuilder.New(p => true);
// Users are not allowed to view sensitive properties outside of their organization or sub-organizations.
if (!viewSensitive)
@@ -84,45 +74,47 @@ private static ExpressionStarter GenerateCommonPropertyQuery(Claim
// note - 2 part search required. all matches found by removing leading 0's, then matches filtered in subsequent step. This is because EF core does not support an lpad method.
Regex nonInteger = new Regex("[^\\d]");
var formattedPidPin = Convert.ToInt32(nonInteger.Replace(filter.PinOrPid, string.Empty)).ToString();
- predicateBuilder = predicateBuilder.And(p => p != null && (EF.Functions.Like(p.Pid.ToString(), $"%{formattedPidPin}%") || EF.Functions.Like(p.Pin.ToString(), $"%{formattedPidPin}%")));
+ predicateBuilder = predicateBuilder.And(p => EF.Functions.Like(p.Pid.ToString(), $"%{formattedPidPin}%") || EF.Functions.Like(p.Pin.ToString(), $"%{formattedPidPin}%"));
}
if (!string.IsNullOrWhiteSpace(filter.Address))
{
- predicateBuilder = predicateBuilder.And(p => EF.Functions.Like(p.Address.StreetAddress1, $"%{filter.Address}%") || EF.Functions.Like(p.Address.MunicipalityName, $"%{filter.Address}%"));
+ predicateBuilder = predicateBuilder.And(p => EF.Functions.Like(p.StreetAddress1, $"%{filter.Address}%") || EF.Functions.Like(p.MunicipalityName, $"%{filter.Address}%"));
}
if (!string.IsNullOrWhiteSpace(filter.PlanNumber))
{
- predicateBuilder = predicateBuilder.And(p => p != null && p.SurveyPlanNumber.Equals(filter.PlanNumber));
+ predicateBuilder = predicateBuilder.And(p => p.SurveyPlanNumber.Equals(filter.PlanNumber));
}
var isRetired = filter.Ownership.Contains("isRetired");
- ExpressionStarter ownershipBuilder;
+ ExpressionStarter ownershipBuilder;
if (filter.Ownership.Count > 0)
{
- ownershipBuilder = isRetired ? PredicateBuilder.New(p => p.IsRetired == true) : PredicateBuilder.New(p => false);
+ // Property ownership filters
+ ownershipBuilder = isRetired ? PredicateBuilder.New(p => p.IsRetired == true) : PredicateBuilder.New(p => false);
if (filter.Ownership.Contains("isCoreInventory"))
{
ownershipBuilder = ownershipBuilder.Or(p => p.IsOwned && p.IsRetired != true);
}
if (filter.Ownership.Contains("isPropertyOfInterest"))
{
- ownershipBuilder = ownershipBuilder.Or(p => p.IsPropertyOfInterest && p.IsRetired != true);
+ ownershipBuilder.Or(p => p.IsRetired != true && p.HasActiveAcquisitionFile.HasValue && p.HasActiveAcquisitionFile.Value);
+ ownershipBuilder.Or(p => p.IsRetired != true && p.HasActiveResearchFile.HasValue && p.HasActiveResearchFile.Value);
}
if (filter.Ownership.Contains("isOtherInterest"))
{
- ownershipBuilder = ownershipBuilder.Or(p => p.IsOtherInterest && p.IsRetired != true);
+ ownershipBuilder.Or(p => p.IsRetired != true && p.IsOtherInterest.HasValue && p.IsOtherInterest.Value);
}
if (filter.Ownership.Contains("isDisposed"))
{
- ownershipBuilder = ownershipBuilder.Or(p => p.IsDisposed && p.IsRetired != true);
+ ownershipBuilder.Or(p => p.IsRetired != true && p.IsDisposed.HasValue && p.IsDisposed.Value);
}
}
else
{
// psp-7658 is retired properties should be omitted by default.
- ownershipBuilder = PredicateBuilder.New(p => p.IsRetired != true);
+ ownershipBuilder = PredicateBuilder.New(p => p.IsRetired != true);
}
predicateBuilder = predicateBuilder.And(ownershipBuilder);
diff --git a/source/backend/dal/Pims.Dal.csproj b/source/backend/dal/Pims.Dal.csproj
index ccaaac338b..d1f653dc4f 100644
--- a/source/backend/dal/Pims.Dal.csproj
+++ b/source/backend/dal/Pims.Dal.csproj
@@ -43,6 +43,7 @@
+
diff --git a/source/backend/dal/Repositories/AcquisitionFileRepository.cs b/source/backend/dal/Repositories/AcquisitionFileRepository.cs
index 818a017d2c..6b092b820a 100644
--- a/source/backend/dal/Repositories/AcquisitionFileRepository.cs
+++ b/source/backend/dal/Repositories/AcquisitionFileRepository.cs
@@ -657,7 +657,7 @@ public PimsAcquisitionFile Add(PimsAcquisitionFile acquisitionFile)
using var scope = Logger.QueryScope();
acquisitionFile.ThrowIfNull(nameof(acquisitionFile));
- if (acquisitionFile.PimsPropertyAcquisitionFiles.Any(x =>x.Property != null && x.Property.IsRetired.HasValue && x.Property.IsRetired.Value))
+ if (acquisitionFile.PimsPropertyAcquisitionFiles.Any(x => x.Property != null && x.Property.IsRetired.HasValue && x.Property.IsRetired.Value))
{
throw new BusinessRuleViolationException("Retired property can not be selected.");
}
@@ -755,6 +755,15 @@ public PimsAcquisitionFile GetByAcquisitionFilePropertyId(long acquisitionFilePr
.FirstOrDefault(a => a.PimsPropertyAcquisitionFiles.Any(x => x.PropertyAcquisitionFileId == acquisitionFilePropertyId));
}
+ public PimsProperty GetProperty(long acquisitionFilePropertyId)
+ {
+ return this.Context.PimsPropertyAcquisitionFiles.AsNoTracking()
+ .Include(p => p.Property)
+ .Where(p => p.PropertyAcquisitionFileId == acquisitionFilePropertyId)
+ .Select(p => p.Property)
+ .FirstOrDefault();
+ }
+
///
/// Generates a new Acquisition Number in the following format.
///
diff --git a/source/backend/dal/Repositories/CompReqFinancialRepository.cs b/source/backend/dal/Repositories/CompReqFinancialRepository.cs
index e55c67147f..0149e076af 100644
--- a/source/backend/dal/Repositories/CompReqFinancialRepository.cs
+++ b/source/backend/dal/Repositories/CompReqFinancialRepository.cs
@@ -42,7 +42,7 @@ public IEnumerable GetAllByAcquisitionFileId(long acquisit
{
query = query.Where(c => c.CompensationRequisition.IsDraft == false);
}
- return query.ToArray();
+ return query.AsNoTracking().ToArray();
}
public IEnumerable SearchCompensationRequisitionFinancials(AcquisitionReportFilterModel filter)
diff --git a/source/backend/dal/Repositories/DocumentRepository.cs b/source/backend/dal/Repositories/DocumentRepository.cs
index b4fc0b1230..71c3407645 100644
--- a/source/backend/dal/Repositories/DocumentRepository.cs
+++ b/source/backend/dal/Repositories/DocumentRepository.cs
@@ -41,7 +41,7 @@ public DocumentRepository(
///
public PimsDocument TryGet(long documentId)
{
- return this.Context.PimsDocuments.FirstOrDefault(x => x.DocumentId == documentId);
+ return this.Context.PimsDocuments.AsNoTracking().FirstOrDefault(x => x.DocumentId == documentId);
}
///
diff --git a/source/backend/dal/Repositories/EntityNoteRepository.cs b/source/backend/dal/Repositories/EntityNoteRepository.cs
index 5130d35599..7d1252c1e3 100644
--- a/source/backend/dal/Repositories/EntityNoteRepository.cs
+++ b/source/backend/dal/Repositories/EntityNoteRepository.cs
@@ -47,31 +47,31 @@ public T Add(T entity)
public IEnumerable GetAllAcquisitionNotesById(long acquisitionId)
{
return this.Context.PimsAcquisitionFileNotes
- .Where(x => x.AcquisitionFileId == acquisitionId).Select(x => x.Note).ToList();
+ .Where(x => x.AcquisitionFileId == acquisitionId).AsNoTracking().Select(x => x.Note).ToList();
}
public IEnumerable GetAllDispositionNotesById(long dispositionId)
{
return this.Context.PimsDispositionFileNotes
- .Where(x => x.DispositionFileId == dispositionId).Select(x => x.Note).ToList();
+ .Where(x => x.DispositionFileId == dispositionId).AsNoTracking().Select(x => x.Note).ToList();
}
public IEnumerable GetAllLeaseNotesById(long leaseId)
{
return this.Context.PimsLeaseNotes
- .Where(x => x.LeaseId == leaseId).Select(x => x.Note).ToList();
+ .Where(x => x.LeaseId == leaseId).AsNoTracking().Select(x => x.Note).ToList();
}
public IEnumerable GetAllProjectNotesById(long entityId)
{
return this.Context.PimsProjectNotes
- .Where(x => x.ProjectId == entityId).Select(x => x.Note).ToList();
+ .Where(x => x.ProjectId == entityId).AsNoTracking().Select(x => x.Note).ToList();
}
public IEnumerable GetAllResearchNotesById(long entityId)
{
return this.Context.PimsResearchFileNotes
- .Where(x => x.ResearchFileId == entityId).Select(x => x.Note).ToList();
+ .Where(x => x.ResearchFileId == entityId).AsNoTracking().Select(x => x.Note).ToList();
}
public bool DeleteAcquisitionFileNotes(long noteId)
diff --git a/source/backend/dal/Repositories/H120CategoryRepository.cs b/source/backend/dal/Repositories/H120CategoryRepository.cs
index a34e8dbe1d..8e3efd5302 100644
--- a/source/backend/dal/Repositories/H120CategoryRepository.cs
+++ b/source/backend/dal/Repositories/H120CategoryRepository.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Data.Entity;
using System.Linq;
using System.Security.Claims;
using Microsoft.Extensions.Logging;
@@ -34,7 +35,7 @@ public IEnumerable GetAll()
{
_user.ThrowIfNotAuthorized(Permissions.CompensationRequisitionView);
- return Context.PimsH120Categories.ToArray();
+ return Context.PimsH120Categories.AsNoTracking().ToArray();
}
}
}
diff --git a/source/backend/dal/Repositories/Interfaces/IAcquisitionFileRepository.cs b/source/backend/dal/Repositories/Interfaces/IAcquisitionFileRepository.cs
index 6c92472232..c522192bf2 100644
--- a/source/backend/dal/Repositories/Interfaces/IAcquisitionFileRepository.cs
+++ b/source/backend/dal/Repositories/Interfaces/IAcquisitionFileRepository.cs
@@ -28,6 +28,8 @@ public interface IAcquisitionFileRepository : IRepository
PimsAcquisitionFile GetByAcquisitionFilePropertyId(long acquisitionFilePropertyId);
+ PimsProperty GetProperty(long acquisitionFilePropertyId);
+
List GetAcquisitionFileExportDeep(AcquisitionFilter filter, HashSet regions, long? contractorPersonId = null);
}
}
diff --git a/source/backend/dal/Repositories/Interfaces/IPropertyRepository.cs b/source/backend/dal/Repositories/Interfaces/IPropertyRepository.cs
index 7b775260f2..94bc79172b 100644
--- a/source/backend/dal/Repositories/Interfaces/IPropertyRepository.cs
+++ b/source/backend/dal/Repositories/Interfaces/IPropertyRepository.cs
@@ -1,7 +1,6 @@
using System.Collections.Generic;
using Pims.Dal.Entities;
using Pims.Dal.Entities.Models;
-using Pims.Dal.Models;
namespace Pims.Dal.Repositories
{
@@ -12,7 +11,7 @@ public interface IPropertyRepository : IRepository
{
int Count();
- Paged GetPage(PropertyFilter filter);
+ Paged GetPage(PropertyFilter filter);
PimsProperty GetById(long id);
@@ -26,13 +25,15 @@ public interface IPropertyRepository : IRepository
PimsProperty GetAllAssociationsById(long id);
+ long GetAllAssociationsCountById(long id);
+
PimsProperty Update(PimsProperty property, bool overrideLocation = false);
PimsProperty UpdatePropertyManagement(PimsProperty property);
void Delete(PimsProperty property);
- PimsProperty TransferFileProperty(PimsProperty property, PropertyOwnershipState state);
+ PimsProperty TransferFileProperty(PimsProperty property, bool isOwned);
PimsProperty RetireProperty(PimsProperty property);
diff --git a/source/backend/dal/Repositories/Interfaces/ITakeRepository.cs b/source/backend/dal/Repositories/Interfaces/ITakeRepository.cs
index 44c15f581a..69bb5c2169 100644
--- a/source/backend/dal/Repositories/Interfaces/ITakeRepository.cs
+++ b/source/backend/dal/Repositories/Interfaces/ITakeRepository.cs
@@ -10,11 +10,19 @@ public interface ITakeRepository : IRepository
{
IEnumerable GetAllByAcquisitionFileId(long fileId);
- IEnumerable GetAllByPropertyId(long fileId, long acquisitionFilePropertyId);
+ IEnumerable GetAllByAcqPropertyId(long fileId, long propertyId);
- int GetCountByPropertyId(long propertyId);
+ IEnumerable GetAllByPropertyId(long propertyId);
+
+ PimsTake GetById(long takeId);
+
+ PimsTake AddTake(PimsTake take);
- void UpdateAcquisitionPropertyTakes(long acquisitionFilePropertyId, IEnumerable takes);
+ PimsTake UpdateTake(PimsTake take);
+
+ bool TryDeleteTake(long takeId);
+
+ int GetCountByPropertyId(long propertyId);
IEnumerable GetAllByPropertyAcquisitionFileId(long acquisitionFilePropertyId);
}
diff --git a/source/backend/dal/Repositories/LeaseRepository.cs b/source/backend/dal/Repositories/LeaseRepository.cs
index fe37a66c16..80a3cdae76 100644
--- a/source/backend/dal/Repositories/LeaseRepository.cs
+++ b/source/backend/dal/Repositories/LeaseRepository.cs
@@ -79,7 +79,7 @@ public PimsLease Get(long id)
{
this.User.ThrowIfNotAuthorized(Permissions.LeaseView);
- PimsLease lease = this.Context.PimsLeases.AsSplitQuery()
+ PimsLease lease = this.Context.PimsLeases.AsSplitQuery().AsNoTracking()
.Include(l => l.PimsPropertyLeases)
.Include(l => l.RegionCodeNavigation)
.Include(l => l.LeaseProgramTypeCodeNavigation)
diff --git a/source/backend/dal/Repositories/OrganizationRepository.cs b/source/backend/dal/Repositories/OrganizationRepository.cs
index 59c2310d83..8933fe99e2 100644
--- a/source/backend/dal/Repositories/OrganizationRepository.cs
+++ b/source/backend/dal/Repositories/OrganizationRepository.cs
@@ -63,6 +63,7 @@ public PimsOrganization GetById(long id)
.Include(o => o.PimsContactMethods)
.ThenInclude(cm => cm.ContactMethodTypeCodeNavigation)
.Where(o => o.OrganizationId == id)
+ .AsNoTracking()
.FirstOrDefault() ?? throw new KeyNotFoundException();
}
diff --git a/source/backend/dal/Repositories/PersonRepository.cs b/source/backend/dal/Repositories/PersonRepository.cs
index 2c4f00aa1e..5c7c17efe7 100644
--- a/source/backend/dal/Repositories/PersonRepository.cs
+++ b/source/backend/dal/Repositories/PersonRepository.cs
@@ -62,6 +62,7 @@ public PimsPerson GetById(long id)
.Include(p => p.PimsContactMethods)
.ThenInclude(cm => cm.ContactMethodTypeCodeNavigation)
.Where(p => p.PersonId == id)
+ .AsNoTracking()
.FirstOrDefault() ?? throw new KeyNotFoundException();
}
diff --git a/source/backend/dal/Repositories/PropertyActivityRepository.cs b/source/backend/dal/Repositories/PropertyActivityRepository.cs
index d2fc0223cb..29b9aa3516 100644
--- a/source/backend/dal/Repositories/PropertyActivityRepository.cs
+++ b/source/backend/dal/Repositories/PropertyActivityRepository.cs
@@ -63,6 +63,7 @@ public PimsPropertyActivity GetActivity(long activityId)
.Include(a => a.PropMgmtActivityStatusTypeCodeNavigation)
.Include(a => a.PimsPropActMinContacts)
.Include(a => a.PimsPropActInvolvedParties)
+ .AsNoTracking()
.FirstOrDefault(p => p.PimsPropertyActivityId == activityId) ?? throw new KeyNotFoundException();
return activity;
}
diff --git a/source/backend/dal/Repositories/PropertyContactRepository.cs b/source/backend/dal/Repositories/PropertyContactRepository.cs
index b6aad0afc2..44d8636bcb 100644
--- a/source/backend/dal/Repositories/PropertyContactRepository.cs
+++ b/source/backend/dal/Repositories/PropertyContactRepository.cs
@@ -46,6 +46,7 @@ public IList GetContactsByProperty(long propertyId)
.Include(p => p.Organization)
.Include(p => p.PrimaryContact)
.Where(p => p.PropertyId == propertyId)
+ .AsNoTracking()
.ToList() ?? throw new KeyNotFoundException();
return contacts;
}
@@ -63,6 +64,7 @@ public PimsPropertyContact GetContact(long contactId)
.Include(p => p.Person)
.Include(p => p.Organization)
.Include(p => p.PrimaryContact)
+ .AsNoTracking()
.FirstOrDefault(p => p.PropertyContactId == contactId) ?? throw new KeyNotFoundException();
return contact;
}
diff --git a/source/backend/dal/Repositories/PropertyLeaseRepository.cs b/source/backend/dal/Repositories/PropertyLeaseRepository.cs
index 76b17d9639..ca23a19c63 100644
--- a/source/backend/dal/Repositories/PropertyLeaseRepository.cs
+++ b/source/backend/dal/Repositories/PropertyLeaseRepository.cs
@@ -58,7 +58,8 @@ public IEnumerable GetAllByPropertyId(long propertyId)
///
public IEnumerable GetAllByLeaseId(long leaseId)
{
- return this.Context.PimsPropertyLeases.AsNoTracking()
+ return Context.PimsPropertyLeases.AsNoTracking()
+ .Include(pl => pl.AreaUnitTypeCodeNavigation)
.Include(pl => pl.Property)
.ThenInclude(p => p.Address)
.ThenInclude(p => p.Country)
diff --git a/source/backend/dal/Repositories/PropertyRepository.cs b/source/backend/dal/Repositories/PropertyRepository.cs
index 04aa95e3a4..978b65b90d 100644
--- a/source/backend/dal/Repositories/PropertyRepository.cs
+++ b/source/backend/dal/Repositories/PropertyRepository.cs
@@ -6,6 +6,7 @@
using LinqKit;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
+using Pims.Api.Models.CodeTypes;
using Pims.Core.Exceptions;
using Pims.Core.Extensions;
using Pims.Core.Helpers;
@@ -54,7 +55,7 @@ public int Count()
///
///
///
- public Paged GetPage(PropertyFilter filter)
+ public Paged GetPage(PropertyFilter filter)
{
this.User.ThrowIfNotAuthorized(Permissions.PropertyView);
filter.ThrowIfNull(nameof(filter));
@@ -77,7 +78,7 @@ public Paged GetPage(PropertyFilter filter)
items = items.Where(i => i.Pid.ToString().PadLeft(9, '0').Contains(formattedPidPin) || i.Pin.ToString().Contains(formattedPidPin)).ToArray();
}
- return new Paged(items, filter.Page, filter.Quantity, query.Count());
+ return new Paged(items, filter.Page, filter.Quantity, query.Count());
}
///
@@ -194,7 +195,7 @@ public PimsProperty GetByPid(int pid, bool includeRetired = false)
var query = Context.PimsProperties.AsNoTracking();
- if(!includeRetired)
+ if (!includeRetired)
{
query = query.Where(r => !r.IsRetired.HasValue || (r.IsRetired.HasValue && !r.IsRetired.Value));
}
@@ -236,7 +237,7 @@ public PimsProperty GetByPin(int pin, bool includeRetired = false)
var query = Context.PimsProperties.AsNoTracking();
- if(!includeRetired)
+ if (!includeRetired)
{
query = query.Where(r => !r.IsRetired.HasValue || (r.IsRetired.HasValue && !r.IsRetired.Value));
}
@@ -268,7 +269,7 @@ public PimsProperty GetByPin(int pin, bool includeRetired = false)
}
///
- /// Get the property for the specified id value.
+ /// Get the property with file associations for the specified id value.
///
///
///
@@ -292,6 +293,22 @@ public PimsProperty GetAllAssociationsById(long id)
return property;
}
+ ///
+ /// Get the total count of associated files for the given property id.
+ ///
+ ///
+ ///
+ public long GetAllAssociationsCountById(long id)
+ {
+ PimsProperty propertyWithAssociations = this.GetAllAssociationsById(id);
+ var leaseAssociationCount = propertyWithAssociations.PimsPropertyLeases.Count;
+ var researchAssociationCount = propertyWithAssociations.PimsPropertyResearchFiles.Count;
+ var acquisitionAssociationCount = propertyWithAssociations.PimsPropertyAcquisitionFiles.Count;
+ var dispositionAssociationCount = propertyWithAssociations.PimsDispositionFileProperties.Count;
+
+ return leaseAssociationCount + researchAssociationCount + acquisitionAssociationCount + dispositionAssociationCount;
+ }
+
///
/// Update the passed property in the database assuming the user has the required claims.
///
@@ -326,13 +343,12 @@ public PimsProperty Update(PimsProperty property, bool overrideLocation = false)
property.SurplusDeclarationTypeCode = existingProperty.SurplusDeclarationTypeCode;
property.SurplusDeclarationComment = existingProperty.SurplusDeclarationComment;
property.SurplusDeclarationDate = existingProperty.SurplusDeclarationDate;
- property.IsOwned = existingProperty.IsOwned;
property.IsRetired = existingProperty.IsRetired;
- property.IsPropertyOfInterest = existingProperty.IsPropertyOfInterest;
property.IsVisibleToOtherAgencies = existingProperty.IsVisibleToOtherAgencies;
property.IsSensitive = existingProperty.IsSensitive;
- if (property.PphStatusTypeCode != existingProperty.PphStatusTypeCode)
+ if (property.PphStatusTypeCode != existingProperty.PphStatusTypeCode
+ && (property.PphStatusTypeCode != PropertyPPHStatusTypes.UNKNOWN.ToString() && existingProperty.PphStatusTypeCode != null))
{
property.PphStatusUpdateTimestamp = DateTime.UtcNow;
property.PphStatusUpdateUserid = User.GetUsername();
@@ -408,19 +424,16 @@ public void Delete(PimsProperty property)
///
/// The property to update.
/// The updated property.
- public PimsProperty TransferFileProperty(PimsProperty property, PropertyOwnershipState state)
+ public PimsProperty TransferFileProperty(PimsProperty property, bool isOwned)
{
property.ThrowIfNull(nameof(property));
var existingProperty = Context.PimsProperties
.FirstOrDefault(p => p.PropertyId == property.Internal_Id) ?? throw new KeyNotFoundException();
- existingProperty.IsPropertyOfInterest = state.isPropertyOfInterest;
- existingProperty.IsOwned = state.isOwned;
- existingProperty.IsDisposed = state.isDisposed;
- existingProperty.IsOtherInterest = state.isOtherInterest;
+ existingProperty.IsOwned = isOwned;
- if (state.isOwned)
+ if (isOwned)
{
existingProperty.PropertyClassificationTypeCode = "COREOPER";
}
@@ -514,7 +527,17 @@ public HashSet GetMatchingIds(PropertyFilterCriteria filter)
p.PimsPropPropAnomalyTypes.Any(at => filter.AnomalyIds.Contains(at.PropertyAnomalyTypeCode)));
}
+
+ var authorizationTypes = new List(){
+ "NOI",
+ "Section 15",
+ "Section 16",
+ "Section 17",
+ "Section 66",
+ };
+
// Property ownership filters
+ // TODO: Instead of doing redoing the query, the view could be used for ownership related queries
var ownershipBuilder = PredicateBuilder.New(p => false);
if (filter.IsCoreInventory)
{
@@ -522,25 +545,41 @@ public HashSet GetMatchingIds(PropertyFilterCriteria filter)
}
if (filter.IsPropertyOfInterest)
{
- ownershipBuilder.Or(p => p.IsPropertyOfInterest);
+ ownershipBuilder.Or(p => p.PimsPropertyAcquisitionFiles.Any(x => x.AcquisitionFile.AcquisitionFileStatusTypeCode == "DRAFT" || x.AcquisitionFile.AcquisitionFileStatusTypeCode == "ACTIVE"));
+ ownershipBuilder.Or(p => p.PimsPropertyResearchFiles.Any(x => x.ResearchFile.ResearchFileStatusTypeCode == "ACTIVE"));
}
if (filter.IsOtherInterest)
{
- ownershipBuilder.Or(p => p.IsOtherInterest);
+ var today = DateOnly.FromDateTime(DateTime.Now);
+ ownershipBuilder.Or(p => p.PimsPropertyAcquisitionFiles.Any(x => x.PimsTakes.Any(t => t.TakeStatusTypeCode == "COMPLETE" && t.IsNewLandAct && authorizationTypes.Contains(t.LandActTypeCode) && t.LandActEndDt >= today)));
+ ownershipBuilder.Or(p => p.PimsPropertyAcquisitionFiles.Any(x => x.PimsTakes.Any(t => t.TakeStatusTypeCode == "COMPLETE" && t.IsNewInterestInSrw && t.SrwEndDt >= today)));
+ ownershipBuilder.Or(p => p.PimsPropertyAcquisitionFiles.Any(x => x.PimsTakes.Any(t => t.TakeStatusTypeCode == "COMPLETE" && t.IsNewLicenseToConstruct && t.LtcEndDt >= today)));
+ ownershipBuilder.Or(p => p.PimsPropertyAcquisitionFiles.Any(x => x.PimsTakes.Any(t => t.TakeStatusTypeCode == "COMPLETE" && t.IsActiveLease && t.ActiveLeaseEndDt >= today)));
}
if (filter.IsDisposed)
{
- ownershipBuilder.Or(p => p.IsDisposed);
+ ownershipBuilder.Or(p => p.PimsDispositionFileProperties.Any(d => d.DispositionFile.DispositionFileStatusTypeCode == "COMPLETE"));
}
if (filter.IsRetired)
{
ownershipBuilder.Or(p => p.IsRetired.HasValue && p.IsRetired.Value);
}
-
+ if (filter.IsDisposed || filter.IsRetired || filter.IsCoreInventory || filter.IsPropertyOfInterest || filter.IsOtherInterest)
+ {
+ predicate.And(ownershipBuilder); // Only apply ownership filter if at least one type is specified.
+ }
predicate.And(ownershipBuilder);
return Context.PimsProperties.AsNoTracking()
.Where(predicate)
+ .Include(p => p.PimsPropertyResearchFiles)
+ .ThenInclude(pr => pr.ResearchFile)
+ .Include(p => p.PimsPropertyAcquisitionFiles)
+ .ThenInclude(pa => pa.AcquisitionFile)
+ .Include(p => p.PimsPropertyAcquisitionFiles)
+ .ThenInclude(pa => pa.PimsTakes)
+ .Include(p => p.PimsDispositionFileProperties)
+ .ThenInclude(pd => pd.DispositionFile)
.Select(x => x.PropertyId)
.ToHashSet();
}
diff --git a/source/backend/dal/Repositories/TakeRepository.cs b/source/backend/dal/Repositories/TakeRepository.cs
index 59e55a7a23..a9043a53a7 100644
--- a/source/backend/dal/Repositories/TakeRepository.cs
+++ b/source/backend/dal/Repositories/TakeRepository.cs
@@ -24,6 +24,24 @@ public TakeRepository(PimsContext dbContext, ClaimsPrincipal user, ILogger
+ /// Get take by id.
+ ///
+ ///
+ ///
+ public PimsTake GetById(long takeId)
+ {
+ return Context.PimsTakes
+
+ .Include(t => t.PropertyAcquisitionFile)
+ .Include(t => t.TakeSiteContamTypeCodeNavigation)
+ .Include(t => t.TakeStatusTypeCodeNavigation)
+ .Include(t => t.TakeTypeCodeNavigation)
+ .Include(t => t.LandActTypeCodeNavigation)
+ .AsNoTracking()
+ .FirstOrDefault(t => t.TakeId == takeId) ?? throw new KeyNotFoundException($"Unable to find take with id {takeId}");
+ }
+
///
/// Get all of the takes that are associated to a given acquisition file by its id.
///
@@ -32,21 +50,23 @@ public TakeRepository(PimsContext dbContext, ClaimsPrincipal user, ILogger GetAllByAcquisitionFileId(long fileId)
{
return Context.PimsTakes
+
.Include(t => t.PropertyAcquisitionFile)
.Include(t => t.TakeSiteContamTypeCodeNavigation)
.Include(t => t.TakeStatusTypeCodeNavigation)
.Include(t => t.TakeTypeCodeNavigation)
.Include(t => t.LandActTypeCodeNavigation)
- .Where(t => t.PropertyAcquisitionFile.AcquisitionFileId == fileId);
+ .Where(t => t.PropertyAcquisitionFile.AcquisitionFileId == fileId)
+ .AsNoTracking();
}
///
/// Get all Takes for a Property in the Acquisition File.
///
///
- ///
+ ///
///
- public IEnumerable GetAllByPropertyId(long fileId, long acquisitionFilePropertyId)
+ public IEnumerable GetAllByAcqPropertyId(long fileId, long propertyId)
{
return Context.PimsTakes
.Include(t => t.PropertyAcquisitionFile)
@@ -55,7 +75,19 @@ public IEnumerable GetAllByPropertyId(long fileId, long acquisitionFil
.Include(t => t.TakeTypeCodeNavigation)
.Include(t => t.LandActTypeCodeNavigation)
.Where(t => t.PropertyAcquisitionFile.AcquisitionFileId == fileId
- && t.PropertyAcquisitionFile.PropertyId == acquisitionFilePropertyId)
+ && t.PropertyAcquisitionFile.PropertyId == propertyId)
+ .AsNoTracking();
+ }
+
+ ///
+ /// Get all Takes for a Property.
+ ///
+ ///
+ ///
+ public IEnumerable GetAllByPropertyId(long propertyId)
+ {
+ return Context.PimsTakes
+ .Where(t => t.PropertyAcquisitionFile.PropertyId == propertyId)
.AsNoTracking();
}
@@ -73,14 +105,44 @@ public int GetCountByPropertyId(long propertyId)
.Count();
}
+ public PimsTake AddTake(PimsTake take)
+ {
+ using var scope = Logger.QueryScope();
+
+ Context.PimsTakes.Add(take);
+
+ return take;
+ }
+
///
- /// Sets the passed list of takes as the takes associated to the given acquisition property, adding, deleting and updating as necessary.
+ /// Update the passed take.
///
- ///
- ///
- public void UpdateAcquisitionPropertyTakes(long acquisitionFilePropertyId, IEnumerable takes)
+ ///
+ public PimsTake UpdateTake(PimsTake take)
+ {
+ using var scope = Logger.QueryScope();
+
+ var existingTake = Context.PimsTakes.FirstOrDefault(x => x.TakeId == take.TakeId) ?? throw new KeyNotFoundException();
+
+ take.PropertyAcquisitionFileId = existingTake.PropertyAcquisitionFileId; // A take cannot be migrated between properties.
+ Context.Entry(existingTake).CurrentValues.SetValues(take);
+
+ return existingTake;
+ }
+
+ public bool TryDeleteTake(long takeId)
{
- Context.UpdateChild(p => p.PimsTakes, acquisitionFilePropertyId, takes.ToArray(), true);
+ using var scope = Logger.QueryScope();
+
+ var deletedEntity = Context.PimsTakes.Where(x => x.TakeId == takeId).FirstOrDefault();
+ if (deletedEntity is not null)
+ {
+ Context.PimsTakes.Remove(deletedEntity);
+
+ return true;
+ }
+
+ return false;
}
public IEnumerable GetAllByPropertyAcquisitionFileId(long acquisitionFilePropertyId)
diff --git a/source/backend/entities/Extensions/ExpiringTypeEntity.cs b/source/backend/entities/Extensions/ExpiringTypeEntity.cs
index 12109900ca..38ff5e763f 100644
--- a/source/backend/entities/Extensions/ExpiringTypeEntity.cs
+++ b/source/backend/entities/Extensions/ExpiringTypeEntity.cs
@@ -24,7 +24,7 @@ public static bool IsExpiredType(this IExpiringTypeEntity t
/// True if the type is expired; false otherwise.
public static bool IsExpiredType(this IExpiringTypeEntity type, DateTime? currentDate = null)
{
- DateOnly now = DateOnly.FromDateTime(currentDate.HasValue ? (DateTime)currentDate?.Date : DateTime.UtcNow.Date);
+ DateOnly now = DateOnly.FromDateTime(currentDate.HasValue ? (DateTime)currentDate?.Date : DateTime.Now.Date);
return (type.EffectiveDate > now) || (type.ExpiryDate.HasValue && type.ExpiryDate <= now);
}
}
diff --git a/source/backend/entities/PimsBaseContext.cs b/source/backend/entities/PimsBaseContext.cs
index be096fe674..c20032f6c9 100644
--- a/source/backend/entities/PimsBaseContext.cs
+++ b/source/backend/entities/PimsBaseContext.cs
@@ -222,6 +222,12 @@ public PimsBaseContext(DbContextOptions options)
public virtual DbSet PimsFenceTypes { get; set; }
+ public virtual DbSet PimsFileNumbers { get; set; }
+
+ public virtual DbSet PimsFileNumberHists { get; set; }
+
+ public virtual DbSet PimsFileNumberTypes { get; set; }
+
public virtual DbSet PimsFinancialActivityCodes { get; set; }
public virtual DbSet PimsFinancialActivityCodeHists { get; set; }
@@ -472,6 +478,8 @@ public PimsBaseContext(DbContextOptions options)
public virtual DbSet PimsPropertyTypes { get; set; }
+ public virtual DbSet PimsPropertyVws { get; set; }
+
public virtual DbSet PimsProvinceStates { get; set; }
public virtual DbSet PimsRegions { get; set; }
@@ -878,7 +886,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.AssignedDate)
.HasDefaultValueSql("(getutcdate())")
.HasComment("Date of file assignment.");
- entity.Property(e => e.CompletionDate).HasComment("Date of acquisition file completion.");
entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValue(1L);
entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())");
entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())");
@@ -3505,6 +3512,113 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.IsDisabled).HasComment("Indicates if the code value is inactive.");
});
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.FileNumberId).HasName("FILNUM_PK");
+
+ entity.ToTable("PIMS_FILE_NUMBER", tb =>
+ {
+ tb.HasComment("Table containing the file numbers associated with a property.");
+ tb.HasTrigger("PIMS_FILNUM_A_S_IUD_TR");
+ tb.HasTrigger("PIMS_FILNUM_I_S_I_TR");
+ tb.HasTrigger("PIMS_FILNUM_I_S_U_TR");
+ });
+
+ entity.Property(e => e.FileNumberId)
+ .HasDefaultValueSql("(NEXT VALUE FOR [PIMS_FILE_NUMBER_ID_SEQ])")
+ .HasComment("Generated surrogate primary key");
+ entity.Property(e => e.AppCreateTimestamp)
+ .HasDefaultValueSql("(getutcdate())")
+ .HasComment("The date and time the user created the record.");
+ entity.Property(e => e.AppCreateUserDirectory)
+ .HasDefaultValueSql("(user_name())")
+ .HasComment("The directory of the user account that created the record.");
+ entity.Property(e => e.AppCreateUserGuid).HasComment("The GUID of the user account that created the record.");
+ entity.Property(e => e.AppCreateUserid)
+ .HasDefaultValueSql("(user_name())")
+ .HasComment("The user account that created the record.");
+ entity.Property(e => e.AppLastUpdateTimestamp)
+ .HasDefaultValueSql("(getutcdate())")
+ .HasComment("The date and time the user updated the record.");
+ entity.Property(e => e.AppLastUpdateUserDirectory)
+ .HasDefaultValueSql("(user_name())")
+ .HasComment("The directory of the user account that updated the record.");
+ entity.Property(e => e.AppLastUpdateUserGuid).HasComment("The GUID of the user account that updated the record.");
+ entity.Property(e => e.AppLastUpdateUserid)
+ .HasDefaultValueSql("(user_name())")
+ .HasComment("The user account that updated the record.");
+ entity.Property(e => e.ConcurrencyControlNumber)
+ .HasDefaultValue(1L)
+ .HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o");
+ entity.Property(e => e.DbCreateTimestamp)
+ .HasDefaultValueSql("(getutcdate())")
+ .HasComment("The date and time the record was created.");
+ entity.Property(e => e.DbCreateUserid)
+ .HasDefaultValueSql("(user_name())")
+ .HasComment("The user or proxy account that created the record.");
+ entity.Property(e => e.DbLastUpdateTimestamp)
+ .HasDefaultValueSql("(getutcdate())")
+ .HasComment("The date and time the record was created or last updated.");
+ entity.Property(e => e.DbLastUpdateUserid)
+ .HasDefaultValueSql("(user_name())")
+ .HasComment("The user or proxy account that created or last updated the record.");
+ entity.Property(e => e.FileNumber).HasComment("The file number value.");
+ entity.Property(e => e.FileNumberTypeCode).HasComment("Foreign key describing the file number type.");
+ entity.Property(e => e.IsDisabled)
+ .HasDefaultValue(false)
+ .HasComment("Indicates if the record is disabled.");
+ entity.Property(e => e.OtherFileNumberType).HasComment("Description of file number type that's not currently listed.");
+ entity.Property(e => e.PropertyId).HasComment("Foreign key to the PIMS_PROPERTY table.");
+
+ entity.HasOne(d => d.FileNumberTypeCodeNavigation).WithMany(p => p.PimsFileNumbers)
+ .OnDelete(DeleteBehavior.ClientSetNull)
+ .HasConstraintName("PIM_FLNMTY_PIM_FILNUM_FK");
+
+ entity.HasOne(d => d.Property).WithMany(p => p.PimsFileNumbers)
+ .OnDelete(DeleteBehavior.ClientSetNull)
+ .HasConstraintName("PIM_PRPRTY_PIM_FILNUM_FK");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.FileNumberHistId).HasName("PIMS_FILNUM_H_PK");
+
+ entity.Property(e => e.FileNumberHistId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_FILE_NUMBER_H_ID_SEQ])");
+ entity.Property(e => e.EffectiveDateHist).HasDefaultValueSql("(getutcdate())");
+ });
+
+ modelBuilder.Entity(entity =>
+ {
+ entity.HasKey(e => e.FileNumberTypeCode).HasName("FLNMTY_PK");
+
+ entity.ToTable("PIMS_FILE_NUMBER_TYPE", tb =>
+ {
+ tb.HasComment("Code table to describe the type of property file number.");
+ tb.HasTrigger("PIMS_FLNMTY_I_S_I_TR");
+ tb.HasTrigger("PIMS_FLNMTY_I_S_U_TR");
+ });
+
+ entity.Property(e => e.FileNumberTypeCode).HasComment("Code representing the type of file number.");
+ entity.Property(e => e.ConcurrencyControlNumber)
+ .HasDefaultValue(1L)
+ .HasComment("Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o");
+ entity.Property(e => e.DbCreateTimestamp)
+ .HasDefaultValueSql("(getutcdate())")
+ .HasComment("The date and time the record was created.");
+ entity.Property(e => e.DbCreateUserid)
+ .HasDefaultValueSql("(user_name())")
+ .HasComment("The user or proxy account that created the record.");
+ entity.Property(e => e.DbLastUpdateTimestamp)
+ .HasDefaultValueSql("(getutcdate())")
+ .HasComment("The date and time the record was created or last updated.");
+ entity.Property(e => e.DbLastUpdateUserid)
+ .HasDefaultValueSql("(user_name())")
+ .HasComment("The user or proxy account that created or last updated the record.");
+ entity.Property(e => e.Description).HasComment("Description of the type of file number.");
+ entity.Property(e => e.DisplayOrder).HasComment("Force the display order of the codes.");
+ entity.Property(e => e.IsDisabled).HasComment("Indicates if the code is disabled.");
+ });
+
modelBuilder.Entity(entity =>
{
entity.HasKey(e => e.Id).HasName("FINACT_PK");
@@ -5591,8 +5705,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
tb.HasTrigger("PIMS_PRPRTY_I_S_U_TR");
});
- entity.Property(e => e.PropertyId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_PROPERTY_ID_SEQ])");
+ entity.Property(e => e.PropertyId)
+ .HasDefaultValueSql("(NEXT VALUE FOR [PIMS_PROPERTY_ID_SEQ])")
+ .HasComment("Generated surrogate primary key");
entity.Property(e => e.AdditionalDetails).HasComment("Additional details about the property.");
+ entity.Property(e => e.AddressId).HasComment("Foreign key to the address table.");
entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())");
entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())");
entity.Property(e => e.BandName).HasComment("Name of the Indian band.");
@@ -5603,16 +5720,14 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.DbLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())");
entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())");
entity.Property(e => e.Description).HasComment("Property description");
+ entity.Property(e => e.DistrictCode).HasComment("Foreign key to the district table.");
entity.Property(e => e.EncumbranceReason).HasComment("reason for property encumbreance");
entity.Property(e => e.FileNumber).HasComment("The (ARCS/ORCS) number identifying the Property File.");
entity.Property(e => e.FileNumberSuffix).HasComment("A suffix to distinguish between Property Files with the same number.");
entity.Property(e => e.GeneralLocation).HasComment("Descriptive location of the property, primarily for H120 activities.");
- entity.Property(e => e.IsDisposed).HasComment("Has the property currently in disposition status? This infers that the property was once owned by the Ministry but has since ceased to retain ownership of the property.");
- entity.Property(e => e.IsOtherInterest).HasComment("Is this a property of other interest to the Ministry?");
entity.Property(e => e.IsOwned)
.HasDefaultValue(true)
.HasComment("Is the property currently owned?");
- entity.Property(e => e.IsPropertyOfInterest).HasComment("Is this a property of interest to the Ministry?");
entity.Property(e => e.IsProvincialPublicHwy).HasComment("Is this property a provincial public highway?");
entity.Property(e => e.IsRetired).HasComment("If the property was the source of a subdivision operation or the target of a consolidation operation, the property is marked as retired.");
entity.Property(e => e.IsRwyBeltDomPatent)
@@ -5633,16 +5748,27 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.Notes).HasComment("Notes about the property");
entity.Property(e => e.Pid).HasComment("Property ID");
entity.Property(e => e.Pin).HasComment("Property number");
+ entity.Property(e => e.PphStatusTypeCode).HasComment("Foreign key to the provincial public highway status type table.");
entity.Property(e => e.PphStatusUpdateTimestamp).HasComment("Date / time that the Provincial Public Highway status was updated.");
entity.Property(e => e.PphStatusUpdateUserGuid).HasComment("GUID of the user that updated the PPH status.");
entity.Property(e => e.PphStatusUpdateUserid).HasComment("Userid that updated the Provincial Public Highway status.");
- entity.Property(e => e.PropertyClassificationTypeCode).HasDefaultValue("UNKNOWN");
+ entity.Property(e => e.PropertyAreaUnitTypeCode).HasComment("Foreign key to the property area unit type table.");
+ entity.Property(e => e.PropertyClassificationTypeCode)
+ .HasDefaultValue("UNKNOWN")
+ .HasComment("Foreign key to the proeprty classification type table.");
entity.Property(e => e.PropertyDataSourceEffectiveDate).HasComment("Date the property was officially registered");
+ entity.Property(e => e.PropertyDataSourceTypeCode).HasComment("Foreign key to the property data source type table.");
+ entity.Property(e => e.PropertyStatusTypeCode).HasComment("Foreign key to the property status type table.");
+ entity.Property(e => e.PropertyTypeCode).HasComment("Foreign key to the proprty type table.");
+ entity.Property(e => e.RegionCode).HasComment("Foreign key to the region table.");
entity.Property(e => e.ReserveName).HasComment("Name of the Indian reserve.");
entity.Property(e => e.SurplusDeclarationComment).HasComment("Comment regarding the surplus declaration");
entity.Property(e => e.SurplusDeclarationDate).HasComment("Date the property was declared surplus");
+ entity.Property(e => e.SurplusDeclarationTypeCode).HasComment("Foreign key to the surplus declaration type table.");
entity.Property(e => e.SurveyPlanNumber).HasComment("Property/Land Parcel survey plan number");
+ entity.Property(e => e.VolumeUnitTypeCode).HasComment("Foreign key to the volume unit type table.");
entity.Property(e => e.VolumetricMeasurement).HasComment("Volumetric measurement of the parcel.");
+ entity.Property(e => e.VolumetricTypeCode).HasComment("Foreign key to the volumetric type table.");
entity.Property(e => e.Zoning).HasComment("Current property zoning");
entity.Property(e => e.ZoningPotential).HasComment("Potential property zoning");
@@ -6396,6 +6522,11 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())");
});
+ modelBuilder.Entity(entity =>
+ {
+ entity.ToView("PIMS_PROPERTY_VW");
+ });
+
modelBuilder.Entity(entity =>
{
entity.HasKey(e => e.ProvinceStateId).HasName("PROVNC_PK");
@@ -7170,12 +7301,15 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
});
entity.Property(e => e.TakeId).HasDefaultValueSql("(NEXT VALUE FOR [PIMS_TAKE_ID_SEQ])");
+ entity.Property(e => e.ActiveLeaseArea).HasComment("Area of the active lease.");
+ entity.Property(e => e.ActiveLeaseEndDt).HasComment("End date of the active lease.");
entity.Property(e => e.AppCreateTimestamp).HasDefaultValueSql("(getutcdate())");
entity.Property(e => e.AppCreateUserDirectory).HasDefaultValueSql("(user_name())");
entity.Property(e => e.AppCreateUserid).HasDefaultValueSql("(user_name())");
entity.Property(e => e.AppLastUpdateTimestamp).HasDefaultValueSql("(getutcdate())");
entity.Property(e => e.AppLastUpdateUserDirectory).HasDefaultValueSql("(user_name())");
entity.Property(e => e.AppLastUpdateUserid).HasDefaultValueSql("(user_name())");
+ entity.Property(e => e.CompletionDt).HasComment("Date the take was completed.");
entity.Property(e => e.ConcurrencyControlNumber).HasDefaultValue(1L);
entity.Property(e => e.DbCreateTimestamp).HasDefaultValueSql("(getutcdate())");
entity.Property(e => e.DbCreateUserid).HasDefaultValueSql("(user_name())");
@@ -7183,6 +7317,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
entity.Property(e => e.DbLastUpdateUserid).HasDefaultValueSql("(user_name())");
entity.Property(e => e.Description).HasComment("Description of the property take.");
entity.Property(e => e.IsAcquiredForInventory).HasComment("Is this being acquired for inventory? (default = TRUE)");
+ entity.Property(e => e.IsActiveLease).HasComment("Is there an active lease associated with the take?");
entity.Property(e => e.IsNewHighwayDedication).HasComment("Is there a new right of way? (default = FALSE)");
entity.Property(e => e.IsNewInterestInSrw).HasComment("Is there a statutory right of way? (default = FALSE)");
entity.Property(e => e.IsNewLandAct).HasComment("Is there a Section 16? (default = FALSE)");
@@ -7915,6 +8050,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.HasSequence("PIMS_FILE_ENTITY_PERMISSIONS_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
+ modelBuilder.HasSequence("PIMS_FILE_NUMBER_H_ID_SEQ")
+ .HasMin(1L)
+ .HasMax(2147483647L);
+ modelBuilder.HasSequence("PIMS_FILE_NUMBER_ID_SEQ")
+ .HasMin(1L)
+ .HasMax(2147483647L);
modelBuilder.HasSequence("PIMS_FINANCIAL_ACTIVITY_CODE_H_ID_SEQ")
.HasMin(1L)
.HasMax(2147483647L);
diff --git a/source/backend/entities/ef/PimsAcquisitionFile.cs b/source/backend/entities/ef/PimsAcquisitionFile.cs
index d05630de96..0289e01fb8 100644
--- a/source/backend/entities/ef/PimsAcquisitionFile.cs
+++ b/source/backend/entities/ef/PimsAcquisitionFile.cs
@@ -110,12 +110,6 @@ public partial class PimsAcquisitionFile
[Column("DELIVERY_DATE", TypeName = "datetime")]
public DateTime? DeliveryDate { get; set; }
- ///
- /// Date of acquisition file completion.
- ///
- [Column("COMPLETION_DATE", TypeName = "datetime")]
- public DateTime? CompletionDate { get; set; }
-
///
/// Legacy Acquisition File ID from the PAIMS system.
///
diff --git a/source/backend/entities/ef/PimsAcquisitionFileHist.cs b/source/backend/entities/ef/PimsAcquisitionFileHist.cs
index de58763626..13e4ee3ea3 100644
--- a/source/backend/entities/ef/PimsAcquisitionFileHist.cs
+++ b/source/backend/entities/ef/PimsAcquisitionFileHist.cs
@@ -81,9 +81,6 @@ public partial class PimsAcquisitionFileHist
[Column("DELIVERY_DATE", TypeName = "datetime")]
public DateTime? DeliveryDate { get; set; }
- [Column("COMPLETION_DATE", TypeName = "datetime")]
- public DateTime? CompletionDate { get; set; }
-
[Column("PAIMS_ACQUISITION_FILE_ID")]
public int? PaimsAcquisitionFileId { get; set; }
@@ -140,4 +137,7 @@ public partial class PimsAcquisitionFileHist
[Column("DB_LAST_UPDATE_USERID")]
[StringLength(30)]
public string DbLastUpdateUserid { get; set; }
+
+ [Column("COMPLETION_DATE", TypeName = "datetime")]
+ public DateTime? CompletionDate { get; set; }
}
diff --git a/source/backend/entities/ef/PimsFileNumber.cs b/source/backend/entities/ef/PimsFileNumber.cs
new file mode 100644
index 0000000000..12e54b06d6
--- /dev/null
+++ b/source/backend/entities/ef/PimsFileNumber.cs
@@ -0,0 +1,156 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Pims.Dal.Entities;
+
+///
+/// Table containing the file numbers associated with a property.
+///
+[Table("PIMS_FILE_NUMBER")]
+[Index("FileNumber", Name = "FILNUM_FILE_NUMBER_IDX")]
+[Index("PropertyId", Name = "FILNUM_PROPERTY_ID_IDX")]
+public partial class PimsFileNumber
+{
+ ///
+ /// Generated surrogate primary key
+ ///
+ [Key]
+ [Column("FILE_NUMBER_ID")]
+ public long FileNumberId { get; set; }
+
+ ///
+ /// Foreign key to the PIMS_PROPERTY table.
+ ///
+ [Column("PROPERTY_ID")]
+ public long PropertyId { get; set; }
+
+ ///
+ /// Foreign key describing the file number type.
+ ///
+ [Required]
+ [Column("FILE_NUMBER_TYPE_CODE")]
+ [StringLength(20)]
+ public string FileNumberTypeCode { get; set; }
+
+ ///
+ /// The file number value.
+ ///
+ [Required]
+ [Column("FILE_NUMBER")]
+ [StringLength(500)]
+ public string FileNumber { get; set; }
+
+ ///
+ /// Description of file number type that's not currently listed.
+ ///
+ [Column("OTHER_FILE_NUMBER_TYPE")]
+ [StringLength(200)]
+ public string OtherFileNumberType { get; set; }
+
+ ///
+ /// Indicates if the record is disabled.
+ ///
+ [Column("IS_DISABLED")]
+ public bool? IsDisabled { get; set; }
+
+ ///
+ /// Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o
+ ///
+ [Column("CONCURRENCY_CONTROL_NUMBER")]
+ public long ConcurrencyControlNumber { get; set; }
+
+ ///
+ /// The date and time the user created the record.
+ ///
+ [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime AppCreateTimestamp { get; set; }
+
+ ///
+ /// The user account that created the record.
+ ///
+ [Required]
+ [Column("APP_CREATE_USERID")]
+ [StringLength(30)]
+ public string AppCreateUserid { get; set; }
+
+ ///
+ /// The GUID of the user account that created the record.
+ ///
+ [Column("APP_CREATE_USER_GUID")]
+ public Guid? AppCreateUserGuid { get; set; }
+
+ ///
+ /// The directory of the user account that created the record.
+ ///
+ [Required]
+ [Column("APP_CREATE_USER_DIRECTORY")]
+ [StringLength(30)]
+ public string AppCreateUserDirectory { get; set; }
+
+ ///
+ /// The date and time the user updated the record.
+ ///
+ [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime AppLastUpdateTimestamp { get; set; }
+
+ ///
+ /// The user account that updated the record.
+ ///
+ [Required]
+ [Column("APP_LAST_UPDATE_USERID")]
+ [StringLength(30)]
+ public string AppLastUpdateUserid { get; set; }
+
+ ///
+ /// The GUID of the user account that updated the record.
+ ///
+ [Column("APP_LAST_UPDATE_USER_GUID")]
+ public Guid? AppLastUpdateUserGuid { get; set; }
+
+ ///
+ /// The directory of the user account that updated the record.
+ ///
+ [Required]
+ [Column("APP_LAST_UPDATE_USER_DIRECTORY")]
+ [StringLength(30)]
+ public string AppLastUpdateUserDirectory { get; set; }
+
+ ///
+ /// The date and time the record was created.
+ ///
+ [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime DbCreateTimestamp { get; set; }
+
+ ///
+ /// The user or proxy account that created the record.
+ ///
+ [Required]
+ [Column("DB_CREATE_USERID")]
+ [StringLength(30)]
+ public string DbCreateUserid { get; set; }
+
+ ///
+ /// The date and time the record was created or last updated.
+ ///
+ [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime DbLastUpdateTimestamp { get; set; }
+
+ ///
+ /// The user or proxy account that created or last updated the record.
+ ///
+ [Required]
+ [Column("DB_LAST_UPDATE_USERID")]
+ [StringLength(30)]
+ public string DbLastUpdateUserid { get; set; }
+
+ [ForeignKey("FileNumberTypeCode")]
+ [InverseProperty("PimsFileNumbers")]
+ public virtual PimsFileNumberType FileNumberTypeCodeNavigation { get; set; }
+
+ [ForeignKey("PropertyId")]
+ [InverseProperty("PimsFileNumbers")]
+ public virtual PimsProperty Property { get; set; }
+}
diff --git a/source/backend/entities/ef/PimsFileNumberHist.cs b/source/backend/entities/ef/PimsFileNumberHist.cs
new file mode 100644
index 0000000000..6a8dd58991
--- /dev/null
+++ b/source/backend/entities/ef/PimsFileNumberHist.cs
@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Pims.Dal.Entities;
+
+[Table("PIMS_FILE_NUMBER_HIST")]
+[Index("FileNumberHistId", "EndDateHist", Name = "PIMS_FILNUM_H_UK", IsUnique = true)]
+public partial class PimsFileNumberHist
+{
+ [Key]
+ [Column("_FILE_NUMBER_HIST_ID")]
+ public long FileNumberHistId { get; set; }
+
+ [Column("EFFECTIVE_DATE_HIST", TypeName = "datetime")]
+ public DateTime EffectiveDateHist { get; set; }
+
+ [Column("END_DATE_HIST", TypeName = "datetime")]
+ public DateTime? EndDateHist { get; set; }
+
+ [Column("FILE_NUMBER_ID")]
+ public long FileNumberId { get; set; }
+
+ [Column("PROPERTY_ID")]
+ public long PropertyId { get; set; }
+
+ [Required]
+ [Column("FILE_NUMBER_TYPE_CODE")]
+ [StringLength(20)]
+ public string FileNumberTypeCode { get; set; }
+
+ [Required]
+ [Column("FILE_NUMBER")]
+ [StringLength(500)]
+ public string FileNumber { get; set; }
+
+ [Column("OTHER_FILE_NUMBER_TYPE")]
+ [StringLength(200)]
+ public string OtherFileNumberType { get; set; }
+
+ [Column("IS_DISABLED")]
+ public bool? IsDisabled { get; set; }
+
+ [Column("CONCURRENCY_CONTROL_NUMBER")]
+ public long ConcurrencyControlNumber { get; set; }
+
+ [Column("APP_CREATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime AppCreateTimestamp { get; set; }
+
+ [Required]
+ [Column("APP_CREATE_USERID")]
+ [StringLength(30)]
+ public string AppCreateUserid { get; set; }
+
+ [Column("APP_CREATE_USER_GUID")]
+ public Guid? AppCreateUserGuid { get; set; }
+
+ [Required]
+ [Column("APP_CREATE_USER_DIRECTORY")]
+ [StringLength(30)]
+ public string AppCreateUserDirectory { get; set; }
+
+ [Column("APP_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime AppLastUpdateTimestamp { get; set; }
+
+ [Required]
+ [Column("APP_LAST_UPDATE_USERID")]
+ [StringLength(30)]
+ public string AppLastUpdateUserid { get; set; }
+
+ [Column("APP_LAST_UPDATE_USER_GUID")]
+ public Guid? AppLastUpdateUserGuid { get; set; }
+
+ [Required]
+ [Column("APP_LAST_UPDATE_USER_DIRECTORY")]
+ [StringLength(30)]
+ public string AppLastUpdateUserDirectory { get; set; }
+
+ [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime DbCreateTimestamp { get; set; }
+
+ [Required]
+ [Column("DB_CREATE_USERID")]
+ [StringLength(30)]
+ public string DbCreateUserid { get; set; }
+
+ [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime DbLastUpdateTimestamp { get; set; }
+
+ [Required]
+ [Column("DB_LAST_UPDATE_USERID")]
+ [StringLength(30)]
+ public string DbLastUpdateUserid { get; set; }
+}
diff --git a/source/backend/entities/ef/PimsFileNumberType.cs b/source/backend/entities/ef/PimsFileNumberType.cs
new file mode 100644
index 0000000000..38bba76f6b
--- /dev/null
+++ b/source/backend/entities/ef/PimsFileNumberType.cs
@@ -0,0 +1,79 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+
+namespace Pims.Dal.Entities;
+
+///
+/// Code table to describe the type of property file number.
+///
+[Table("PIMS_FILE_NUMBER_TYPE")]
+public partial class PimsFileNumberType
+{
+ ///
+ /// Code representing the type of file number.
+ ///
+ [Key]
+ [Column("FILE_NUMBER_TYPE_CODE")]
+ [StringLength(20)]
+ public string FileNumberTypeCode { get; set; }
+
+ ///
+ /// Description of the type of file number.
+ ///
+ [Required]
+ [Column("DESCRIPTION")]
+ [StringLength(200)]
+ public string Description { get; set; }
+
+ ///
+ /// Indicates if the code is disabled.
+ ///
+ [Column("IS_DISABLED")]
+ public bool IsDisabled { get; set; }
+
+ ///
+ /// Force the display order of the codes.
+ ///
+ [Column("DISPLAY_ORDER")]
+ public int? DisplayOrder { get; set; }
+
+ ///
+ /// Application code is responsible for retrieving the row and then incrementing the value of the CONCURRENCY_CONTROL_NUMBER column by one prior to issuing an update. If this is done then the update will succeed, provided that the row was not updated by any o
+ ///
+ [Column("CONCURRENCY_CONTROL_NUMBER")]
+ public long ConcurrencyControlNumber { get; set; }
+
+ ///
+ /// The date and time the record was created.
+ ///
+ [Column("DB_CREATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime DbCreateTimestamp { get; set; }
+
+ ///
+ /// The user or proxy account that created the record.
+ ///
+ [Required]
+ [Column("DB_CREATE_USERID")]
+ [StringLength(30)]
+ public string DbCreateUserid { get; set; }
+
+ ///
+ /// The date and time the record was created or last updated.
+ ///
+ [Column("DB_LAST_UPDATE_TIMESTAMP", TypeName = "datetime")]
+ public DateTime DbLastUpdateTimestamp { get; set; }
+
+ ///
+ /// The user or proxy account that created or last updated the record.
+ ///
+ [Required]
+ [Column("DB_LAST_UPDATE_USERID")]
+ [StringLength(30)]
+ public string DbLastUpdateUserid { get; set; }
+
+ [InverseProperty("FileNumberTypeCodeNavigation")]
+ public virtual ICollection PimsFileNumbers { get; set; } = new List();
+}
diff --git a/source/backend/entities/ef/PimsProperty.cs b/source/backend/entities/ef/PimsProperty.cs
index bdca83690a..07621f0630 100644
--- a/source/backend/entities/ef/PimsProperty.cs
+++ b/source/backend/entities/ef/PimsProperty.cs
@@ -29,55 +29,94 @@ namespace Pims.Dal.Entities;
[Index("VolumeUnitTypeCode", Name = "PRPRTY_VOLUME_UNIT_TYPE_CODE_IDX")]
public partial class PimsProperty
{
+ ///
+ /// Generated surrogate primary key
+ ///
[Key]
[Column("PROPERTY_ID")]
public long PropertyId { get; set; }
+ ///
+ /// Foreign key to the proprty type table.
+ ///
[Required]
[Column("PROPERTY_TYPE_CODE")]
[StringLength(20)]
public string PropertyTypeCode { get; set; }
+ ///
+ /// Foreign key to the address table.
+ ///
[Column("ADDRESS_ID")]
public long? AddressId { get; set; }
+ ///
+ /// Foreign key to the region table.
+ ///
[Column("REGION_CODE")]
public short RegionCode { get; set; }
+ ///
+ /// Foreign key to the district table.
+ ///
[Column("DISTRICT_CODE")]
public short DistrictCode { get; set; }
+ ///
+ /// Foreign key to the property area unit type table.
+ ///
[Column("PROPERTY_AREA_UNIT_TYPE_CODE")]
[StringLength(20)]
public string PropertyAreaUnitTypeCode { get; set; }
+ ///
+ /// Foreign key to the property data source type table.
+ ///
[Required]
[Column("PROPERTY_DATA_SOURCE_TYPE_CODE")]
[StringLength(20)]
public string PropertyDataSourceTypeCode { get; set; }
+ ///
+ /// Foreign key to the property status type table.
+ ///
[Required]
[Column("PROPERTY_STATUS_TYPE_CODE")]
[StringLength(20)]
public string PropertyStatusTypeCode { get; set; }
+ ///
+ /// Foreign key to the surplus declaration type table.
+ ///
[Required]
[Column("SURPLUS_DECLARATION_TYPE_CODE")]
[StringLength(20)]
public string SurplusDeclarationTypeCode { get; set; }
+ ///
+ /// Foreign key to the volumetric type table.
+ ///
[Column("VOLUMETRIC_TYPE_CODE")]
[StringLength(20)]
public string VolumetricTypeCode { get; set; }
+ ///
+ /// Foreign key to the volume unit type table.
+ ///
[Column("VOLUME_UNIT_TYPE_CODE")]
[StringLength(20)]
public string VolumeUnitTypeCode { get; set; }
+ ///
+ /// Foreign key to the provincial public highway status type table.
+ ///
[Column("PPH_STATUS_TYPE_CODE")]
[StringLength(20)]
public string PphStatusTypeCode { get; set; }
+ ///
+ /// Foreign key to the proeprty classification type table.
+ ///
[Required]
[Column("PROPERTY_CLASSIFICATION_TYPE_CODE")]
[StringLength(20)]
@@ -217,24 +256,6 @@ public partial class PimsProperty
[Column("IS_OWNED")]
public bool IsOwned { get; set; }
- ///
- /// Has the property currently in disposition status? This infers that the property was once owned by the Ministry but has since ceased to retain ownership of the property.
- ///
- [Column("IS_DISPOSED")]
- public bool IsDisposed { get; set; }
-
- ///
- /// Is this a property of interest to the Ministry?
- ///
- [Column("IS_PROPERTY_OF_INTEREST")]
- public bool IsPropertyOfInterest { get; set; }
-
- ///
- /// Is this a property of other interest to the Ministry?
- ///
- [Column("IS_OTHER_INTEREST")]
- public bool IsOtherInterest { get; set; }
-
///
/// Is the property visible to other agencies?
///
@@ -393,6 +414,9 @@ public partial class PimsProperty
[InverseProperty("Property")]
public virtual ICollection PimsDispositionFileProperties { get; set; } = new List();
+ [InverseProperty("Property")]
+ public virtual ICollection PimsFileNumbers { get; set; } = new List();
+
[InverseProperty("Property")]
public virtual ICollection PimsPropPropActivities { get; set; } = new List();
diff --git a/source/backend/entities/ef/PimsPropertyBoundaryVw.cs b/source/backend/entities/ef/PimsPropertyBoundaryVw.cs
index 656e61ca6d..884d8d60ea 100644
--- a/source/backend/entities/ef/PimsPropertyBoundaryVw.cs
+++ b/source/backend/entities/ef/PimsPropertyBoundaryVw.cs
@@ -131,15 +131,6 @@ public partial class PimsPropertyBoundaryVw
[Column("IS_OWNED")]
public bool IsOwned { get; set; }
- [Column("IS_DISPOSED")]
- public bool IsDisposed { get; set; }
-
- [Column("IS_PROPERTY_OF_INTEREST")]
- public bool IsPropertyOfInterest { get; set; }
-
- [Column("IS_OTHER_INTEREST")]
- public bool IsOtherInterest { get; set; }
-
[Column("IS_RETIRED")]
public bool? IsRetired { get; set; }
@@ -154,6 +145,18 @@ public partial class PimsPropertyBoundaryVw
[StringLength(100)]
public string ZoningPotential { get; set; }
+ [Column("IS_DISPOSED")]
+ public bool? IsDisposed { get; set; }
+
+ [Column("IS_OTHER_INTEREST")]
+ public bool? IsOtherInterest { get; set; }
+
+ [Column("HAS_ACTIVE_ACQUISITION_FILE")]
+ public bool? HasActiveAcquisitionFile { get; set; }
+
+ [Column("HAS_ACTIVE_RESEARCH_FILE")]
+ public bool? HasActiveResearchFile { get; set; }
+
[Column("IS_PAYABLE_LEASE")]
public bool? IsPayableLease { get; set; }
diff --git a/source/backend/entities/ef/PimsPropertyHist.cs b/source/backend/entities/ef/PimsPropertyHist.cs
index 29ed29a658..dd91169639 100644
--- a/source/backend/entities/ef/PimsPropertyHist.cs
+++ b/source/backend/entities/ef/PimsPropertyHist.cs
@@ -132,15 +132,6 @@ public partial class PimsPropertyHist
[Column("IS_OWNED")]
public bool IsOwned { get; set; }
- [Column("IS_DISPOSED")]
- public bool IsDisposed { get; set; }
-
- [Column("IS_PROPERTY_OF_INTEREST")]
- public bool IsPropertyOfInterest { get; set; }
-
- [Column("IS_OTHER_INTEREST")]
- public bool IsOtherInterest { get; set; }
-
[Column("IS_VISIBLE_TO_OTHER_AGENCIES")]
public bool IsVisibleToOtherAgencies { get; set; }
@@ -248,4 +239,13 @@ public partial class PimsPropertyHist
[Column("PROP_MGMT_ORG_ID")]
public long? PropMgmtOrgId { get; set; }
+
+ [Column("IS_DISPOSED")]
+ public bool? IsDisposed { get; set; }
+
+ [Column("IS_PROPERTY_OF_INTEREST")]
+ public bool? IsPropertyOfInterest { get; set; }
+
+ [Column("IS_OTHER_INTEREST")]
+ public bool? IsOtherInterest { get; set; }
}
diff --git a/source/backend/entities/ef/PimsPropertyLocationVw.cs b/source/backend/entities/ef/PimsPropertyLocationVw.cs
index 07e1983844..edb013df29 100644
--- a/source/backend/entities/ef/PimsPropertyLocationVw.cs
+++ b/source/backend/entities/ef/PimsPropertyLocationVw.cs
@@ -131,15 +131,6 @@ public partial class PimsPropertyLocationVw
[Column("IS_OWNED")]
public bool IsOwned { get; set; }
- [Column("IS_DISPOSED")]
- public bool IsDisposed { get; set; }
-
- [Column("IS_PROPERTY_OF_INTEREST")]
- public bool IsPropertyOfInterest { get; set; }
-
- [Column("IS_OTHER_INTEREST")]
- public bool IsOtherInterest { get; set; }
-
[Column("IS_RETIRED")]
public bool? IsRetired { get; set; }
@@ -154,6 +145,18 @@ public partial class PimsPropertyLocationVw
[StringLength(100)]
public string ZoningPotential { get; set; }
+ [Column("IS_DISPOSED")]
+ public bool? IsDisposed { get; set; }
+
+ [Column("IS_OTHER_INTEREST")]
+ public bool? IsOtherInterest { get; set; }
+
+ [Column("HAS_ACTIVE_ACQUISITION_FILE")]
+ public bool? HasActiveAcquisitionFile { get; set; }
+
+ [Column("HAS_ACTIVE_RESEARCH_FILE")]
+ public bool? HasActiveResearchFile { get; set; }
+
[Column("IS_PAYABLE_LEASE")]
public bool? IsPayableLease { get; set; }
diff --git a/source/backend/entities/ef/PimsPropertyVw.cs b/source/backend/entities/ef/PimsPropertyVw.cs
new file mode 100644
index 0000000000..192ac3a3f2
--- /dev/null
+++ b/source/backend/entities/ef/PimsPropertyVw.cs
@@ -0,0 +1,174 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations.Schema;
+using Microsoft.EntityFrameworkCore;
+using NetTopologySuite.Geometries;
+
+namespace Pims.Dal.Entities;
+
+[Keyless]
+public partial class PimsPropertyVw
+{
+ [Column("PROPERTY_ID")]
+ public long PropertyId { get; set; }
+
+ [Column("PID")]
+ public int? Pid { get; set; }
+
+ [Column("PID_PADDED")]
+ [StringLength(9)]
+ [Unicode(false)]
+ public string PidPadded { get; set; }
+
+ [Column("PIN")]
+ public int? Pin { get; set; }
+
+ [Required]
+ [Column("PROPERTY_TYPE_CODE")]
+ [StringLength(20)]
+ public string PropertyTypeCode { get; set; }
+
+ [Required]
+ [Column("PROPERTY_STATUS_TYPE_CODE")]
+ [StringLength(20)]
+ public string PropertyStatusTypeCode { get; set; }
+
+ [Required]
+ [Column("PROPERTY_DATA_SOURCE_TYPE_CODE")]
+ [StringLength(20)]
+ public string PropertyDataSourceTypeCode { get; set; }
+
+ [Column("PROPERTY_DATA_SOURCE_EFFECTIVE_DATE")]
+ public DateOnly PropertyDataSourceEffectiveDate { get; set; }
+
+ [Required]
+ [Column("PROPERTY_CLASSIFICATION_TYPE_CODE")]
+ [StringLength(20)]
+ public string PropertyClassificationTypeCode { get; set; }
+
+ [Column("PROPERTY_TENURE_TYPE_CODE")]
+ [StringLength(4000)]
+ public string PropertyTenureTypeCode { get; set; }
+
+ [Column("STREET_ADDRESS_1")]
+ [StringLength(200)]
+ public string StreetAddress1 { get; set; }
+
+ [Column("STREET_ADDRESS_2")]
+ [StringLength(200)]
+ public string StreetAddress2 { get; set; }
+
+ [Column("STREET_ADDRESS_3")]
+ [StringLength(200)]
+ public string StreetAddress3 { get; set; }
+
+ [Column("MUNICIPALITY_NAME")]
+ [StringLength(200)]
+ public string MunicipalityName { get; set; }
+
+ [Column("POSTAL_CODE")]
+ [StringLength(20)]
+ public string PostalCode { get; set; }
+
+ [Column("PROVINCE_STATE_CODE")]
+ [StringLength(20)]
+ public string ProvinceStateCode { get; set; }
+
+ [Column("PROVINCE_NAME")]
+ [StringLength(200)]
+ public string ProvinceName { get; set; }
+
+ [Column("COUNTRY_CODE")]
+ [StringLength(20)]
+ public string CountryCode { get; set; }
+
+ [Column("COUNTRY_NAME")]
+ [StringLength(200)]
+ public string CountryName { get; set; }
+
+ [Column("NAME")]
+ [StringLength(250)]
+ public string Name { get; set; }
+
+ [Column("DESCRIPTION")]
+ [StringLength(2000)]
+ public string Description { get; set; }
+
+ [Column("ADDRESS_ID")]
+ public long? AddressId { get; set; }
+
+ [Column("REGION_CODE")]
+ public short RegionCode { get; set; }
+
+ [Column("DISTRICT_CODE")]
+ public short DistrictCode { get; set; }
+
+ [Column("GEOMETRY", TypeName = "geometry")]
+ public Geometry Geometry { get; set; }
+
+ [Column("LOCATION", TypeName = "geometry")]
+ public Geometry Location { get; set; }
+
+ [Column("PROPERTY_AREA_UNIT_TYPE_CODE")]
+ [StringLength(20)]
+ public string PropertyAreaUnitTypeCode { get; set; }
+
+ [Column("LAND_AREA")]
+ public float? LandArea { get; set; }
+
+ [Column("LAND_LEGAL_DESCRIPTION")]
+ public string LandLegalDescription { get; set; }
+
+ [Column("SURVEY_PLAN_NUMBER")]
+ [StringLength(250)]
+ public string SurveyPlanNumber { get; set; }
+
+ [Column("ENCUMBRANCE_REASON")]
+ [StringLength(500)]
+ public string EncumbranceReason { get; set; }
+
+ [Column("IS_SENSITIVE")]
+ public bool IsSensitive { get; set; }
+
+ [Column("IS_OWNED")]
+ public bool IsOwned { get; set; }
+
+ [Column("IS_RETIRED")]
+ public bool? IsRetired { get; set; }
+
+ [Column("IS_VISIBLE_TO_OTHER_AGENCIES")]
+ public bool IsVisibleToOtherAgencies { get; set; }
+
+ [Column("ZONING")]
+ [StringLength(50)]
+ public string Zoning { get; set; }
+
+ [Column("ZONING_POTENTIAL")]
+ [StringLength(100)]
+ public string ZoningPotential { get; set; }
+
+ [Column("IS_DISPOSED")]
+ public bool? IsDisposed { get; set; }
+
+ [Column("IS_OTHER_INTEREST")]
+ public bool? IsOtherInterest { get; set; }
+
+ [Column("HAS_ACTIVE_ACQUISITION_FILE")]
+ public bool? HasActiveAcquisitionFile { get; set; }
+
+ [Column("HAS_ACTIVE_RESEARCH_FILE")]
+ public bool? HasActiveResearchFile { get; set; }
+
+ [Column("IS_PAYABLE_LEASE")]
+ public bool? IsPayableLease { get; set; }
+
+ [Column("IS_ACTIVE_PAYABLE_LEASE")]
+ public bool? IsActivePayableLease { get; set; }
+
+ [Column("IS_RECEIVABLE_LEASE")]
+ public bool? IsReceivableLease { get; set; }
+
+ [Column("IS_ACTIVE_RECEIVABLE_LEASE")]
+ public bool? IsActiveReceivableLease { get; set; }
+}
diff --git a/source/backend/entities/ef/PimsTake.cs b/source/backend/entities/ef/PimsTake.cs
index d3b04b7f2f..486bd7c281 100644
--- a/source/backend/entities/ef/PimsTake.cs
+++ b/source/backend/entities/ef/PimsTake.cs
@@ -54,6 +54,12 @@ public partial class PimsTake
[StringLength(4000)]
public string Description { get; set; }
+ ///
+ /// Date the take was completed.
+ ///
+ [Column("COMPLETION_DT")]
+ public DateOnly? CompletionDt { get; set; }
+
///
/// Is there a new right of way? (default = FALSE)
///
@@ -138,6 +144,24 @@ public partial class PimsTake
[Column("SURPLUS_AREA")]
public float? SurplusArea { get; set; }
+ ///
+ /// Is there an active lease associated with the take?
+ ///
+ [Column("IS_ACTIVE_LEASE")]
+ public bool IsActiveLease { get; set; }
+
+ ///
+ /// Area of the active lease.
+ ///
+ [Column("ACTIVE_LEASE_AREA")]
+ public float? ActiveLeaseArea { get; set; }
+
+ ///
+ /// End date of the active lease.
+ ///
+ [Column("ACTIVE_LEASE_END_DT")]
+ public DateOnly? ActiveLeaseEndDt { get; set; }
+
[Column("CONCURRENCY_CONTROL_NUMBER")]
public long ConcurrencyControlNumber { get; set; }
diff --git a/source/backend/entities/ef/PimsTakeHist.cs b/source/backend/entities/ef/PimsTakeHist.cs
index 23c83925d7..4f128ccab2 100644
--- a/source/backend/entities/ef/PimsTakeHist.cs
+++ b/source/backend/entities/ef/PimsTakeHist.cs
@@ -52,6 +52,9 @@ public partial class PimsTakeHist
[StringLength(4000)]
public string Description { get; set; }
+ [Column("COMPLETION_DT")]
+ public DateOnly? CompletionDt { get; set; }
+
[Column("IS_NEW_HIGHWAY_DEDICATION")]
public bool IsNewHighwayDedication { get; set; }
@@ -94,6 +97,15 @@ public partial class PimsTakeHist
[Column("SURPLUS_AREA")]
public float? SurplusArea { get; set; }
+ [Column("IS_ACTIVE_LEASE")]
+ public bool IsActiveLease { get; set; }
+
+ [Column("ACTIVE_LEASE_AREA")]
+ public float? ActiveLeaseArea { get; set; }
+
+ [Column("ACTIVE_LEASE_END_DT")]
+ public DateOnly? ActiveLeaseEndDt { get; set; }
+
[Column("CONCURRENCY_CONTROL_NUMBER")]
public long ConcurrencyControlNumber { get; set; }
diff --git a/source/backend/tests/core/Entities/PropertyHelper.cs b/source/backend/tests/core/Entities/PropertyHelper.cs
index 0acc434033..2048387820 100644
--- a/source/backend/tests/core/Entities/PropertyHelper.cs
+++ b/source/backend/tests/core/Entities/PropertyHelper.cs
@@ -23,7 +23,7 @@ public static partial class EntityHelper
///
///
///
- public static PimsProperty CreateProperty(int pid, int? pin = null, PimsPropertyType type = null, PimsPropertyClassificationType classification = null, PimsAddress address = null, PimsPropertyTenureType tenure = null, PimsAreaUnitType areaUnit = null, PimsDataSourceType dataSource = null, PimsPropertyStatusType status = null, PimsLease lease = null, short? regionCode = null, bool? isCoreInventory = null, bool? isPointOfInterest = null, bool? isOtherInterest = null, bool? isDisposed = null, bool? isRetired = null)
+ public static PimsProperty CreateProperty(int pid, int? pin = null, PimsPropertyType type = null, PimsPropertyClassificationType classification = null, PimsAddress address = null, PimsPropertyTenureType tenure = null, PimsAreaUnitType areaUnit = null, PimsDataSourceType dataSource = null, PimsPropertyStatusType status = null, PimsLease lease = null, short? regionCode = null, bool? isCoreInventory = null, bool? isRetired = null)
{
type ??= CreatePropertyType($"Land-{pid}");
classification ??= CreatePropertyClassificationType($"Class-{pid}");
@@ -56,17 +56,40 @@ public static PimsProperty CreateProperty(int pid, int? pin = null, PimsProperty
{
property.IsOwned = isCoreInventory.Value;
}
- if (isPointOfInterest.HasValue)
+ if (isRetired.HasValue)
{
- property.IsPropertyOfInterest = isPointOfInterest.Value;
+ property.IsRetired = isRetired.Value;
}
- if (isOtherInterest.HasValue)
+
+ return property;
+ }
+
+ public static PimsPropertyVw CreatePropertyView(int pid, int? pin = null, PimsPropertyType type = null, PimsPropertyClassificationType classification = null, PimsAddress address = null, short? regionCode = null, bool? isCoreInventory = null, bool? isRetired = null)
+ {
+ type ??= CreatePropertyType($"Land-{pid}");
+ classification ??= CreatePropertyClassificationType($"Class-{pid}");
+ address ??= CreateAddress(pid);
+
+ var property = new PimsPropertyVw()
{
- property.IsOtherInterest = isOtherInterest.Value;
+ PropertyId = pid,
+ Pin = pin,
+ IsRetired = false,
+ PropertyTypeCode = type.PropertyTypeCode,
+ PropertyClassificationTypeCode = classification.PropertyClassificationTypeCode,
+ AddressId = address.AddressId,
+ StreetAddress1 = address.StreetAddress1,
+ StreetAddress2 = address.StreetAddress2,
+ StreetAddress3 = address.StreetAddress3,
+ };
+
+ if (regionCode.HasValue)
+ {
+ property.RegionCode = regionCode.Value;
}
- if (isDisposed.HasValue)
+ if (isCoreInventory.HasValue)
{
- property.IsDisposed = isDisposed.Value;
+ property.IsOwned = isCoreInventory.Value;
}
if (isRetired.HasValue)
{
@@ -105,5 +128,16 @@ public static PimsProperty CreateProperty(this PimsContext context, int pid, int
context.PimsProperties.Add(property);
return property;
}
+
+ public static PimsPropertyVw CreatePropertyView(this PimsContext context, int pid, int? pin = null, PimsPropertyType type = null, PimsPropertyClassificationType classification = null, PimsAddress address = null, PimsPropertyTenureType tenure = null, PimsAreaUnitType areaUnit = null, PimsDataSourceType dataSource = null, PimsPropertyStatusType status = null, Geometry location = null, bool isRetired = false)
+ {
+ type ??= context.PimsPropertyTypes.FirstOrDefault() ?? throw new InvalidOperationException("Unable to find a property type.");
+ classification ??= context.PimsPropertyClassificationTypes.FirstOrDefault() ?? throw new InvalidOperationException("Unable to find a property classification type.");
+ address ??= context.CreateAddress(pid, "12342 Test Street");
+ var property = CreatePropertyView(pid, pin, type, classification, address);
+ property.IsRetired = isRetired;
+ context.PimsPropertyVws.Add(property);
+ return property;
+ }
}
}
diff --git a/source/backend/tests/core/Entities/PropertyOperationHelper.cs b/source/backend/tests/core/Entities/PropertyOperationHelper.cs
index 06ceee5d86..124c60a41a 100644
--- a/source/backend/tests/core/Entities/PropertyOperationHelper.cs
+++ b/source/backend/tests/core/Entities/PropertyOperationHelper.cs
@@ -27,8 +27,8 @@ public static Entity.PimsPropertyOperation CreatePropertyOperation(long? propert
propertyOperation.PropertyOperationTypeCodeNavigation = operationType ?? new Entity.PimsPropertyOperationType() { PropertyOperationTypeCode = PropertyOperationTypes.SUBDIVIDE.ToString(), Description = "SUBDIVIDE", DbCreateUserid = "create user", DbLastUpdateUserid = "last user" };
propertyOperation.PropertyOperationNo = operationNo;
propertyOperation.OperationDt = DateTime.UtcNow;
- propertyOperation.SourceProperty = EntityHelper.CreateProperty(1);
- propertyOperation.DestinationProperty = EntityHelper.CreateProperty(2);
+ propertyOperation.SourceProperty = EntityHelper.CreateProperty(1, isCoreInventory: true);
+ propertyOperation.DestinationProperty = EntityHelper.CreateProperty(2, isCoreInventory: true);
return propertyOperation;
}
diff --git a/source/backend/tests/core/Entities/TakeHelper.cs b/source/backend/tests/core/Entities/TakeHelper.cs
new file mode 100644
index 0000000000..9621a7e3cb
--- /dev/null
+++ b/source/backend/tests/core/Entities/TakeHelper.cs
@@ -0,0 +1,40 @@
+using Pims.Dal.Entities;
+using System;
+using Entity = Pims.Dal.Entities;
+
+namespace Pims.Core.Test
+{
+ ///
+ /// EntityHelper static class, provides helper methods to create test entities.
+ ///
+ public static partial class EntityHelper
+ {
+ ///
+ /// Create a new instance of a Take.
+ ///
+ ///
+ ///
+ public static Entity.PimsTake CreateTake(long id = 1)
+ {
+ return new Entity.PimsTake()
+ {
+ Internal_Id = id,
+ TakeId = id,
+ AppCreateTimestamp = DateTime.Now,
+ AppCreateUserid = "admin",
+ AppCreateUserDirectory = string.Empty,
+ AppLastUpdateUserDirectory = string.Empty,
+ AppLastUpdateUserid = string.Empty,
+ DbCreateUserid = string.Empty,
+ DbLastUpdateUserid = string.Empty,
+ ConcurrencyControlNumber = 1,
+ AreaUnitTypeCodeNavigation = new Entity.PimsAreaUnitType() { Id = id.ToString(), DbCreateUserid = "test", DbLastUpdateUserid = "test", AreaUnitTypeCode = "test", Description = "test" },
+ LandActTypeCodeNavigation = new Entity.PimsLandActType() { Id = id.ToString(), DbCreateUserid = "test", DbLastUpdateUserid = "test", LandActTypeCode = "test", Description = "test" },
+ TakeSiteContamTypeCodeNavigation = new PimsTakeSiteContamType() { Id = id.ToString(), DbCreateUserid = "test", DbLastUpdateUserid = "test", TakeSiteContamTypeCode = "test", Description = "test" },
+ TakeStatusTypeCodeNavigation = new PimsTakeStatusType() { Id = id.ToString(), DbCreateUserid = "test", DbLastUpdateUserid = "test", TakeStatusTypeCode = "test", Description = "test" },
+ TakeTypeCodeNavigation = new PimsTakeType() { Id = id.ToString(), DbCreateUserid = "test", DbLastUpdateUserid = "test", TakeTypeCode = "test", Description = "test" },
+ PropertyAcquisitionFile = new PimsPropertyAcquisitionFile(),
+ };
+ }
+ }
+}
diff --git a/source/backend/tests/core/PrincipalHelper.cs b/source/backend/tests/core/PrincipalHelper.cs
index fa2d0b7053..6182338338 100644
--- a/source/backend/tests/core/PrincipalHelper.cs
+++ b/source/backend/tests/core/PrincipalHelper.cs
@@ -62,6 +62,7 @@ public static ClaimsPrincipal CreateForPermission(params Permissions[] permissio
var claims = new List
{
new Claim("idir_user_guid", Guid.NewGuid().ToString().Replace("-", string.Empty)),
+ new Claim("idir_username", "username@"),
new Claim(ClaimTypes.Email, "test@test.com"),
};
diff --git a/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs b/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs
index 894bf98adb..11a22c1721 100644
--- a/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs
+++ b/source/backend/tests/unit/api/Controllers/Property/SearchControllerTest.cs
@@ -14,8 +14,6 @@
using Pims.Dal.Security;
using Xunit;
using Entity = Pims.Dal.Entities;
-
-using Pims.Api.Models.Concepts.Property;
using Pims.Api.Areas.Property.Models.Search;
namespace Pims.Api.Test.Controllers.Property
@@ -61,11 +59,11 @@ public void GetProperties_All_Success(PropertyFilterModel filter)
// Arrange
var controller = this._helper.CreateController(Permissions.PropertyView);
- var properties = new[] { EntityHelper.CreateProperty(1) };
+ var properties = new[] { EntityHelper.CreatePropertyView(1) };
var repository = this._helper.GetService>();
var mapper = this._helper.GetService();
- var page = new Paged(properties, filter.Page, filter.Quantity);
+ var page = new Paged(properties, filter.Page, filter.Quantity);
repository.Setup(m => m.GetPage(It.IsAny())).Returns(page);
@@ -74,8 +72,8 @@ public void GetProperties_All_Success(PropertyFilterModel filter)
// Assert
var actionResult = Assert.IsType(result);
- var actualResult = Assert.IsType>(actionResult.Value);
- var expectedResult = mapper.Map(properties);
+ var actualResult = Assert.IsType>(actionResult.Value);
+ var expectedResult = mapper.Map(properties);
expectedResult.Should().BeEquivalentTo(actualResult.Items);
repository.Verify(m => m.GetPage(It.IsAny()), Times.Once());
}
@@ -90,11 +88,11 @@ public void GetProperties_Query_Success(Uri uri)
// Arrange
var controller = this._helper.CreateController(Permissions.PropertyView, uri);
- var properties = new[] { EntityHelper.CreateProperty(1) };
+ var properties = new[] { EntityHelper.CreatePropertyView(1) };
var repository = this._helper.GetService>();
var mapper = this._helper.GetService();
- var page = new Paged(properties);
+ var page = new Paged(properties);
repository.Setup(m => m.GetPage(It.IsAny())).Returns(page);
diff --git a/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs b/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs
index ac6e636b04..f1b47ca2c9 100644
--- a/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs
+++ b/source/backend/tests/unit/api/Controllers/Reports/PropertyControllerTest.cs
@@ -86,9 +86,9 @@ public void ExportProperties_Csv_Success(PropertyFilterModel filter)
// Arrange
this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV);
- var properties = new[] { EntityHelper.CreateProperty(1) };
+ var properties = new[] { EntityHelper.CreatePropertyView(1) };
- var page = new Paged(properties, filter.Page, filter.Quantity);
+ var page = new Paged(properties, filter.Page, filter.Quantity);
this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page);
// Act
@@ -111,9 +111,9 @@ public void ExportProperties_Csv_Query_Success(Uri uri)
// Arrange
this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPECSV);
- var properties = new[] { EntityHelper.CreateProperty(1) };
+ var properties = new[] { EntityHelper.CreatePropertyView(1) };
- var page = new Paged(properties);
+ var page = new Paged(properties);
this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page);
// Act
@@ -136,9 +136,9 @@ public void ExportProperties_Excel_Success(PropertyFilterModel filter)
// Arrange
this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL);
- var properties = new[] { EntityHelper.CreateProperty(1) };
+ var properties = new[] { EntityHelper.CreatePropertyView(1) };
- var page = new Paged(properties, filter.Page, filter.Quantity);
+ var page = new Paged(properties, filter.Page, filter.Quantity);
this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page);
// Act
@@ -162,9 +162,9 @@ public void ExportProperties_Excel_Query_Success(Uri uri)
// Arrange
this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCEL);
- var properties = new[] { EntityHelper.CreateProperty(1) };
+ var properties = new[] { EntityHelper.CreatePropertyView(1) };
- var page = new Paged(properties);
+ var page = new Paged(properties);
this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page);
// Act
@@ -188,9 +188,9 @@ public void ExportProperties_ExcelX_Success(PropertyFilterModel filter)
// Arrange
this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX);
- var properties = new[] { EntityHelper.CreateProperty(1) };
+ var properties = new[] { EntityHelper.CreatePropertyView(1) };
- var page = new Paged(properties, filter.Page, filter.Quantity);
+ var page = new Paged(properties, filter.Page, filter.Quantity);
this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page);
// Act
@@ -214,9 +214,9 @@ public void ExportProperties_ExcelX_Query_Success(Uri uri)
// Arrange
this._headers.Setup(m => m["Accept"]).Returns(ContentTypes.CONTENTTYPEEXCELX);
- var properties = new[] { EntityHelper.CreateProperty(1) };
+ var properties = new[] { EntityHelper.CreatePropertyView(1) };
- var page = new Paged(properties);
+ var page = new Paged(properties);
this._repository.Setup(m => m.GetPage(It.IsAny())).Returns(page);
// Act
diff --git a/source/backend/tests/unit/api/Controllers/Takes/TakeControllerTest.cs b/source/backend/tests/unit/api/Controllers/Takes/TakeControllerTest.cs
new file mode 100644
index 0000000000..55bafd40c6
--- /dev/null
+++ b/source/backend/tests/unit/api/Controllers/Takes/TakeControllerTest.cs
@@ -0,0 +1,221 @@
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using FluentAssertions;
+using MapsterMapper;
+using Microsoft.AspNetCore.Mvc;
+using Moq;
+using Pims.Api.Areas.Admin.Controllers;
+using Pims.Api.Areas.Takes.Controllers;
+using Pims.Api.Models.Concepts.Take;
+using Pims.Api.Models.Concepts;
+using Pims.Api.Services;
+using Pims.Core.Exceptions;
+using Pims.Core.Test;
+using Pims.Dal.Entities;
+using Pims.Dal.Security;
+using Xunit;
+using System;
+using Pims.Api.Helpers.Exceptions;
+using Pims.Dal.Exceptions;
+
+namespace Pims.Api.Test.Controllers
+{
+ [Trait("category", "unit")]
+ [Trait("category", "api")]
+ [Trait("area", "takes")]
+ [ExcludeFromCodeCoverage]
+ public class TakeControllerTest
+ {
+ // xUnit.net creates a new instance of the test class for every test that is run,
+ // so any code which is placed into the constructor of the test class will be run for every single test.
+ private readonly TestHelper _helper;
+ private readonly TakeController _controller;
+ private readonly Mock _service;
+ private readonly IMapper _mapper;
+
+ public TakeControllerTest()
+ {
+ this._helper = new TestHelper();
+ this._controller = this._helper.CreateController(Permissions.PropertyView, Permissions.AcquisitionFileView);
+ this._service = this._helper.GetService>();
+ this._mapper = this._helper.GetService();
+ }
+
+ [Fact]
+ public void GetTakesByAcquisitionFileId_Success()
+ {
+ // Arrange
+ this._service.Setup(m => m.GetByFileId(It.IsAny()));
+
+ // Act
+ var result = this._controller.GetTakesByAcquisitionFileId(1);
+
+ // Assert
+ result.Should().BeOfType();
+ this._service.Verify(m => m.GetByFileId(It.IsAny()), Times.Once());
+ }
+
+ [Fact]
+ public void GetTakesByPropertyId_Success()
+ {
+ // Arrange
+ this._service.Setup(m => m.GetByPropertyId(It.IsAny(), It.IsAny()));
+
+ // Act
+ var result = this._controller.GetTakesByPropertyId(1, 2);
+
+ // Assert
+ result.Should().BeOfType();
+ this._service.Verify(m => m.GetByPropertyId(It.IsAny(), It.IsAny()), Times.Once());
+ }
+
+ [Fact]
+ public void GetTakesCountByPropertyId_Success()
+ {
+ // Arrange
+ this._service.Setup(m => m.GetCountByPropertyId(It.IsAny()));
+
+ // Act
+ var result = this._controller.GetTakesCountByPropertyId(1);
+
+ // Assert
+ result.Should().BeOfType();
+ this._service.Verify(m => m.GetCountByPropertyId(It.IsAny()), Times.Once());
+ }
+
+ [Fact]
+ public void GetTakeById_Success()
+ {
+ // Arrange
+ this._service.Setup(m => m.GetById(It.IsAny())).Returns(new PimsTake() { PropertyAcquisitionFileId = 1 });
+
+ // Act
+ var result = this._controller.GetTakeByPropertyFileId(1, 1);
+
+ // Assert
+ result.Should().BeOfType();
+ this._service.Verify(m => m.GetById(It.IsAny()));
+ }
+
+ [Fact]
+ public void GetTakeById_InvalidId()
+ {
+ // Arrange
+ this._service.Setup(m => m.GetById(It.IsAny())).Returns(new PimsTake() { PropertyAcquisitionFileId = 2 });
+
+ // Act
+ Action act = () => this._controller.GetTakeByPropertyFileId(1, 1);
+
+ // Assert
+ act.Should().Throw().WithMessage("Invalid acquisition file property id.");
+ }
+
+ [Fact]
+ public void UpdateTakeByPropertyId_InvalidFilePropertyId()
+ {
+ // Arrange
+ this._service.Setup(m => m.UpdateAcquisitionPropertyTake(It.IsAny(), It.IsAny()));
+
+ // Act
+ Action act = () => this._controller.UpdateAcquisitionPropertyTake(1, 1, new TakeModel() { Id = 1 });
+
+ // Assert
+ act.Should().Throw().WithMessage("Invalid acquisition file property id.");
+ }
+
+ [Fact]
+ public void UpdateTakeByPropertyId_InvalidTakeId()
+ {
+ // Arrange
+ this._service.Setup(m => m.UpdateAcquisitionPropertyTake(It.IsAny(), It.IsAny()));
+
+ // Act
+ Action act = () => this._controller.UpdateAcquisitionPropertyTake(1, 1, new TakeModel() { PropertyAcquisitionFileId = 1 });
+
+ // Assert
+ act.Should().Throw().WithMessage("Invalid take id.");
+ }
+
+ [Fact]
+ public void UpdateTakeByPropertyId_Success()
+ {
+ // Arrange
+ this._service.Setup(m => m.UpdateAcquisitionPropertyTake(It.IsAny(), It.IsAny()));
+
+ // Act
+ var result = this._controller.UpdateAcquisitionPropertyTake(1, 1, new TakeModel() { PropertyAcquisitionFileId = 1, Id = 1 });
+
+ // Assert
+ result.Should().BeOfType();
+ this._service.Verify(m => m.UpdateAcquisitionPropertyTake(It.IsAny(), It.IsAny()));
+ }
+
+ [Fact]
+ public void DeleteTakeByPropertyId_Invalid_AcquisitionFilePropertyId()
+ {
+ // Arrange
+ this._service.Setup(m => m.GetById(It.IsAny())).Returns(new PimsTake() { PropertyAcquisitionFileId = 2 });
+
+ // Act
+ Action act = () => this._controller.DeleteAcquisitionPropertyTake(1, 1, new string[0]);
+
+ // Assert
+ act.Should().Throw().WithMessage("Invalid acquisition file property id.");
+ }
+
+ [Fact]
+ public void DeleteTakeByPropertyId_Failed_Delete()
+ {
+ // Arrange
+ this._service.Setup(m => m.GetById(It.IsAny())).Returns(new PimsTake() { PropertyAcquisitionFileId = 1 });
+ this._service.Setup(m => m.DeleteAcquisitionPropertyTake(It.IsAny(), It.IsAny>())).Returns(false);
+
+ // Act
+ Action act = () => this._controller.DeleteAcquisitionPropertyTake(1, 1, new string[0]);
+
+ // Assert
+ act.Should().Throw().WithMessage("Failed to delete take 1.");
+ }
+
+ [Fact]
+ public void DeleteTakeByPropertyId_Success()
+ {
+ // Arrange
+ this._service.Setup(m => m.GetById(It.IsAny())).Returns(new PimsTake() { PropertyAcquisitionFileId = 1 });
+ this._service.Setup(m => m.DeleteAcquisitionPropertyTake(It.IsAny(), It.IsAny>())).Returns(true);
+
+ // Act
+ this._controller.DeleteAcquisitionPropertyTake(1, 1, new string[0]);
+
+ // Assert
+ this._service.Verify(m => m.DeleteAcquisitionPropertyTake(It.IsAny(), It.IsAny>()));
+ }
+
+ [Fact]
+ public void AddTakeByPropertyId_InvalidId()
+ {
+ // Arrange
+ this._service.Setup(m => m.AddAcquisitionPropertyTake(It.IsAny(), It.IsAny()));
+
+ // Act
+ Action act = () => this._controller.AddAcquisitionPropertyTake(1, new TakeModel());
+
+ // Assert
+ act.Should().Throw().WithMessage("Invalid acquisition file property id.");
+ }
+
+ [Fact]
+ public void AddTakeByPropertyId_Success()
+ {
+ // Arrange
+ this._service.Setup(m => m.AddAcquisitionPropertyTake(It.IsAny(), It.IsAny()));
+
+ // Act
+ var result = this._controller.AddAcquisitionPropertyTake(1, new TakeModel() { PropertyAcquisitionFileId = 1 });
+
+ // Assert
+ result.Should().BeOfType();
+ this._service.Verify(m => m.AddAcquisitionPropertyTake(It.IsAny(), It.IsAny()));
+ }
+ }
+}
diff --git a/source/backend/tests/unit/api/Controllers/Takes/TakesControllerTest.cs b/source/backend/tests/unit/api/Controllers/Takes/TakesControllerTest.cs
deleted file mode 100644
index 5767b9feb9..0000000000
--- a/source/backend/tests/unit/api/Controllers/Takes/TakesControllerTest.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using FluentAssertions;
-using MapsterMapper;
-using Microsoft.AspNetCore.Mvc;
-using Moq;
-using Pims.Api.Areas.Admin.Controllers;
-using Pims.Api.Areas.Takes.Controllers;
-using Pims.Api.Models.Concepts.Take;
-using Pims.Api.Models.Concepts;
-using Pims.Api.Services;
-using Pims.Core.Exceptions;
-using Pims.Core.Test;
-using Pims.Dal.Entities;
-using Pims.Dal.Security;
-using Xunit;
-
-namespace Pims.Api.Test.Controllers
-{
- [Trait("category", "unit")]
- [Trait("category", "api")]
- [Trait("area", "takes")]
- [ExcludeFromCodeCoverage]
- public class TakesControllerTest
- {
- // xUnit.net creates a new instance of the test class for every test that is run,
- // so any code which is placed into the constructor of the test class will be run for every single test.
- private readonly TestHelper _helper;
- private readonly TakeController _controller;
- private readonly Mock _service;
- private readonly IMapper _mapper;
-
- public TakesControllerTest()
- {
- this._helper = new TestHelper();
- this._controller = this._helper.CreateController(Permissions.PropertyView, Permissions.AcquisitionFileView);
- this._service = this._helper.GetService>();
- this._mapper = this._helper.GetService();
- }
-
- [Fact]
- public void GetTakesByAcquisitionFileId_Success()
- {
- // Arrange
- this._service.Setup(m => m.GetByFileId(It.IsAny()));
-
- // Act
- var result = this._controller.GetTakesByAcquisitionFileId(1);
-
- // Assert
- result.Should().BeOfType();
- this._service.Verify(m => m.GetByFileId(It.IsAny()), Times.Once());
- }
-
- [Fact]
- public void GetTakesByPropertyId_Success()
- {
- // Arrange
- this._service.Setup(m => m.GetByPropertyId(It.IsAny(), It.IsAny()));
-
- // Act
- var result = this._controller.GetTakesByPropertyId(1, 2);
-
- // Assert
- result.Should().BeOfType();
- this._service.Verify(m => m.GetByPropertyId(It.IsAny(), It.IsAny()), Times.Once());
- }
-
- [Fact]
- public void GetTakesCountByPropertyId_Success()
- {
- // Arrange
- this._service.Setup(m => m.GetCountByPropertyId(It.IsAny()));
-
- // Act
- var result = this._controller.GetTakesCountByPropertyId(1);
-
- // Assert
- result.Should().BeOfType();
- this._service.Verify(m => m.GetCountByPropertyId(It.IsAny()), Times.Once());
- }
-
- [Fact]
- public void UpdateAcquisitionPropertyTakes_Success()
- {
- // Arrange
- this._service.Setup(m => m.UpdateAcquisitionPropertyTakes(It.IsAny(), It.IsAny>()));
-
- // Act
- var result = this._controller.UpdateAcquisitionPropertyTakes(1, new List());
-
- // Assert
- result.Should().BeOfType();
- this._service.Verify(m => m.UpdateAcquisitionPropertyTakes(It.IsAny(), It.IsAny>()));
- }
- }
-}
diff --git a/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs b/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs
index fa09ec97a6..24e2ee0f18 100644
--- a/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs
+++ b/source/backend/tests/unit/api/Services/AcquisitionFileServiceTest.cs
@@ -556,7 +556,7 @@ public void Update_Drafts_TakesInProgress_Violation()
}
[Fact]
- public void Update_DraftsNotComplete_NoViolation()
+ public void Update_Drafts_TakesNotInFile_Violation()
{
// Arrange
var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit);
@@ -567,177 +567,70 @@ public void Update_DraftsNotComplete_NoViolation()
repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1);
repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile);
- var agreementRepository = this._helper.GetService>();
- agreementRepository.Setup(x => x.GetAgreementsByAcquisitionFile(It.IsAny())).Returns(new List() { new PimsAgreement() { AgreementStatusTypeCode = "DRAFT" } });
-
var userRepository = this._helper.GetService>();
userRepository.Setup(x => x.GetUserInfoByKeycloakUserId(It.IsAny())).Returns(EntityHelper.CreateUser("Test"));
- var statusSolver = this._helper.GetService>();
- statusSolver.Setup(x => x.CanEditDetails(It.IsAny())).Returns(true);
-
- // Act
- Action act = () => service.Update(acqFile, new List());
-
- // Assert
- act.Should().NotThrow();
- }
-
- [Fact]
- public void Update_Success_Region_UserOverride()
- {
- // Arrange
- var service = this.CreateAcquisitionServiceWithPermissions(Permissions.AcquisitionFileEdit);
-
- var acqFile = EntityHelper.CreateAcquisitionFile();
-
- var repository = this._helper.GetService>();
- repository.Setup(x => x.Update(It.IsAny())).Returns(acqFile);
- repository.Setup(x => x.GetRowVersion(It.IsAny())).Returns(1);
- repository.Setup(x => x.GetById(It.IsAny())).Returns(acqFile);
-
- var lookupRepository = this._helper.GetService