πŸ“‘ Equipment Domain Class Documentation


Table of Contents

  1. Overview & Purpose
  2. Key Functional Areas
  3. Dependencies & Technologies
  4. Domain Model & Data Model
  5. UML Class Diagram
  6. Sample Code Blocks & Usage Examples
  7. Best Practices & Tips
  8. 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 Job for 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.Equipment in your relational DB.
  • [Key]: Denotes EquipmentId as primary key.
  • [DataType(DataType.Date)]: Hints for UI renderers/formats on date fields.
  • [ForeignKey]: Links JobId to the Job domain 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! πŸš€