π ODSJob Class Documentation
π Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Data Model Structure
- Key Functional Areas
- Helper Methods / Utilities
- Error Handling & Return Types
- API Endpoints Overview
- Third-party Integrations
- UML Class Diagram
- Sample Code Blocks
- Usage Examples
- 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 |
| 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 |
| 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
- Data Representation
Houses all attributes required to describe a βJobβ entity in ODS.
- EF Core Mapping
Conforms to convention-over-configuration. Byte arrays map to SQL uniqueidentifier or varbinary, DateTime? to nullable datetime.
- Reporting & Analytics
Many *_CODE / *_DESC pairs enable easy lookup in UIs and reports.
- 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
- 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();
- Updating Progress
var job = db.ODSJobs.Find(targetJobId);
if (job != null) {
job.PERCENTAGE_COMPLETE = "50%";
job.LAST_UPDATED = DateTime.UtcNow;
db.SaveChanges();
}
- 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!