Skip to content

SQL-110: Retrieve CashReceipts

This ORM statement performs a read operation on CashReceipts via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Collections/CashReceiptsService.cs (L76, L151).

Classification

Field Value
SQL ID SQL-110
Operation type Read
Execution method ORM (NHibernate LINQ)
Database Oracle
Schema [unqualified]**
Command type N/A (ORM-generated)
Business object CashReceipts
Criteria property N/A — ORM
Lifecycle method GenerateReport, ProcessBatch

Parameters

Parameter Direction Type Max length Description
runDate Input ** N/A x.CreateDate == runDate → column CREATE_DATE
batch.BatchIdentifier Input ** N/A x.BatchIdentifier == batch.BatchIdentifier → column BATCH_ID
batch.BatchDate Input ** N/A x.TransactionDate == batch.BatchDate → column TRANSACTION_DATE

Tables

Table Access Columns used
LEGAL_COLLECTION_CASH_RECEIPTS SELECT LC_CASH_RECEIPTS_SEQ_NUM, TRANSACTION_DATE, BATCH_ID, REFERENCE_NUM, LEGAL_COLLECTION_SEQ_NUM, TRANSACTION_AMOUNT, TRANSACTION_TYPE_CODE, PROCESSED_FLAG, CREATE_DATE, CHECK_ID

LINQ statement

Source: Services/SAIF.Services/Collections/CashReceiptsService.cs:76

// Services/SAIF.Services/Collections/CashReceiptsService.cs:76-77
            var cashReceipts = UnitOfWork.GetRepository<DataModel.CashReceipts>()
                .Query().Where(x => x.CreateDate == runDate).ToList();

// Services/SAIF.Services/Collections/CashReceiptsService.cs:151-153
            var cashReceipts = UnitOfWork.GetRepository<DataModel.CashReceipts>()
                .Query().Where(x => x.BatchIdentifier == batch.BatchIdentifier && x.TransactionDate == batch.BatchDate);
            foreach (var cashReceipt in cashReceipts)

Sample SQL

Inferred SQL: This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
-- Services/SAIF.Services/Collections/CashReceiptsService.cs:76
SELECT
  LCCR.LC_CASH_RECEIPTS_SEQ_NUM,
  LCCR.TRANSACTION_DATE,
  LCCR.BATCH_ID,
  LCCR.REFERENCE_NUM,
  LCCR.LEGAL_COLLECTION_SEQ_NUM,
  LCCR.TRANSACTION_AMOUNT,
  LCCR.TRANSACTION_TYPE_CODE,
  LCCR.PROCESSED_FLAG,
  LCCR.CREATE_DATE,
  LCCR.CHECK_ID
FROM LEGAL_COLLECTION_CASH_RECEIPTS LCCR
WHERE LCCR.CREATE_DATE = :runDate

-- Services/SAIF.Services/Collections/CashReceiptsService.cs:151
SELECT
  LCCR.LC_CASH_RECEIPTS_SEQ_NUM,
  LCCR.TRANSACTION_DATE,
  LCCR.BATCH_ID,
  LCCR.REFERENCE_NUM,
  LCCR.LEGAL_COLLECTION_SEQ_NUM,
  LCCR.TRANSACTION_AMOUNT,
  LCCR.TRANSACTION_TYPE_CODE,
  LCCR.PROCESSED_FLAG,
  LCCR.CREATE_DATE,
  LCCR.CHECK_ID
FROM LEGAL_COLLECTION_CASH_RECEIPTS LCCR
WHERE LCCR.BATCH_ID = :BatchIdentifier
  AND LCCR.TRANSACTION_DATE = :BatchDate

Translation notes: - L151-152 is enumerated by foreach (L153); batch.BatchIdentifier / batch.BatchDate are members of the materialized BatchControl -> binds :BatchIdentifier, :BatchDate. - CaseId is a scalar Map on LEGAL_COLLECTION_SEQ_NUM - no join to LEGAL_COLLECTION.

Operations and processes

Sources

  • Services/SAIF.Services/Collections/CashReceiptsService.cs (L76, L151)