πŸ“„ ODSJob Class Documentation


πŸ“‘ Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. Data Model Structure
  4. Key Functional Areas
  5. Helper Methods / Utilities
  6. Error Handling & Return Types
  7. API Endpoints Overview
  8. Third-party Integrations
  9. UML Class Diagram
  10. Sample Code Blocks
  11. Usage Examples
  12. Conclusion & Best Practices

🧐 Overview & Purpose

The ODSJob class resides in the IrbyImaging.DomainClasses assembly and represents a domain entity that maps to the β€œJob” data structure in the Operational Data Store (ODS). It models:

  • Unique identifiers (GUIDs & binary IDs)
  • Organizational hierarchy
  • Scheduling & progress dates
  • Location & address details
  • Financial, contract, and classification codes
  • Role-based associations (Manager, Customer, etc.)

Primary Use Cases

  • Persisting and retrieving job/project records via Entity Framework
  • Feeding job data into reporting, analytics, or downstream systems
  • Serving as a DTO in business logic layers

πŸ› οΈ Dependencies & Technologies

Layer / Tech Description
.NET 6+ Target framework for domain classes
Entity Framework ORM for mapping ODSJob to a database table
System.ComponentModel.DataAnnotations.Schema (Imported for potential mapping attributes)
C# 10+ Language version leveraging nullable reference types

Note: Although DataAnnotations are imported, this class currently uses convention-based mapping in EF Core.


πŸ—οΈ Data Model Structure

namespace IrbyImaging.DomainClasses
{
    public class ODSJob
    {
        public byte[] JOB_ID { get; set; }
        public byte[] COMPANY_ID { get; set; }
        public string ORG_OPU { get; set; }
        // ... 150+ other properties
        public Guid? CUSTOMER_NUMBER { get; set; }
        public string MANAGER_NAME { get; set; }
        public string CUSTOMER { get; set; }
    }
}

3.1 Identity & Organization Fields

Property Type Description
JOB_ID byte[] Primary key (binary GUID)
COMPANY_ID byte[] Company identifier (binary GUID)
ORG_OPU string Operating unit code
ORG_COMPANY string Company code
ORG_INTDIVISION string International division code
ORG_SBU string Strategic Business Unit code
ORG_BU string Business Unit code

3.2 Scheduling & Dates

Property Type Description
DATE_PLANNED_START DateTime? Scheduled start date
DATE_PLANNED_COMPLETE DateTime? Scheduled end date
DATE_ACTUAL_START DateTime? Actual start date
DATE_ACTUAL_COMPLETE DateTime? Actual completion date
PERCENTAGE_COMPLETE string Progress (%) as string (e.g., β€œ75%”)
LAST_UPDATED DateTime? Timestamp for last change
CDC_OPERATION string Change Data Capture operation code

3.3 Location & Address

Property Type Description
ADDRESS_LINE_1 string Street address
ADDRESS_LINE_2 string Additional address line
ADDRESS_CITY string City
ADDRESS_STATE_PROVINCE string State or province
ADDRESS_POSTAL string ZIP or postal code
ADDRESS_COUNTRY string Country
FIELD_OFFICE string Field office location code/name

3.4 Financial & Tax Information

Property Type Description
TAX_AREA string Tax jurisdiction code
TAX_RATE_AREA string Tax rate category
POSTING_EDIT_CODE string Accounting edit code
CERTIFIED_JOB_CODE string Job certification code
CONTRACT_BILLING_CODE string Billing method code

3.5 Contract & Classification Codes

This region contains paired code/description fields for quick lookups:

Code Field Desc Field
CONTRACT_TYPE_CODE CONTRACT_TYPE_DESC
BUSINESS_UNIT_TYPE_CODE BUSINESS_UNIT_TYPE_DESC
RISK_LEVEL_ASSESSMENT_CODE RISK_LEVEL_ASSESSMENT_DESC
…and 30+ more classification pairs…

3.6 Roles & Associations

Property Type Description
MANAGER_ID byte[] Binary ID of the Manager
SUPERINTENDENT_ID byte[] Binary ID of the Superintendent
PARENT_PROJECT_ID byte[] Parent (umbrella) project ID
CUSTOMER_ID byte[] Customer record ID
CUSTOMER_NUMBER Guid? Customer number (GUID)
JOB_OWNER_ID byte[] Job owner ID
PROJECT_ESTIMATOR_ID byte[] Estimator ID
Navigation Props:
Manager Guid? Nullable GUID for Manager (mapped)
Superintendent Guid? Nullable GUID for Superintendent
PROJECT_ESTIMATOR Guid? Nullable GUID for Estimator
MANAGER_NAME string Full name of the manager
CUSTOMER string Customer name

3.7 Additional Metadata

Property Type Description
PRIMARY_JOB string Flag (β€œY”/β€œN”) for primary endeavors
ENTITY string Legal entity name/code
HYPERION_PLNG_FORECAST_CODE string Financial system forecast code

