📋 OpenAndInProgressRequestViewModel Documentation


Table of Contents

  1. Overview & Purpose 🎯
  2. Dependencies & Technologies ⚙️
  3. Class Diagram (UML) 🧩
  4. Key Functional Areas 🔑
  5. Properties & Data Annotations 📝
  6. Usage in ASP.NET MVC / Web API 🚀
  7. Sample Code Blocks 📂
  8. Conclusion 🏁

1. Overview & Purpose 🎯

The OpenAndInProgressRequestViewModel is a plain‑old CLR object (POCO) used within the IrbyImaging UI layer to represent the data for "Open" and "In‑Progress" equipment/service requests. It encapsulates all the fields required by Razor views (or front‑end frameworks) when displaying or editing an existing request.

  • Namespace: IrbyImaging.ViewModels
  • Assembly: IrbyImaging.UI
  • Author: kvamshi
  • Created: 05‑17‑2022
  • Last Modified: 06‑24‑2022

📌 Note: This ViewModel carries only data. All business logic lives in services or repositories outside of this class.


2. Dependencies & Technologies ⚙️

Technology / Library Purpose
.NET / C# Language and framework
System.ComponentModel.DataAnnotations Declarative attributes for display & formatting

No external (third‑party) packages are referenced directly in this file. It leverages built‑in DataAnnotations to specify friendly display names and date formatting.


3. Class Diagram (UML) 🧩

classDiagram
    class OpenAndInProgressRequestViewModel {
        +Guid Id
        +string Name
        +string Username
        +string ServiceProvider
        +bool NeedsPhone
        +string PhoneCount
        +bool NeedsIpad
        +string TabletCount
        +bool NeedsComputer
        +string ComputerCount
        +bool NeedsMiFi
        +string MiFiCount
        +bool NeedsStarLink
        +string StarLinkCount
        +bool NeedsEnterprise
        +string EnterpriseCount
        +bool NeedsSoftware
        +string SoftwareCount
        +bool NeedsSharedAccess
        +string SharedAccessCount
        +bool NeedsIrbySystems
        +string IrbySystemsCount
        +DateTime RequestedDate
        +string SoftwareRequests
        +string EnterpriseRequests
        +string SharedAccessRequests
        +string IrbySystemsRequests
        +string JobNumber
        +string ShippingAddress
        +string RequestedBy
        +string Comments
        +bool ReviewAfter
        +DateTime? ReviewAfterDate
        +string ReviewReason
    }

4. Key Functional Areas 🔑

  1. Identification & Metadata
    • Id (GUID), Name, Username, ServiceProvider
  2. Device & Service Needs
    • Flags (NeedsPhone, NeedsIpad, ...)
    • Corresponding counts (PhoneCount, TabletCount, ...)
  3. Request Tracking
    • RequestedDate (with custom format)
    • JobNumber, RequestedBy, ShippingAddress
  4. Additional Details & Review
    • Free‑form Comments, service‑specific requests (SoftwareRequests, ...)
    • ReviewAfter flag, ReviewAfterDate, ReviewReason

5. Properties & Data Annotations 📝

