📄 IrbyImaging.Utility – Enumerations.cs Documentation
📑 Table of Contents
- Overview & Purpose
- Key Functional Areas
- Dependencies & Technologies
- Enumerations Reference
- Sample Code & Usage Examples
- UML Diagram
- Conclusion
🧐 Overview & Purpose
Enumerations.cs is part of the IrbyImaging.Utility namespace and defines a set of strongly‑typed enums used across the Irby Imaging ticketing and request modules.
They standardize status codes, priority levels, ticket/request types, and request options throughout the application, enabling:
- ✔️ Consistency: Centralized definitions of possible values.
- ✔️ Type Safety: Compile‑time checking instead of magic numbers/strings.
- ✔️ Readability: Human‑friendly names (via
[Display]) in UIs and reports.
🔑 Key Functional Areas
- Status Management (
TicketStatus): Tracks life‑cycle of support tickets. - Prioritization (
TicketPriority): Indicates urgency. - Categorization (
TicketType): Distinguishes between incidents and service requests. - Request Options (
RequestOptionType): Classifies hardware, software, and enterprise requests.
⚙️ Dependencies & Technologies
- .NET Standard / .NET Core – The enums are compatible with any .NET platform.
- System.ComponentModel.DataAnnotations – For decorating enum members with
[Display(Name = "...")].
No external NuGet packages or third‑party integrations are required.
📦 Enumerations Reference
TicketStatus 🔖
| Value | Member | Display Name | Description |
|---|---|---|---|
| 1 | Open | Open | Newly created ticket awaiting assignment. |
| 2 | InProgress | In Progress | Ticket is actively being handled. |
| 3 | Closed | Closed | Ticket has been resolved and closed. |
| 4 | Cancelled | Cancelled | Ticket was cancelled before resolution. |
| 5 | WaitingForApproval | Waiting for Approval | Pending managerial or stakeholder approval. |
public enum TicketStatus
{
Open = 1,
[Display(Name = "In Progress")]
InProgress = 2,
Closed = 3,
Cancelled = 4,
[Display(Name = "Waiting for Approval")]
WaitingForApproval = 5
}
TicketPriority ⭐
| Value | Member | Description |
|---|---|---|
| 1 | Low | Minor issues, least urgency. |
| 2 | Normal | Default priority. |
| 3 | High | Critical issues, top urgency. |
public enum TicketPriority
{
Low = 1,
Normal = 2,
High = 3
}
TicketType 🎫
| Value | Member | Description |
|---|---|---|
| 1 | Incident | Unplanned interruption or service outage. |
| 2 | Request | Standard service request or inquiry. |
public enum TicketType
{
Incident = 1,
Request = 2
}
RequestOptionType 🛠️
| Value | Member | Description |
|---|---|---|
| 1 | Hardware | Physical devices (PCs, printers, etc.). |
| 2 | Software | Applications, licenses, installations. |
| 3 | Enterprise | Enterprise solutions (VPN, Active Dir). |
| 4 | SharedAccess | Shared accounts or resource permissions. |
| 5 | IrbySystems | Internal Irby system integrations. |
public enum RequestOptionType
{
Hardware = 1,
Software = 2,
Enterprise = 3,
SharedAccess = 4,
IrbySystems = 5
}
🧪 Sample Code & Usage Examples
1. Retrieving Display Names
To show friendly names in UI or logs, you can write an extension method:
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
public static class EnumExtensions
{
public static string GetDisplayName<T>(this T enumValue) where T : Enum
{
var memberInfo = typeof(T)
.GetMember(enumValue.ToString())
.FirstOrDefault();
var displayAttribute = memberInfo?
.GetCustomAttribute<DisplayAttribute>();
return displayAttribute?.GetName() ?? enumValue.ToString();
}
}
Usage:
var status = TicketStatus.InProgress;
Console.WriteLine(status.GetDisplayName()); // Output: "In Progress"
2. Populating a Dropdown in Razor
@using IrbyImaging.Utility
@model YourViewModel
<select asp-for="SelectedStatus" class="form-control">
@foreach (TicketStatus ts in Enum.GetValues(typeof(TicketStatus)))
{
<option value="@(int)ts">
@ts.GetDisplayName()
</option>
}
</select>
3. Switch‑Case Example
public void HandleTicket(TicketStatus status)
{
switch (status)
{
case TicketStatus.Open:
AssignToQueue();
break;
case TicketStatus.InProgress:
UpdateTimer();
break;
case TicketStatus.Closed:
ArchiveTicket();
break;
case TicketStatus.Cancelled:
NotifyRequester("Your ticket has been cancelled.");
break;
case TicketStatus.WaitingForApproval:
SendApprovalReminder();
break;
default:
throw new ArgumentOutOfRangeException(nameof(status));
}
}
🧩 UML Diagram
classDiagram
enum TicketStatus {
Open = 1
InProgress = 2
Closed = 3
Cancelled = 4
WaitingForApproval = 5
}
enum TicketPriority {
Low = 1
Normal = 2
High = 3
}
enum TicketType {
Incident = 1
Request = 2
}
enum RequestOptionType {
Hardware = 1
Software = 2
Enterprise = 3
SharedAccess = 4
IrbySystems = 5
}
🏁 Conclusion
- Enumerations.cs centralizes all ticket/request‑related constants, improving maintainability and type safety.
- Utilizing
[Display]attributes ensures UIs and reports show human‑friendly labels. - Sample extensions and UI snippets demonstrate how effortlessly these enums integrate into .NET applications.
By following these patterns, your ticketing and request modules remain consistent, readable, and robust. 🎉