📄 RequestOptionViewModel Documentation
📑 Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- Key Functional Areas
- Class Structure & Properties
- Usage Examples
- UML Diagram
- Conclusion
1. 🔍 Overview & Purpose
The RequestOptionViewModel is a View Model in the IrbyImaging.UI assembly designed to represent a single configurable option in an imaging request form or wizard. It encapsulates all data needed to display, track, and process one “option” the user may choose (e.g., contrast, filters, additional analyses).
Use cases include:
- Displaying a list of request options in a UI grid or list.
- Tracking user selections, costs, and approval workflow states.
- Binding form controls to strongly‑typed properties in MVVM frameworks (WPF, Xamarin.Forms, Blazor, etc.).
2. ⚙️ Dependencies & Technologies
| Technology / Library | Purpose |
|---|---|
| .NET 6+ / .NET Standard | Target runtime / compatibility |
| C# / MVVM Pattern | Language and architectural pattern |
| IrbyImaging.Utility | Contains RequestOptionType enum |
Note: The
RequestOptionTypeenum defines the category or kind of each option (e.g., ImagingMode, Enhancement, Delivery method).
3. 🛠 Key Functional Areas
- Indexing
- Provides an
Indexproperty to display or order items.
- Provides an
- Identification & Categorization
Typeproperty holds the enum value fromRequestOptionType.Itemis a human‑readable name/description.
- Cost Tracking
Cost(string) can display currency, “Free”, or custom text.
- Completion State
IsCompletedflags whether user has configured this option.
- Approval Workflow
ApprovalRequiredtoggles requirement for managerial/departmental review.ApprovalDepartmentnames the group responsible for approval.HasApprovalDecisionindicates if an approval record exists.IsApprovedis the decision itself (true = approved).ApprovalMessagecarries comments/feedback.
4. 📐 Class Structure & Properties
using IrbyImaging.Utility;
namespace IrbyImaging.ViewModels
{
/// <summary>
/// View model representing a single configurable request option.
/// </summary>
public class RequestOptionViewModel
{
public int Index { get; set; }
public RequestOptionType Type { get; set; }
public string Item { get; set; }
public string Cost { get; set; }
public bool IsCompleted { get; set; }
// Approval workflow fields
public bool ApprovalRequired { get; set; }
public string ApprovalDepartment { get; set; }
public bool HasApprovalDecision { get; set; }
public bool IsApproved { get; set; }
public string ApprovalMessage { get; set; }
}
}
📝 Property Reference
| Property | Type | Description |
|---|---|---|
| Index | int |
Sequence number or sort order. |
| Type | RequestOptionType |
Category / enumeration defined in IrbyImaging.Utility. |
| Item | string |
Display name or description of this option. |
| Cost | string |
Formatted cost or price text (e.g., $50, Free). |
| IsCompleted | bool |
Indicates if the user has finished configuring this option. |
| ApprovalRequired | bool |
Indicates whether approval is needed for this option. |
| ApprovalDepartment | string |
Department or team responsible for approving the request. |
| HasApprovalDecision | bool |
True if an approval or rejection decision has been made. |
| IsApproved | bool |
Result of the approval (true = approved, false = rejected). |
| ApprovalMessage | string |
Comments or reasons attached to the approval/rejection decision. |
5. 🚀 Usage Examples
5.1 Instantiating & Populating a Single Option
var option = new RequestOptionViewModel
{
Index = 1,
Type = RequestOptionType.ImagingMode,
Item = "Contrast Enhancement",
Cost = "$25",
IsCompleted = false,
ApprovalRequired = true,
ApprovalDepartment = "Radiology",
HasApprovalDecision = false,
IsApproved = false,
ApprovalMessage = string.Empty
};
5.2 Binding to a WPF DataGrid
<DataGrid ItemsSource="{Binding RequestOptions}">
<DataGrid.Columns>
<DataGridTextColumn Header="#" Binding="{Binding Index}" />
<DataGridTextColumn Header="Option" Binding="{Binding Item}" />
<DataGridTextColumn Header="Cost" Binding="{Binding Cost}" />
<DataGridCheckBoxColumn Header="Done?" Binding="{Binding IsCompleted}" />
<DataGridCheckBoxColumn Header="Approved" Binding="{Binding IsApproved}" />
</DataGrid.Columns>
</DataGrid>
5.3 Filtering for Approval Required
var pendingApprovals = allOptions
.Where(o => o.ApprovalRequired && !o.HasApprovalDecision)
.ToList();
6. 📊 UML Diagram
classDiagram
class RequestOptionViewModel {
+int Index
+RequestOptionType Type
+string Item
+string Cost
+bool IsCompleted
+bool ApprovalRequired
+string ApprovalDepartment
+bool HasApprovalDecision
+bool IsApproved
+string ApprovalMessage
}
7. 🏁 Conclusion
The RequestOptionViewModel is a lightweight, single‐responsibility class that cleanly packages all the data needed for representing a configurable imaging request option. With built‑in support for cost display, completion tracking, and multi‐step approval workflows, it integrates seamlessly into MVVM-based UI layers.
Key takeaways
- ✅ Extensible: Add properties if your workflow grows (e.g., due dates, attachments).
- ✅ Bindable: Designed for popular MVVM frameworks (WPF, Xamarin.Forms, Blazor).
- ✅ Self‑Descriptive: Clear property names and XML documentation for maintainability.
Use this ViewModel wherever you need to present, edit, and process imaging request options in your UI! 🎉