📄 IrbyImaging.DomainClasses/WIP.cs Documentation
Welcome to the in-depth documentation for the WIP (Work‑In‑Progress) entity in the IrbyImaging.DomainClasses project. This Markdown guide covers everything you need to know about the class, its purpose, structure, database mapping, usage examples, and more.
📑 Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Domain Model Structure
- Data Model & Database Mapping
- Property Reference
- UML Class Diagram
- Sample Code & Usage
- Conclusion
1. Overview & Purpose 📊
The WIP class represents a Work‑In‑Progress record in the Irby Imaging domain. Each instance tracks the financial and operational metrics of a job for a specific reporting month and year.
Key responsibilities:
- Model job metadata (e.g., JobNumber, Customer, Division)
- Store financial metrics (Revenue, Cost, Margin, YTD values)
- Indicate hierarchy (Parent/Child job flags)
- Provide audit information (updated by/date)
This entity is designed to be mapped to a relational database table via Entity Framework (Code First).
2. Dependencies & Technologies 🔗
| Technology / Package | Purpose |
|---|---|
| .NET (C#) | Core language and runtime |
| Entity Framework Core | ORM for database mapping |
System.ComponentModel.DataAnnotations |
Validation & mapping attributes |
System.ComponentModel.DataAnnotations.Schema |
Table/schema mapping attributes |
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
3. Domain Model Structure 🏗️
namespace IrbyImaging.DomainClasses
{
[Table("WIP", Schema = "irby")]
public class WIP
{
[Key]
public Guid WIPId { get; set; }
public int ReportMonth { get; set; }
public int ReportYear { get; set; }
// ... more properties ...
public DateTime updatedDate { get; set; }
}
}
- Namespace:
IrbyImaging.DomainClasses - Table Mapping:
irby.WIP - Primary Key:
WIPId(GUID)
4. Data Model & Database Mapping 🗄️
| Attribute / Annotation | Applies To | Effect |
|---|---|---|
[Table("WIP", Schema="irby")] |
Class | Maps class to irby.WIP table |
[Key] |
Property | Marks WIPId as the primary key |
The rest of the properties rely on convention-based mapping (column name = property name).
5. Property Reference 📝
Below is a categorized table of all properties in WIP.
| Category | Property | Type | Description |
|---|---|---|---|
| Identifier | WIPId | Guid |
Unique identifier (PK) |
| Reporting Period | ReportMonth | int |
Month of reporting (1–12) |
| ReportYear | int |
Year of reporting | |
| Job Info | JobNumber | string |
Alphanumeric job reference |
| JobName | string |
Descriptive job name | |
| State | string |
U.S. state or region | |
| Customer | string |
Customer / client name | |
| Division | string |
Internal division (e.g., “Engineering”) | |
| TypeOfWork | string |
Category of work (e.g., “Inspection”) | |
| FieldOffice | string |
Physical office or territory | |
| Lead | string |
Lead engineer / project manager | |
| Financials | Revenue | decimal |
Revenue for the period |
| Cost | decimal |
Cost for the period | |
| Margin | decimal |
Profit margin (Revenue − Cost) | |
| MarginPct | decimal |
Margin percentage | |
| RevenueYTD | decimal |
Year-to-date revenue | |
| CostYTD | decimal |
Year-to-date cost | |
| MarginYTD | decimal |
Year-to-date margin | |
| MarginYTDPct | decimal |
Year-to-date margin percentage | |
| Additional Metrics | CIEB | decimal |
Cumulative Invoiced, Ending Billed |
| Unbilled | decimal |
Amount not yet billed | |
| BIEC | decimal |
Billed, Invoiced, Ending Cumulative | |
| ManHours | decimal |
Total man‑hours worked | |
| Hierarchy Flags | ParentJob | bool |
Indicates a parent job category |
| ChildJob | bool |
Indicates a sub‑job | |
| ParentJobNumber | string |
The parent job’s number (if ChildJob = true) |
|
| Audit | updatedBy | string |
User or system process that last updated the record |
| updatedDate | DateTime |
Timestamp of last update |
6. UML Class Diagram 📈
@startuml
class WIP {
+Guid WIPId
+int ReportMonth
+int ReportYear
+string JobNumber
+string JobName
+string State
+string Customer
+string Division
+string TypeOfWork
+string FieldOffice
+string Lead
+decimal Revenue
+decimal Cost
+decimal Margin
+decimal MarginPct
+decimal RevenueYTD
+decimal CostYTD
+decimal MarginYTD
+decimal MarginYTDPct
+decimal CIEB
+decimal Unbilled
+decimal BIEC
+decimal ManHours
+bool ParentJob
+bool ChildJob
+string ParentJobNumber
+string updatedBy
+DateTime updatedDate
}
@enduml
Copy the above PlantUML snippet into any PlantUML tool to visualize the class.
7. Sample Code & Usage 🚀
7.1. Defining the DbContext
using Microsoft.EntityFrameworkCore;
using IrbyImaging.DomainClasses;
public class IrbyContext : DbContext
{
public DbSet<WIP> WIPs { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options) =>
options.UseSqlServer("YourConnectionStringHere");
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
// Additional Fluent API configuration (if needed)
}
}
7.2. Creating and Saving a WIP Record
using var context = new IrbyContext();
var wipRecord = new WIP
{
WIPId = Guid.NewGuid(),
ReportMonth = 8,
ReportYear = 2023,
JobNumber = "IRB-1001",
JobName = "Site Survey – West Coast",
State = "CA",
Customer = "Acme Corp.",
Division = "Environmental",
TypeOfWork = "Survey",
FieldOffice = "San Francisco",
Lead = "Jane Doe",
Revenue = 12000.00m,
Cost = 8000.00m,
Margin = 4000.00m,
MarginPct = 33.33m,
RevenueYTD = 85000.00m,
CostYTD = 60000.00m,
MarginYTD = 25000.00m,
MarginYTDPct = 29.41m,
CIEB = 12000.00m,
Unbilled = 0.00m,
BIEC = 12000.00m,
ManHours = 150.5m,
ParentJob = false,
ChildJob = false,
ParentJobNumber= null,
updatedBy = "system",
updatedDate = DateTime.UtcNow
};
context.WIPs.Add(wipRecord);
context.SaveChanges();
Console.WriteLine("✅ WIP record saved successfully!");
8. Conclusion ✔️
- WIP.cs is a POCO that tracks job-related financials and metadata per reporting period.
- It integrates seamlessly with Entity Framework Core for CRUD operations.
- The class schema and property types are designed to provide comprehensive reporting on Work‑In‑Progress metrics.
- Extend or customize via Fluent API or by adding navigation properties if your domain evolves.
We hope this documentation provides clear insight into the WIP entity’s structure and usage. Happy coding! 🎉