📄 IrbyImaging.DomainClasses/Ticket.cs Documentation
Welcome to the comprehensive documentation for the Ticket domain class in the IrbyImaging system. This file defines the core data model for a support/imaging ticket and maps it to the database via Entity Framework Core.
📑 Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Data Model: Ticket
3.1 Table Mapping
3.2 Properties Reference - Relationships
- Enumerations
- Sample Code Usage
- UML Class Diagram
- Conclusion
1. Overview & Purpose 🚀
The Ticket class represents a support/imaging ticket in the IrbyImaging system. It encapsulates all relevant information about a customer request, including identification, contact details, description, attachments, status, and audit metadata.
- Intended Use: Store, retrieve, and manipulate ticket data via Entity Framework Core (EF Core) in a code‑first approach.
- Key Responsibilities:
- Unique identification of each ticket
- Logging customer information and request details
- Tracking lifecycle status and type
- Holding binary image data and a history of updates
2. Dependencies & Technologies 🧩
| Aspect | Details |
|---|---|
| Language | C# (.NET 6.0+) |
| ORM | Entity Framework Core (code‑first) |
| Namespace Imports | System, System.Collections.Generic, |
System.ComponentModel.DataAnnotations, |
|
System.ComponentModel.DataAnnotations.Schema, |
|
IrbyImaging.Utility (for enums) |
|
| Assembly | IrbyImaging.DomainClasses |
| Database Schema | irby (via [Table("Ticket", Schema = "irby")]) |
3. Data Model: Ticket 💾
3.1 Table Mapping
[Table("Ticket", Schema = "irby")]
public class Ticket
{
// ...
}
- Table Name:
Ticket - Schema:
irby - Primary Key:
Id(annotated with[Key])
3.2 Properties Reference
| Property | Type | Description |
|---|---|---|
| Id | Guid |
Unique identifier for the ticket (PK). |
| TicketNumber | int |
Human‑readable ticket number. |
| CustomerName | string |
Full name of the customer who created the ticket. |
| CustomerUsername | string |
System username or login of the customer. |
| ResponseEmail | string |
Email address where responses should be sent. |
| CallBackNumber | string |
Preferred phone number for callbacks. |
| CreatedOn | DateTime |
Timestamp when the ticket was created. |
| CreatedBy | string |
Username or identifier of the user who originally created the ticket. |
| Description | string |
Detailed description of the request or issue. |
| RequestedJson | string |
Any JSON payload or structured data associated with the request. |
| EmployeeAndJobDetails | string |
Additional info about employees or jobs related to the ticket. |
| ShippingAddress | string |
Address to ship any required physical items. |
| UserApproved | bool |
Indicates if the end‑user has approved the request. |
| Status | TicketStatus |
Current status of the ticket (e.g., New, InProgress, Closed). |
| Type | TicketType |
Category/type of the ticket (e.g., ServiceRequest, BugReport). |
| ImageContents | byte[] |
Binary contents of any attached image. |
| Updates | ICollection<Update> |
Collection of related updates/comments (1‑to‑many relationship). |
| ReviewAfter | bool |
Flag to indicate requirement for follow‑up review. |
| ReviewAfterDate | DateTime? |
Optional date/time for scheduled review. |
| ReviewReason | string |
Reason or notes for the follow‑up review. |
🔧 Commented‑out fields in the code indicate placeholders for future extensions (e.g.,
RequestDetails,AccountType, etc.).
4. Relationships 🔗
- One-to-Many: A single
Ticketcan have multipleUpdaterecords.public ICollection<Update> Updates { get; set; } - Enums:
TicketStatusTicketType
(both defined inIrbyImaging.Utility)
5. Enumerations ⚙️
Although not defined in this file, the following enums are crucial to ticket workflow:
public enum TicketStatus
{
New,
InProgress,
OnHold,
Completed,
Cancelled
}
public enum TicketType
{
ServiceRequest,
Incident,
ChangeRequest,
BugReport
}
📦 Note: Actual enum values may vary—refer to IrbyImaging.Utility for the definitive list.
6. Sample Code Usage ✨
6.1 Creating & Saving a Ticket
using (var context = new IrbyImagingContext())
{
var ticket = new Ticket
{
Id = Guid.NewGuid(),
TicketNumber = 1001,
CustomerName = "Jane Doe",
CustomerUsername = "jdoe",
ResponseEmail = "[email protected]",
CallBackNumber = "555-1234",
CreatedOn = DateTime.UtcNow,
CreatedBy = "system",
Description = "Request for imaging support",
UserApproved = false,
Status = TicketStatus.New,
Type = TicketType.ServiceRequest,
ImageContents = File.ReadAllBytes("screenshot.png"),
ReviewAfter = false
};
context.Tickets.Add(ticket);
context.SaveChanges();
Console.WriteLine($"Ticket #{ticket.TicketNumber} created with ID {ticket.Id}");
}
6.2 Querying Tickets by Status
var openTickets = context.Tickets
.Where(t => t.Status == TicketStatus.InProgress)
.OrderBy(t => t.CreatedOn)
.ToList();
7. UML Class Diagram 📊
classDiagram
class Ticket {
+Guid Id
+int TicketNumber
+string CustomerName
+string CustomerUsername
+string ResponseEmail
+string CallBackNumber
+DateTime CreatedOn
+string CreatedBy
+string Description
+string RequestedJson
+string EmployeeAndJobDetails
+string ShippingAddress
+bool UserApproved
+TicketStatus Status
+TicketType Type
+byte[] ImageContents
+bool ReviewAfter
+DateTime? ReviewAfterDate
+string ReviewReason
}
class Update {
/* Definition in IrbyImaging.DomainClasses.Update */
}
Ticket "1" o-- "*" Update : has
8. Conclusion ✅
The Ticket class is the heartbeat of the IrbyImaging support system. It provides a rich, extensible data structure to capture all aspects of a customer request—from basic contact info and descriptions to complex workflow status and multimedia attachments.
By adhering to EF Core conventions and leveraging strongly‑typed enums, it ensures type safety, clear database mapping, and easy extensibility for future business requirements.
Feel free to reference this documentation as you integrate, extend, or troubleshoot ticket‑related functionality in the IrbyImaging platform. Happy coding! 🎉