📄 IrbyImaging.UI.Models.TimeSheet.cs Documentation


📋 Table of Contents

  1. Overview & Purpose
  2. Dependencies & Technologies
  3. Key Functional Areas
  4. Data Models
    4.1. TimeSheet Class
    4.2. EmployeeTimeSheet Class
    4.3. TimeSheetType Enum
  5. UML Class Diagram
  6. Properties Reference
    6.1. TimeSheet Properties
    6.2. EmployeeTimeSheet Properties
    6.3. TimeSheetType Values
  7. Usage Examples
  8. Integration & Usage Scenarios
  9. Helper Methods & Utilities
  10. Error Handling & Return Types
  11. Third‑Party Integrations
  12. Conclusion

🧐 Overview & Purpose

The TimeSheet.cs file declares the core View Models for managing time-entry data in the IrbyImaging UI:

  • TimeSheet
    Represents a single time‑card entry (hours per date, daily breakdown, notes, etc.).
  • EmployeeTimeSheet
    Aggregates a week of TimeSheet entries for one employee, including daily and grand totals.
  • TimeSheetType
    Enumeration of common time‑card categories (Regular, Home, PTO, Holiday).

These models power the front‑end data binding and enable structured capture & display of employees’ worked hours in a weekly timesheet.


🛠 Dependencies & Technologies

  • .NET Standard / .NET Core
  • System, System.Collections.Generic
  • System.ComponentModel.DataAnnotations (for [DataType] attribute)

No external third‑party libraries are referenced in this file.


🎯 Key Functional Areas

  • Data Validation & Annotation
    ‣ Uses [DataType(DataType.Date)] on DateWorked for UI date pickers.
  • Aggregation Models
    ‣ EmployeeTimeSheet wraps multiple daily entries plus totals.
  • Enumerated Types
    ‣ TimeSheetType for strongly‑typed category codes.

🗃 Data Models

1. TimeSheet Class

  • Namespace: IrbyImaging.UI.Models
  • Purpose: Holds one timesheet row (single day or summarized week entry).

2. EmployeeTimeSheet Class

  • Namespace: IrbyImaging.UI.Models
  • Purpose: Contains a list of TimeSheet entries for a single employee, with daily and grand totals.

3. TimeSheetType Enum

  • Namespace: IrbyImaging.UI.Models
  • Purpose: Defines categories for time entries (Regular, Home, PTO, Holiday).

📐 UML Class Diagram

classDiagram
    class TimeSheet {
        +Guid TimeSheetEntryId
        +Guid? EmployeeId
        +string EmployeeNumber
        +string EmployeeName
        +int? TimeCardTypeCodeId
        +string TimeCardTypeDesc
        +DateTime DateWorked
        +decimal HoursWorked
        +string TimeCardType
        +string Monday
        +string Tuesday
        +string Wednesday
        +string Thursday
        +string Friday
        +string Saturday
        +string Sunday
        +string MondayYear
        +string MondayTotal
        +string TuesdayTotal
        +string WednesdayTotal
        +string ThursdayTotal
        +string FridayTotal
        +string SaturdayTotal
        +string SundayTotal
        +string GrandTotal
        +string Total
        +string Notes
    }

    class EmployeeTimeSheet {
        +Guid? EmployeeId
        +string EmployeeNumber
        +string EmployeeName
        +string MondayTotal
        +string TuesdayTotal
        +string WednesdayTotal
        +string ThursdayTotal
        +string FridayTotal
        +string SaturdayTotal
        +string SundayTotal
        +string GrandTotal
        +List<TimeSheet> TimeEntry
    }

    class TimeSheetType {
        <<enumeration>>
        +Regular
        +Home
        +PTO
        +Holiday
    }

    EmployeeTimeSheet "1" o-- "*" TimeSheet

🗒 Properties Reference

6.1 TimeSheet Properties

Property Type Description
TimeSheetEntryId Guid Primary key, unique identifier for the time‑sheet entry.
EmployeeId Guid? Reference to the employee; nullable if not assigned.
EmployeeNumber string Labor or badge number.
EmployeeName string Full name of the employee.
TimeCardTypeCodeId int? Numeric code for time‑card category (TimeSheetType).
TimeCardTypeDesc string Human‑readable description of the above code.
DateWorked DateTime [DataType.Date] The date this entry applies to.
HoursWorked decimal Raw decimal representation of hours logged.
TimeCardType string The category name (e.g., “Regular”, “PTO”).
Monday … Sunday string Individual string entries (e.g., “8.0”, “Off”) for each day of the week.
MondayYear String The calendar year for Monday’s date (useful for cross‑year weeks).
MondayTotal … SundayTotal string Aggregated totals per day across multiple TimeSheet entries.
GrandTotal string Sum of all hours in this record/week.
Total string Alias for GrandTotal or custom total string.
Notes string Free‑form remarks or comments.