Property Type Display Attribute Description
Id Guid — Unique identifier for the request.
Name string — Title or name of the request.
Username string — User who submitted the request.
ServiceProvider string [Display(Name="Service Provider")] Telecom or service provider.
NeedsPhone bool [Display(Name="Phone")] Indicates if phone is requested.
PhoneCount string — Number of phones requested.
NeedsIpad bool [Display(Name="Tablet")] Indicates if tablet is requested.
TabletCount string — Number of tablets requested.
NeedsComputer bool [Display(Name="Computer")] Indicates if computer is requested.
ComputerCount string — Number of computers requested.
NeedsMiFi bool [Display(Name="MiFi")] Indicates if mobile hotspot is requested.
MiFiCount string — Number of MiFis requested.
NeedsStarLink bool [Display(Name="StarLink")] Indicates if StarLink is requested.
StarLinkCount string — Number of StarLink units requested.
NeedsEnterprise bool [Display(Name="Enterprise")] Indicates if Enterprise software/hardware is needed.
EnterpriseCount string — Count for enterprise items.
NeedsSoftware bool [Display(Name="Software")] Indicates if additional software is requested.
SoftwareCount string — Software license count.
NeedsSharedAccess bool [Display(Name="Shared Access")] Shared access credential needed.
SharedAccessCount string — Number of shared access accounts.
NeedsIrbySystems bool [Display(Name="Irby Systems")] Access to Irby systems needed.
IrbySystemsCount string — Number of system accounts.
RequestedDate DateTime [DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")] Date when the request was made.
SoftwareRequests string — Details of software requested.
EnterpriseRequests string — Details of enterprise requests.
SharedAccessRequests string — Details of shared‑access requests.
IrbySystemsRequests string — Details of Irby‑Systems requests.
JobNumber string — Internal job/tracking number.
ShippingAddress string — Where equipment should be shipped.
RequestedBy string — Name of person requesting.
Comments string — Free‑form comments or notes.
ReviewAfter bool — Flag to indicate deferred review.
ReviewAfterDate DateTime? — Date to review after.
ReviewReason string — Reason for deferring or reviewing later.

6. Usage in ASP.NET MVC / Web API 🚀

Controller Action (ASP.NET Core MVC)

[HttpGet]
public IActionResult Details(Guid id)
{
    // 1. Retrieve domain entity from service/repository
    var domainRequest = _requestService.GetById(id);
    
    // 2. Map to ViewModel (AutoMapper or manual)
    var vm = Mapper.Map<OpenAndInProgressRequestViewModel>(domainRequest);
    
    // 3. Return View with populated ViewModel
    return View("RequestDetails", vm);
}

Razor View Snippet

@model IrbyImaging.ViewModels.OpenAndInProgressRequestViewModel

<h2>Request Details ‑ @Model.JobNumber</h2>
<p><strong>Requested By:</strong> @Model.RequestedBy on @Model.RequestedDate.ToString("MM/dd/yyyy")</p>

<ul>
    @if (Model.NeedsPhone)
    {
        <li>📱 Phone(s): @Model.PhoneCount</li>
    }
    @if (Model.NeedsIpad)
    {
        <li>📲 Tablet(s): @Model.TabletCount</li>
    }
    <!-- … repeat for other devices … -->
</ul>

<p><strong>Comments:</strong> @Model.Comments</p>

7. Sample Code Blocks 📂

Manual Instantiation

var model = new OpenAndInProgressRequestViewModel
{
    Id                = Guid.NewGuid(),
    Name              = "Field Technician Request",
    Username          = "jdoe",
    ServiceProvider   = "Verizon",
    NeedsPhone        = true,
    PhoneCount        = "2",
    NeedsComputer     = true,
    ComputerCount     = "1",
    RequestedDate     = DateTime.UtcNow,
    JobNumber         = "JOB‑12345",
    ShippingAddress   = "123 Main St, Anytown, USA",
    RequestedBy       = "John Doe",
    Comments          = "Please expedite.",
    ReviewAfter       = false
};

AutoMapper Configuration

public class RequestProfile : Profile
{
    public RequestProfile()
    {
        CreateMap<DomainRequest, OpenAndInProgressRequestViewModel>()
            .ForMember(dest => dest.ServiceProvider, opt => opt.MapFrom(src => src.ProviderName))
            // …other mappings…
            ;
    }
}

8. Conclusion 🏁

The OpenAndInProgressRequestViewModel is a comprehensive data container for rendering and editing requests in the IrbyImaging UI. By adhering to standard .NET DataAnnotations and a clear property naming convention, it ensures:

  • Consistent field labels across views
  • Strong typing for counts, flags, and metadata
  • Easy integration with model binding, validation, and mapping libraries

Use this ViewModel whenever you need to present or update an Open or In‑Progress request in your ASP.NET MVC/Web API applications.


✨ Happy coding! ✨