📄 EmployeeStatus Enum Documentation
📑 Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Key Functional Areas
- Data Models & Enumerations
- Helper Methods & Utilities
- Sample Code Blocks & Usage Examples
- UML Diagram
- Third‑Party Integrations
- Error Handling & Return Types
- API Endpoints Overview
- Conclusion
1. Overview & Purpose
File: IrbyImaging.Utility/EmployeeStatus.cs
Assembly: IrbyImaging.BLUtility
Author: kvamshi
Created: March 31, 2022
The EmployeeStatus enum centralizes all possible employment statuses for personnel within the IrbyImaging application. By defining these statuses in one strongly‑typed enum, developers can:
- ✅ Maintain consistency across UI dropdowns, database fields, and business logic.
- ✅ Leverage compile‑time checks instead of magic strings.
- ✅ Utilize
DisplayAttributeto show user‑friendly labels in views.
2. Dependencies & Technologies
| Technology | Purpose |
|---|---|
| .NET/C# | Language and platform for the library |
| System.ComponentModel.DataAnnotations | Enables [Display] attribute for human-readable names |
3. Key Functional Areas
- Enum Definition: A simple list of statuses representing the lifecycle of an employee.
- Display Metadata: Leverages DataAnnotations to associate each enum member with a user‑friendly name.
4. Data Models & Enumerations
4.1 EmployeeStatus Enum Breakdown
namespace IrbyImaging.Utility
{
/// <summary>
/// Enum EmployeeStatus
/// </summary>
public enum EmployeeStatus
{
[Display(Name = "Active")]
Active,
[Display(Name = "Terminated")]
Terminated,
[Display(Name = "Other")]
Other,
[Display(Name = "Unpaid Leave Of Absence")]
UnpaidLeaveOfAbsence,
[Display(Name = "Retired")]
Retired,
[Display(Name = "Terminated (Last Check)")]
TerminatedLastCheck,
[Display(Name = "Contract Labor Employee (NP)")]
ContractLaborEmployeeNp,
[Display(Name = "Workers' Comp Leave")]
WorkersCompLeave
}
}
| Enum Member | Display Name | Description |
|---|---|---|
Active |
Active | Currently employed |
Terminated |
Terminated | Employment terminated |
Other |
Other | Miscellaneous status not covered by others |
UnpaidLeaveOfAbsence |
Unpaid Leave Of Absence | On unpaid leave |
Retired |
Retired | Retired from service |
TerminatedLastCheck |
Terminated (Last Check) | Termination pending final payroll processing |
ContractLaborEmployeeNp |
Contract Labor Employee (NP) | Contract employee, non‑payroll-managed |
WorkersCompLeave |
Workers' Comp Leave | On workers' compensation leave |
5. Helper Methods & Utilities
While the enum itself has no methods, it's common to create extension methods to:
- Retrieve the Display Name
- List all statuses for binding
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
public static class EnumExtensions
{
/// <summary>
/// Gets the <see cref="DisplayAttribute"/> Name for an enum value.
/// </summary>
public static string GetDisplayName(this Enum enumValue)
{
return enumValue.GetType()
.GetMember(enumValue.ToString())
.First()
.GetCustomAttribute<DisplayAttribute>()?
.Name
?? enumValue.ToString();
}
/// <summary>
/// Returns all enum values and their display names.
/// </summary>
public static IEnumerable<(T Value, string Name)> ToSelectList<T>() where T : Enum
{
return Enum.GetValues(typeof(T))
.Cast<T>()
.Select(e => (e, (e as Enum).GetDisplayName()));
}
}
6. Sample Code Blocks & Usage Examples
6.1 Populate a Drop‑down in ASP.NET Core Razor
@model MyViewModel
<select asp-for="SelectedStatus" asp-items="Model.StatusOptions">
<option value="">-- Select Status --</option>
</select>
// In the ViewModel:
public class MyViewModel
{
public EmployeeStatus? SelectedStatus { get; set; }
public IEnumerable<SelectListItem> StatusOptions =>
EnumExtensions.ToSelectList<EmployeeStatus>()
.Select(x => new SelectListItem {
Value = x.Value.ToString(),
Text = x.Name
});
}
6.2 Logging or Displaying Status
var status = EmployeeStatus.Retired;
Console.WriteLine($"Current Status: {status.GetDisplayName()}");
// Output: Current Status: Retired
6.3 Switch‑Case Business Logic
void HandleStatus(EmployeeStatus status)
{
switch (status)
{
case EmployeeStatus.Active:
// Perform Active logic
break;
case EmployeeStatus.Terminated:
// Perform Termination workflow
break;
// Add cases as needed...
default:
// Handle Other statuses
break;
}
}
7. UML Diagram
classDiagram
enum EmployeeStatus {
Active
Terminated
Other
UnpaidLeaveOfAbsence
Retired
TerminatedLastCheck
ContractLaborEmployeeNp
WorkersCompLeave
}
8. Third‑Party Integrations
- None direct.
- Relies on System.ComponentModel.DataAnnotations (built‑in) for display metadata.
9. Error Handling & Return Types
- Error Handling: Not applicable within the enum definition itself.
- Return Types: N/A for enum; related helper methods return
string,IEnumerable<SelectListItem>, etc.
10. API Endpoints Overview
🚫 No API endpoints are defined in this file.
This enum is typically consumed by service or controller layers elsewhere.
11. Conclusion
The EmployeeStatus enum is a simple yet powerful utility that standardizes employee state representation across the IrbyImaging system. By combining strong typing with display metadata, it enables:
- Consistent usage in UI, business logic, and data persistence
- Easy localization and display customization via attributes
- Reduced risk of typos and mismatched string literals
Feel free to extend this enum or the accompanying helper methods to suit evolving business requirements! 🚀
Generated by IrbyImaging Documentation Toolchain