6.2 EmployeeTimeSheet Properties

Property Type Description
EmployeeId Guid? Identifier of the employee.
EmployeeNumber string Labor or badge number.
EmployeeName string Full name of the employee.
MondayTotal … GrandTotal string Aggregated daily and weekly totals across an employee’s TimeEntry list.
TimeEntry List Collection of individual TimeSheet entries for the week.

6.3 TimeSheetType Values

Name Value Description
Regular 0 Standard on‑site work hours.
Home 1 Work performed remotely.
PTO 2 Paid time off (vacation).
Holiday 3 Official company holiday.

💻 Usage Examples

7.1 Creating a Single TimeSheet Entry

using IrbyImaging.UI.Models;
using System;

var entry = new TimeSheet
{
    TimeSheetEntryId    = Guid.NewGuid(),
    EmployeeId          = Guid.Parse("d2c40bcf-1234-4f56-9a7a-abcdef123456"),
    EmployeeNumber      = "E12345",
    EmployeeName        = "Alice Johnson",
    TimeCardTypeCodeId  = (int)TimeSheetType.Regular,
    TimeCardTypeDesc    = TimeSheetType.Regular.ToString(),
    DateWorked          = new DateTime(2024, 06, 15),
    HoursWorked         = 8.0m,
    TimeCardType        = "Regular",
    Monday              = "8.0",
    Tuesday             = "8.0",
    Wednesday           = "8.0",
    Thursday            = "8.0",
    Friday              = "8.0",
    Saturday            = "0.0",
    Sunday              = "0.0",
    GrandTotal          = "40.0",
    Notes               = "Completed imaging reports."
};

7.2 Building an EmployeeTimeSheet

var weekSheet = new EmployeeTimeSheet
{
    EmployeeId     = entry.EmployeeId,
    EmployeeNumber = entry.EmployeeNumber,
    EmployeeName   = entry.EmployeeName,
    TimeEntry      = new List<TimeSheet> { entry },
    MondayTotal    = "8.0",
    TuesdayTotal   = "8.0",
    WednesdayTotal = "8.0",
    ThursdayTotal  = "8.0",
    FridayTotal    = "8.0",
    SaturdayTotal  = "0.0",
    SundayTotal    = "0.0",
    GrandTotal     = "40.0"
};

🔗 Integration & Usage Scenarios

  • MVC / Razor Pages
    Bind these models to strongly‑typed views for data‑entry forms and display grids.

  • API Controllers
    Accept or return TimeSheet / EmployeeTimeSheet as JSON payloads in RESTful endpoints.

  • Client-Side Frameworks
    Consume via AJAX/Fetch calls to populate React/Vue/Angular components.


🧰 Helper Methods & Utilities

This file does not contain custom helper methods or extension utilities.
Focus is solely on data modeling and data annotations.


🚨 Error Handling & Return Types

  • All properties are simple POCOs—no built‑in validation logic beyond [DataType].
  • Consider server‑side or UI validation for:
    • Non‑negative HoursWorked
    • Valid date ranges
    • Required fields (e.g., EmployeeId, DateWorked)

🌐 Third‑Party Integrations

No direct integrations are present in this models file.
Any integration (e.g., database ORM, JSON serializers) will be configured elsewhere in the solution.


✅ Conclusion

This TimeSheet.cs file provides the foundational View Models for capturing and aggregating weekly time‑sheet data in the IrbyImaging application. By clearly defining:

  • Individual entries (TimeSheet),
  • Weekly roll‑ups (EmployeeTimeSheet), and
  • Category codes (TimeSheetType),

it ensures a strongly‑typed, maintainable way to pass time data between the UI, controllers, and any downstream services (APIs, databases, reports).

With these models in place, you can:

  • Build rich forms for employees to submit hours.
  • Validate and transform timesheet data server‑side.
  • Easily render grids, summaries, and exportable reports.

Happy coding! 🚀