π Equipment Domain Class Documentation
Table of Contents
- Overview & Purpose
- Key Functional Areas
- Dependencies & Technologies
- Domain Model & Data Model
- UML Class Diagram
- Sample Code Blocks & Usage Examples
- Best Practices & Tips
- Conclusion
1. Overview & Purpose
The Equipment class is a domain entity representing physical equipment items managed by the Irby Imaging system. It encapsulates all the core data attributes you need to:
- Track acquisition, disposal, and maintenance details
- Perform financial reporting (purchase costs, depreciation categories)
- Link equipment to Jobs (work orders/projects)
- Store classification metadata (make, model year, device type, etc.)
βAn effective domain model helps keep your data consistent, your code expressive, and your system maintainable.β π
2. Key Functional Areas
- Identification: Unique GUID, asset/serial numbers, tags
- Lifecycle Dates: Acquisition, disposal, & current status windows
- Financial Data: Purchase price, finance method, accounting class
- Categorization: Equipment class, device/fuel type, rate group
- Relational Linking: Foreign key to a
Jobfor scheduling & tracking
3. Dependencies & Technologies
| Technology / Package | Purpose |
|---|---|
| .NET (C#) | Language & runtime |
| Entity Framework / Data Annotations | ORM mapping to irby.Equipment table |
| System.ComponentModel.DataAnnotations | Attribute-based validation & display hints |
| System.ComponentModel.DataAnnotations.Schema | Database schema mapping (Table, ForeignKey) |
4. Domain Model & Data Model
4.1 Database Mapping & Annotations
[Table("Equipment", Schema = "irby")]
public class Equipment
{
[Key]
public Guid EquipmentId { get; set; }
// ... other properties ...
[ForeignKey("JobId")]
public Job Job { get; set; }
}
- [Table]: Maps this class to
irby.Equipmentin your relational DB. - [Key]: Denotes
EquipmentIdas primary key. - [DataType(DataType.Date)]: Hints for UI renderers/formats on date fields.
- [ForeignKey]: Links
JobIdto theJobdomain model.
4.2 Properties Reference
| Property | Type | Required? | Description |
|---|---|---|---|
| EquipmentId | Guid |
Yes | Primary Key |
| Name | string |
No | Internal name or code |
| DisplayName | string |
No | Human-friendly name |
| AssetNumber | string |
No | Unique asset tracking number |
| UnitTagNumber | string |
No | Plant/unit tag identifier |
| SerialNumber | string |
No | Manufacturerβs serial number |
| DateAcquired | DateTime? |
No | Date when equipment was acquired |
| DateDisposed | DateTime? |
No | Date when equipment was disposed |
| Description | string |
No | Detailed description or notes |
| FinanceMethod | string |
No | E.g., Lease, Purchase |
| Status | string |
No | Highβlevel status code |
| RateGroup | string |
No | Billing or cost rate grouping |
| AccountingClass | string |
No | Financial classification |
| EquipmentClass | string |
No | Operational classification |
| AssetManufacturer | string |
No | OEM or vendor name |
| Year | string |
No | Model or manufacture year |
| FuelType | string |
No | E.g., Gas, Diesel, Electric |
| PreventiveMaintCatDesc | string |
No | PM category description |
| DeviceType | string |
No | Type/category of device |
| Division | string |
No | Organizational division |
| AssetRemark, AssetRemark2 | string |
No | Additional freeβtext remarks |
| PurchasePrice | decimal |
Yes | Cost at purchase |
| JobId | Guid? |
No | Foreign key to Job |
| Job | Job |
No | Navigation property |
| CurrentStatus | string |
No | Text-based status (e.g., InβService, OutβofβService) |
| BeginDate, EndDate | DateTime? |
No | Validity window for current work assignment/status |
| Class | int |
Yes | Numeric classification |
| Type | int |
Yes | Secondary numeric classification |
4.3 Relationships & Navigation
- One-to-Many (
JobβEquipment): An equipment item may be associated with a single job (JobId), allowing scheduling, cost rollβups, and status tracking within that job.
5. UML Class Diagram
ββββββββββββββββββββββββββ
β Equipment β
ββββββββββββββββββββββββββ€
β - EquipmentId : Guid β
β - Name : string β
β - DisplayName : string β
β - AssetNumber : string β
β - ... β
β - PurchasePrice :decimal
β - JobId : Guid? β
β - CurrentStatus :stringβ
β - BeginDate :DateTime? β
β - EndDate : DateTime? β
β - Class : int β
β - Type : int β
ββββββββββββββββββββββββββ€
β + Job : Job β 1
ββββββββββββββββββββββββββ
β
β 0..*
βΌ
ββββββββββββββββββββββββββ
β Job β
β (See Job.cs model) β
ββββββββββββββββββββββββββ
6. Sample Code Blocks & Usage Examples
6.1 Creating & Saving a New Equipment π
using (var context = new IrbyDbContext())
{
var newEquip = new Equipment
{
EquipmentId = Guid.NewGuid(),
Name = "MRI_Scanner_3000",
DisplayName = "MRI Scanner Model 3000",
AssetNumber = "ASSET-2024-001",
SerialNumber = "SN-XYZ-12345",
DateAcquired = DateTime.UtcNow.Date,
PurchasePrice = 150000m,
FinanceMethod = "Capital Lease",
EquipmentClass = "Imaging",
DeviceType = "MRI",
Status = "Active",
CurrentStatus = "In Service",
Class = 1,
Type = 5
};
context.Equipments.Add(newEquip);
context.SaveChanges();
}
6.2 Querying Equipment by Status π
using (var db = new IrbyDbContext())
{
var activeList = db.Equipments
.Where(e => e.CurrentStatus == "In Service")
.OrderBy(e => e.DateAcquired)
.ToList();
foreach (var eq in activeList)
{
Console.WriteLine($"{eq.DisplayName} acquired on {eq.DateAcquired:d}");
}
}
6.3 Updating Disposal Date ποΈ
var idToDispose = /* some existing Guid */;
var equip = context.Equipments.Find(idToDispose);
if (equip != null)
{
equip.DateDisposed = DateTime.UtcNow.Date;
equip.Status = "Disposed";
context.SaveChanges();
}
7. Best Practices & Tips
- Guid PKs: Use
Guid.NewGuid()on creation for Worldwide uniqueness π - Nullable Dates: Guard against null before formatting/displaying
- Decimal Price: Always specify culture or formatting when rendering π²
- Foreign Keys: Leverage EF navigation properties for eager/lazy loading
- Data Validation: Supplement DataAnnotations with custom validation in your service layer
8. Conclusion
The Equipment domain class is the cornerstone of the Irby Imaging asset-management subsystem. By capturing every relevant detailβfrom acquisition dates and financial classification to manufacturer metadata and job associationsβit enables robust CRUD operations, reporting, and integration with higher-level business logic (maintenance scheduling, cost rollβups, deprecation, etc.).
With proper usage of Entity Framework mappings, well-structured queries, and the flexibility of C# data types, you can build a maintainable, scalable solution for managing your organizationβs valuable equipment assets. π οΈ
Happy coding & clear asset tracking! π