📄 IrbyImaging.UI.Models.TimeSheet.cs Documentation
📋 Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Key Functional Areas
- Data Models
4.1. TimeSheet Class
4.2. EmployeeTimeSheet Class
4.3. TimeSheetType Enum - UML Class Diagram
- Properties Reference
6.1. TimeSheet Properties
6.2. EmployeeTimeSheet Properties
6.3. TimeSheetType Values - Usage Examples
- Integration & Usage Scenarios
- Helper Methods & Utilities
- Error Handling & Return Types
- Third‑Party Integrations
- 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 ofTimeSheetentries 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.GenericSystem.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)]onDateWorkedfor UI date pickers. - Aggregation Models
‣EmployeeTimeSheetwraps multiple daily entries plus totals. - Enumerated Types
‣TimeSheetTypefor 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
TimeSheetentries 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 returnTimeSheet/EmployeeTimeSheetas 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)
- Non‑negative
🌐 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! 🚀