πŸ”‘ Key Functional Areas

  1. Data Representation
    Houses all attributes required to describe a β€œJob” entity in ODS.
  2. EF Core Mapping
    Conforms to convention-over-configuration. Byte arrays map to SQL uniqueidentifier or varbinary, DateTime? to nullable datetime.
  3. Reporting & Analytics
    Many *_CODE / *_DESC pairs enable easy lookup in UIs and reports.
  4. Extensibility
    Additional properties can be appended without breaking the core domain.

🧩 Helper Methods / Utilities

This class is a POCO (Plain Old CLR Object).
No inline helper methods or utilities are defined here.
Mapping responsibilities are delegated to the DbContext or Fluent API.


⚠️ Error Handling & Return Types

  • There are no explicit error handling methods.
  • All properties are auto-implemented.
  • Nullable types (e.g. DateTime?, Guid?) signal optional data.
  • Validation should be handled at the service or UI layer.

🌐 API Endpoints Overview

This domain class itself does not expose REST or gRPC endpoints.
It is typically used within:

  • A service layer (JobService)
  • A Web API controller (e.g., JobsController)

πŸ”— Third-party Integrations

  • Entity Framework Core for CRUD & LINQ queries.
  • Reporting tools (e.g., Power BI, SSRS) can consume this model via EF.

πŸ“Š UML Class Diagram

classDiagram
    class ODSJob {
        +byte[] JOB_ID
        +byte[] COMPANY_ID
        +string ORG_OPU
        +string NAME
        +DateTime? LAST_UPDATED
        +string CDC_OPERATION
        +DateTime? DATE_PLANNED_START
        +DateTime? DATE_PLANNED_COMPLETE
        +byte[] MANAGER_ID
        +Guid? Manager
        +string MANAGER_NAME
        +... other properties ...
    }

πŸ’» Sample Code Blocks

1. Entity Configuration (Fluent API)

public class AppDbContext : DbContext {
    public DbSet<ODSJob> ODSJobs { get; set; }

    protected override void OnModelCreating(ModelBuilder modelBuilder) {
        modelBuilder.Entity<ODSJob>(entity => {
            entity.HasKey(e => e.JOB_ID);
            entity.Property(e => e.JOB_ID)
                  .HasColumnName("JOB_ID")
                  .HasColumnType("uniqueidentifier")
                  .IsRequired();

            entity.Property(e => e.NAME)
                  .HasMaxLength(200)
                  .IsRequired();

            // ... additional configuration ...
        });
    }
}

2. LINQ Query Example

using var db = new AppDbContext();
var activeJobs = db.ODSJobs
    .Where(j => j.JOB_STATUS_CODE == "ACTIVE" &&
                j.DATE_ACTUAL_COMPLETE == null)
    .OrderBy(j => j.DATE_PLANNED_START)
    .Select(j => new {
        j.NAME,
        j.DATE_PLANNED_START,
        j.MANAGER_NAME
    })
    .ToList();

πŸ“‹ Usage Examples

  1. Creating a New Job
    var job = new ODSJob {
        JOB_ID = Guid.NewGuid().ToByteArray(),
        COMPANY_ID = existingCompanyId,
        ORG_OPU = "OPU123",
        NAME = "New Data Center Build",
        DATE_PLANNED_START = DateTime.UtcNow,
        JOB_STATUS_CODE = "PENDING",
        MANAGER_NAME = "Alice Johnson"
    };
    db.ODSJobs.Add(job);
    db.SaveChanges();
    
  2. Updating Progress
    var job = db.ODSJobs.Find(targetJobId);
    if (job != null) {
        job.PERCENTAGE_COMPLETE = "50%";
        job.LAST_UPDATED = DateTime.UtcNow;
        db.SaveChanges();
    }
    
  3. Mapping to DTO for API
    public class JobDto {
        public Guid JobId { get; set; }
        public string Name { get; set; }
        public DateTime? PlannedStart { get; set; }
        public string ManagerName { get; set; }
    }
    
    var dto = db.ODSJobs
                 .Where(j => j.JOB_ID == id)
                 .Select(j => new JobDto {
                     JobId = new Guid(j.JOB_ID),
                     Name = j.NAME,
                     PlannedStart = j.DATE_PLANNED_START,
                     ManagerName = j.MANAGER_NAME
                 })
                 .FirstOrDefault();
    

🏁 Conclusion & Best Practices

  • Separation of Concerns: Keep validation, business rules, and mapping configurations out of the domain POCO.
  • Performance: Load only needed columns in queriesβ€”SELECT new { … } or projection to DTOs.
  • Extensibility: Add new classification pairs or address lines as needed without changing existing services.
  • Consistency: Leverage naming conventions (e.g., *_CODE / *_DESC pairs) for clarity in UIs and reports.
  • Nullable Awareness: Always check for null on nullable date/GUID fields before use.

πŸš€ Ready to integrate ODSJob into your data layer for robust job/project management!