📄 IrbyImaging/Views/Billing/Dashboard.cshtml Documentation
Table of Contents
- Overview & Purpose
- Dependencies & Technologies
- View Model & Data Sources
- Key Functional Areas
- Usage & Data Binding
- Sample Controller Snippet
- UML Diagram (High-Level View)
- Error Handling & Validation
- Conclusion
1. Overview & Purpose
Dashboard.cshtml is a Razor view in the IrbyImaging ASP.NET MVC application under /Views/Billing/. It visualizes billing and device–usage trends for carriers (AT&T & Verizon) using Syncfusion EJ2 charts.
🎯 Intended Use:
- Display billing trends by carrier over months.
- Show current–month billing breakdown by job for each carrier.
- Illustrate device counts by carrier over time.
2. Dependencies & Technologies
| Technology / Library | Purpose |
|---|---|
ASP.NET MVC Razor (.cshtml) |
Server–side templating |
| Syncfusion EJ2 Charts | Interactive JavaScript charts & visuals |
| ViewBag / ViewData | Data transfer from Controller to View |
| Bootstrap (assumed) | Grid layout (.row, .col-lg-*) |
@using Syncfusion.JavaScript
@using Syncfusion.JavaScript.Models
@using Syncfusion.EJ2
3. View Model & Data Sources
@model IrbyImaging.UI.Models.Billing
- Model:
IrbyImaging.UI.Models.Billing(should encapsulate billing data if strongly typed). - ViewBag properties used:
dataSource1→ Billing by Verizon (column + line)dataSource2→ Billing by AT&TdataSource7→ Total billing combineddataSource3,dataSource4→ Current month breakdown for Verizon / AT&TdataSource5,dataSource6→ Device counts for AT&T / Verizon
Each data source should be an IEnumerable<T> or JSON array of objects with properties:
YearMonth(string/category)Charge(decimal)Devices(int)Carrier(optional for tooltip)
4. Key Functional Areas
4.1 Billing Trend by Carrier (Combined Column & Line Chart) 📊
<ejs-chart id="lineContainer" title="Billing Trend By Carrier">
<!-- Tooltip & Legend -->
<e-chart-tooltipsettings enable="true" shared="true" ... />
<e-chart-legendsettings visible="true" enableHighlight="true" />
<!-- Axes Configuration -->
<e-chart-primaryxaxis valueType="Category" interval="1" ... />
<e-chart-primaryyaxis title="Total Charge" maximum="200000" interval="20000" />
<!-- Data Series -->
<e-series-collection>
<!-- Columns for Verizon, AT&T, Total -->
<e-series dataSource="ViewBag.dataSource1" ... type="Column" name="Verizon" />
<e-series dataSource="ViewBag.dataSource2" ... type="Column" name="AT&T" />
<e-series dataSource="ViewBag.dataSource7" ... type="Column" name="Total" />
<!-- Lines for Verizon, AT&T, Total -->
<e-series dataSource="ViewBag.dataSource1" ... type="Line" />
<e-series dataSource="ViewBag.dataSource2" ... type="Line" />
<e-series dataSource="ViewBag.dataSource7" ... type="Line" />
</e-series-collection>
</ejs-chart>
| Chart Element | Description |
|---|---|
<ejs-chart> |
Container for combination chart |
<e-series type="Column"> |
Displays monthly charges as columns |
<e-series type="Line"> |
Shows trends via line on top of columns |
4.2 Current Month Billing Trend by Job (Pie Charts) 🥧
Two side–by–side pie charts:
| Chart ID | Title | DataSource |
|---|---|---|
container |
Current Month Billing Trend By Job - AT&T | ViewBag.dataSource4 |
container1 |
Current Month Billing Trend By Job - Verizon | ViewBag.dataSource3 |
<ejs-accumulationchart id="container" title="Current Month Billing Trend By Job - AT&T">
<e-accumulation-series-collection>
<e-accumulation-series dataSource="ViewBag.dataSource4" xName="YearMonth" yName="Charge" ...>
<!-- Data labels outside with curved connectors -->
</e-accumulation-series>
</e-accumulation-series-collection>
</ejs-accumulationchart>
4.3 Devices by Month (Combined Column & Line Charts) 📈
Two panels for device counts:
| Chart ID | Title | Column Series DataSource | Line Series DataSource |
|---|---|---|---|
lineContainer2 |
Devices By Month - AT&T | ViewBag.dataSource5 |
ViewBag.dataSource5 |
lineContainer3 |
Devices By Month - Verizon | ViewBag.dataSource6 |
ViewBag.dataSource6 |
Configuration mirrors the Billing Trend chart but Y–axis shows Device Count (max=3000, interval=250).
5. Usage & Data Binding
-
Controller Action
- Fetch billing & device data from your service/repository.
- Populate
ViewBagwith the six arrays needed. - Return
View(model).
-
Razor View
- Reference Syncfusion scripts & styles in your
_ATSLayout.cshtml. - Render charts as shown.
- Reference Syncfusion scripts & styles in your
5.1 Passing Data from Controller
public ActionResult Dashboard()
{
var model = new BillingViewModel();
// e.g. model.DataByVerizon = billingService.GetByCarrier("Verizon");
ViewBag.dataSource1 = model.DataByVerizon;
ViewBag.dataSource2 = model.DataByATnT;
ViewBag.dataSource7 = model.DataTotal;
ViewBag.dataSource3 = model.CurrentVerizonJobs;
ViewBag.dataSource4 = model.CurrentATnTJobs;
ViewBag.dataSource5 = model.DevicesByATnT;
ViewBag.dataSource6 = model.DevicesByVerizon;
return View(model);
}
6. Sample Controller Snippet
using IrbyImaging.UI.Models;
public class BillingController : Controller
{
public ActionResult Dashboard()
{
BillingViewModel vm = BillingRepo.GetDashboardData();
ViewBag.dataSource1 = vm.VerizonBillingMonthly;
ViewBag.dataSource2 = vm.ATnTBillingMonthly;
ViewBag.dataSource7 = vm.TotalBillingMonthly;
ViewBag.dataSource3 = vm.VerizonJobsCurrentMonth;
ViewBag.dataSource4 = vm.ATnTJobsCurrentMonth;
ViewBag.dataSource5 = vm.ATnTDevicesMonthly;
ViewBag.dataSource6 = vm.VerizonDevicesMonthly;
return View("Dashboard", vm);
}
}
7. UML Diagram (High-Level View)
@startuml
class BillingController {
+Dashboard() : ActionResult
}
class BillingViewModel {
-VerizonBillingMonthly : List<DataPoint>
-ATnTBillingMonthly : List<DataPoint>
-TotalBillingMonthly : List<DataPoint>
-VerizonJobsCurrentMonth : List<DataPoint>
-ATnTJobsCurrentMonth : List<DataPoint>
-ATnTDevicesMonthly : List<DataPoint>
-VerizonDevicesMonthly : List<DataPoint>
}
class Dashboard.cshtml <<View>> {
+RenderCharts()
}
BillingController --> BillingViewModel
BillingController --> Dashboard.cshtml
Dashboard.cshtml ..> Syncfusion.EJ2.Charts
@enduml
8. Error Handling & Validation
- Null DataSources: Ensure each
ViewBag.dataSourceXis non–null. - Empty Collections: Syncfusion charts render gracefully but may hide axes—consider fallback message:
@if (ViewBag.dataSource1 == null || !((IEnumerable)ViewBag.dataSource1).Cast<object>().Any()) { <div class="alert alert-info">No billing data available.</div> } else { <!-- render chart --> } - Script References: Verify Syncfusion scripts/styles are loaded in your layout.
9. Conclusion
🎉 Dashboard.cshtml delivers an interactive billing dashboard using Syncfusion EJ2. It supports:
- Combined Column & Line charts for trend analysis
- Pie charts for job–based breakdowns
- Responsive layout with Bootstrap
By following the patterns above—populating ViewBag, configuring chart tags—you can extend or customize to other carriers, metrics, or time–frames. Enjoy crafting rich data visuals! 🚀