CollectionsRepository¶
CollectionsRepository is the ICollectionsRepository implementation for Case (mapped to LEGAL_COLLECTION), and it is the single widest surface in this library for reading and writing the legal-collections subsystem: debtor/case lookups, address resolution, payment application, interest/statement selection, and the "SOIL" (State of Oregon Intercept, inferred) debt-intercept batch pipeline. Every read is a named-query call (Session.GetNamedQuery()) against Oracle package WCIS_DBA.PK80010_LEGAL_COLLECTIONS/PK80011_LEGALCOL_SOIL, and the three write operations (ApplyPayments, CreateSoilDebtorReferenceRecords, CreateSoilAdjustmentRecords) run those packages directly via inline CreateSqlQuery().ExecuteUpdate() calls rather than through NHibernate's entity change-tracking (saif-data-nhibernate-analysis.md OP-SDN-03 through OP-SDN-06).
Purpose¶
- Provide lookup and search operations over collections cases and their debtors (reference number, category totals, debtor name/SSN, addresses, free-text search) for collections case management screens/services.
- Apply payments to a collection case's cost transactions by invoking the Oracle
APPLYPAYMENTSprocedure, per SDN-BR-010. - Select transactions/debtors for interest calculation, missing-payment follow-up, and statement generation.
- Drive the SOIL debt-intercept batch: identify SOIL-eligible debtors (rule SDN-BR-011), snapshot reference records, and create/adjust SOIL transactions filtered by truncated create date (SDN-BR-012).
Context¶
- Namespace:
SAIF.Data.NHibernate.Repositories - Assembly/package:
SAIF.Data.NHibernate(ships inside theSAIF.SAIFCode.CoreNuGet package) - Base class:
Repository<Case>fromSAIF.Framework.Data.NHibernate(external, resolved via Legends CLI — see Inherited public members below). - Implements:
ICollectionsRepository, defined inSAIF.Data*.
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| CollectionsRepository(NHibernateUnitOfWork) | public CollectionsRepository(NHibernateUnitOfWork unitOfWork) |
Constructor; passes unitOfWork to the Repository<Case> base. |
| GetCasesByReferenceNumber | public ICollection<CaseHeader> GetCasesByReferenceNumber(string referenceId) |
Returns the CaseHeader rows matching a case/reference number via named query Collections_GetCasesByReferenceNumber (SQL-004). |
| GetCategoryTotals | public ICollection<CategoryTotal> GetCategoryTotals(long caseId) |
Returns per-category subtotal/current-balance rows for a case via Collections_GetCategoryTotals (SQL-005). |
| GetDebtorName | public String GetDebtorName(long id) |
Resolves a display name for a debtor id across affiliate/policy/third-party/person/company sources via Collections_GetDebtorName (SQL-006). |
| GetPrimaryDebtorName | public string GetPrimaryDebtorName(long id) |
Resolves the primary (first-listed) debtor's display name for a case via Collections_GetPrimaryDebtorName (SQL-007). |
| GetDebtorSsn | public DebtorSsn GetDebtorSsn(long id) |
Returns the debtor's SSN record via Collections_GetDebtorSSN; PII-sensitive — see Security and authorization (SC-SDN-03) (SQL-008). |
| GetFraudOtherAddress | public ICollection<DebtorContactInfo> GetFraudOtherAddress(long locId) |
Returns contact info for a fraud/other-type debtor location via Collections_GetFraudOtherAddress (SQL-009). |
| GetPolicyAddress | public ICollection<DebtorContactInfo> GetPolicyAddress(long id) |
Returns contact info for a policy-type debtor via Collections_GetPolicyAddress (SQL-010). |
| GetThirdPartyAddress | public ICollection<DebtorContactInfo> GetThirdPartyAddress(long thirdPartySeqNum) |
Returns contact info for a third-party debtor via Collections_GetThirdPartyAddress (SQL-011). |
| SearchCollections | public ICollection<SearchResult> SearchCollections(string lastName, string firstName, string ssn, string policyName, string showClosedCases, string uniqueRunId) |
Multi-branch debtor/case search by last/first name, SSN, policy name, and a closed-cases flag via Collections_SearchCollections (SQL-012); accepts an SSN parameter — see Security and authorization (SC-SDN-03). |
| ApplyPayments | public void ApplyPayments(decimal caseId, DateTime tranDate) |
Executes WCIS_DBA.PK80010_LEGAL_COLLECTIONS.APPLYPAYMENTS(:inSeqNum, :pmt_date) via inline SQL and ExecuteUpdate(), allocating unapplied payments across cost transactions for the case as of the transaction date (SDN-BR-010, SQL-053). |
| GetInterest | public ICollection<CaseInterest> GetInterest(string caseId, DateTime runDate) |
Returns per-transaction interest amounts for a case as of a run date via Collections_GetCaseInterest (SQL-013). |
| GetMissingPolicyPayments | public ICollection<SelectedPayment> GetMissingPolicyPayments(DateTime selectDate) |
Returns policy financial transactions not yet posted as collection payments as of a select date via Collections_GetMissingPolicyPayments (SQL-014). |
| GetThirdPartyPayments | public ICollection<SelectedPayment> GetThirdPartyPayments(DateTime selectDate) |
Returns third-party distribution payments to post as of a select date via Collections_GetThirdPartyPayments (SQL-015). |
| DebtorsWithoutPayments | public ICollection<Debtor> DebtorsWithoutPayments(DateTime lastStatementDate) |
Returns debtors who received no payment since a given last-statement date, for follow-up/statement processing via Collections_getDebtorsWithoutPayments (SQL-016). |
| DebtorsWithExpiredLocs | public ICollection<Debtor> DebtorsWithExpiredLocs(DateTime selectDate) |
Returns debtors whose letter-of-credit/location record has expired as of a select date via Collections_getDebtorsWithExpiredLocs (SQL-017). |
| BalanceBroughtToMinAmountTransactions | public ICollection<SelectedPayment> BalanceBroughtToMinAmountTransactions(DateTime selectDate) |
Returns transactions where the balance was brought to the configured minimum amount as of a select date via Collections_getBalanceBroughtToMinAmount (SQL-018). |
| CreateSoilDebtorReferenceRecords | public void CreateSoilDebtorReferenceRecords(DateTime runDate, string uniqueRunId) |
Executes WCIS_DBA.PK80011_LEGALCOL_SOIL.CREATE_REFERENCE_RECORDS(:create_date_in, :run_id) via inline SQL, snapshotting SOIL-eligible debtors into SOIL_DEBTOR_REFERENCE for the run (SDN-BR-011, SQL-002). |
| GetWorkerIdForDebtors | public ICollection<DebtorWorkerId> GetWorkerIdForDebtors() |
Returns worker ids for all currently SOIL-eligible debtors (balance ≥ 0, INCLUDE_ON_SOIL_FLAG='Y', no third party, worker id present) via Collections_getWorkerIdForSoilDebtor (SDN-BR-011, SQL-019). |
| GetWorkerIdForSoilTrans | public ICollection<DebtorWorkerId> GetWorkerIdForSoilTrans(DateTime createDate) |
Returns worker ids for SOIL reference records created on the truncated createDate via Collections_getWorkerIdForSoilTrans (SDN-BR-012, SQL-020). |
| CreateSoilAdjustmentRecords | public void CreateSoilAdjustmentRecords(DateTime runDate, string uniqueRunId) |
Executes WCIS_DBA.PK80011_LEGALCOL_SOIL.CREATE_SOIL_TRANSACTIONS(:create_date_in, :run_id) via inline SQL, creating/adjusting/removing DOR (Department of Revenue) intercept balance transactions for the run (SQL-003). |
| DebtorLastStatementBalance | public decimal DebtorLastStatementBalance(DateTime statementDate, long debtorId) |
Returns the debtor's balance as of the given last-statement date via Collections_GetDebtorLastStatementBalance (SQL-021). |
Inherited public members¶
Members in this section are inherited from Repository<Case> in SAIF.Framework.Data.NHibernate. They are available on this type through inheritance.
| Member | Signature | Purpose | Origin |
|---|---|---|---|
| Add | public void Add(Case entity) |
Registers a new Case entity for insertion on the next unit-of-work commit.† |
SAIF.Framework.Data.NHibernate — RepositoryBase<Case> |
| Update | public void Update(Case entity) |
Marks an existing Case entity as modified for the next unit-of-work commit.† |
SAIF.Framework.Data.NHibernate — RepositoryBase<Case> |
| Delete | public void Delete(Case entity) |
Registers a Case entity for deletion on the next unit-of-work commit.† |
SAIF.Framework.Data.NHibernate — RepositoryBase<Case> |
| Query | public IQueryable<Case> Query() |
Returns a LINQ-queryable session projection over Case for building ad hoc filters.† |
SAIF.Framework.Data.NHibernate — RepositoryBase<Case> |
| Get | public Case Get(object id) |
Loads a Case by primary key, returning null if not found.† |
SAIF.Framework.Data.NHibernate — RepositoryBase<Case> |
| Load | public Case Load(object id) |
Loads a Case by primary key as a (possibly proxied) reference, throwing if not found.† |
SAIF.Framework.Data.NHibernate — RepositoryBase<Case> |
| SystemDate | public DateTime SystemDate { get; } |
Current system date/time as tracked by the underlying session/unit of work.† | SAIF.Framework.Data.NHibernate — RepositoryBase<Case> |
Behavioral notes¶
- All 21 read/write operations route through
Session.GetNamedQuery()orSession.CreateSqlQuery(), never through the inheritedRepository<Case>CRUD surface; every one is essentially a typed wrapper over an Oracle package procedure/function inWCIS_DBA.PK80010_LEGAL_COLLECTIONSorWCIS_DBA.PK80011_LEGALCOL_SOIL*. - The three write operations (
ApplyPayments,CreateSoilDebtorReferenceRecords,CreateSoilAdjustmentRecords) callExecuteUpdate()directly against a stored procedure and do not go through NHibernate's dirty-checking/flush pipeline, so they take effect immediately regardless of the enclosing unit-of-work's commit/rollback state*. - "SOIL" is inferred to mean the State of Oregon Intercept program from the package name
LEGALCOL_SOIL; the expansion is not independently verified (saif-data-nhibernate-analysis.mdopen question).
Constraints and usage notes¶
GetDebtorSsnandSearchCollectionsexpose SSN data with no access check at this layer; callers must restrict access themselves (SC-SDN-03, Security and authorization).- All parameters are bound via
SetParameter/SetDecimal/SetDateTime, so none of these calls are subject to SQL injection from caller-supplied strings (SC-SDN-05, Security and authorization).
Note: Statements marked with
†are derived from dependency library documentation via the Legends CLI. Statements marked with*were inferred from code structure or contextual evidence. Statements marked with**could not be confirmed; treat as unknown until verified.
Related documentation¶
- Index
- Overview
- Architecture
- Dependencies
- Operations and processes
- Business rules
- Database tables
- SQL catalog
- Procedures
- Security and authorization
- API reference
Sources¶
Data/SAIF.Data.NHibernate/Repositories/CollectionsRepository.cs