📚 PNC Domain Class Documentation

Welcome to the comprehensive documentation for the Pnc class in the IrbyImaging.DomainClasses project. This document provides an in‑depth look at the purpose, structure, and usage of the Pnc entity, complete with code snippets, UML diagrams, and practical examples.


📑 Table of Contents

  1. Overview & Purpose
  2. Schema & Table Mapping
  3. Property Definitions
  4. Key Functional Areas
  5. Dependencies & Technologies
  6. UML Class Diagram
  7. Usage Examples
  8. Conclusion

1. Overview & Purpose

The Pnc class represents a single Procurement Card (P‑Card) transaction record stored in the irby.Pnc table. It is a Plain Old CLR Object (POCO) that Entity Framework Core uses to map data between the application and the database.

  • Use Case

    • Track/record P‑Card transactions (posting date, merchant info, employee details).
    • Facilitate reporting, reconciliation, and auditing of departmental expenses.
  • Who Should Use

    • Backend developers integrating with the IrbyContext (EF Core) to create/read/update/delete P‑Card records.
    • Reporting services that query P‑Card transaction details.

2. Schema & Table Mapping

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IrbyImaging.DomainClasses
{
    [Table("Pnc", Schema = "irby")]
    public class Pnc
    { 
        // …properties…
    }
}
Annotation Description
[Table("Pnc", Schema="irby")] Maps this class to the irby.Pnc table.
[Key] Marks PncId as the primary key column.

3. Property Definitions

Below is a detailed table of all properties on the Pnc class:

Property Type Attributes Description
PncId Guid [Key] 🔑 Primary key, uniquely identifies each P‑Card record.
PostingDate DateTime 📅 Date when transaction was posted.
TransactionId string 🆔 Unique transaction identifier.
DepartmentOrJobNumber string 💼 Department or job number associated with the expense.
Subsidiary string 🏦 Subsidiary code in format Object.Subsidiary (e.g., 1234.123).
SubLedger string 📘 Sub-ledger identifier.
SubLedgerType string 📙 Type/category of the sub-ledger.
CustomerWorkOrderNumber string 📋 Customer work order number.
UnitNumber string 📦 Unit number for internal tracking.
EmployeeJdeAB string 👤 Employee JDE AB # (internal system code).
LastName string 👤 Employee last name.
FirstName string 👤 Employee first name.
CardNumber string 💳 Card number masked as XXXX-XXXX-XXXX-1234.
TransactionDate DateTime 📆 Actual date of the transaction.
SplitAmount decimal 💲 Amount of the transaction (can be split across accounts).
MerchantName string 🏪 Merchant or vendor name.
MCC string 🔢 Merchant Category Code.

4. Key Functional Areas

  1. Entity Mapping
    • Leverages EF Core Data Annotations to map C# properties to database columns.
  2. Data Integrity
    • Ensures every record has a unique PncId.
  3. Audit & Reporting
    • Fields like PostingDate and TransactionDate track transaction timelines.
  4. Security & Compliance
    • Masks CardNumber except for the last four digits.

5. Dependencies & Technologies

  • .NET Standard / .NET Core
  • Entity Framework Core
    • Microsoft.EntityFrameworkCore
    • Microsoft.EntityFrameworkCore.Annotations
  • System.ComponentModel.DataAnnotations
  • System.ComponentModel.DataAnnotations.Schema

6. UML Class Diagram

classDiagram
    class Pnc {
        <<Table("irby.Pnc")>>
        +Guid PncId
        +DateTime PostingDate
        +string TransactionId
        +string DepartmentOrJobNumber
        +string Subsidiary
        +string SubLedger
        +string SubLedgerType
        +string CustomerWorkOrderNumber
        +string UnitNumber
        +string EmployeeJdeAB
        +string LastName
        +string FirstName
        +string CardNumber
        +DateTime TransactionDate
        +decimal SplitAmount
        +string MerchantName
        +string MCC
    }

7. Usage Examples

7.1. Inserting a New Pnc Record

using (var context = new IrbyContext())
{
    var newPnc = new Pnc
    {
        PncId = Guid.NewGuid(),
        PostingDate = DateTime.UtcNow,
        TransactionId = "TXN123456",
        DepartmentOrJobNumber = "DPT-1001",
        Subsidiary = "2000.001",
        SubLedger = "SL-01",
        SubLedgerType = "TypeA",
        CustomerWorkOrderNumber = "WO-7890",
        UnitNumber = "UNIT-45",
        EmployeeJdeAB = "EJ-1122",
        FirstName = "Jane",
        LastName = "Doe",
        CardNumber = "XXXX-XXXX-XXXX-9876",
        TransactionDate = new DateTime(2024, 5, 10),
        SplitAmount = 150.75m,
        MerchantName = "Global Supplies Inc.",
        MCC = "5045"
    };

    context.Pncs.Add(newPnc);
    context.SaveChanges();
}

7.2. Querying Pnc Records

using (var context = new IrbyContext())
{
    // Fetch all transactions for a given department
    var results = context.Pncs
                         .Where(p => p.DepartmentOrJobNumber == "DPT-1001")
                         .OrderByDescending(p => p.TransactionDate)
                         .ToList();
                         
    foreach (var txn in results)
    {
        Console.WriteLine($"{txn.TransactionDate:d} - {txn.MerchantName}: {txn.SplitAmount:C}");
    }
}

8. Conclusion

The Pnc class is a crucial component for modeling P‑Card transactions in the IrbyImaging system. By defining clear mappings and rich metadata via Data Annotations, it:

  • Simplifies CRUD operations with Entity Framework Core
  • Ensures consistent data shape for reporting and auditing
  • Encapsulates business‑critical details (department, employee, merchant info)

With this documentation, you have everything you need to integrate, extend, and maintain P‑Card transaction functionality in your .NET application. Enjoy building! 🚀


For further questions or contributions, please refer to the project’s README or contact the development team.