Vehicle Recall integrated into Vehicle Service

This commit is contained in:
2020-09-30 21:44:38 -04:00
parent 6f031c5cb6
commit 4b44128d62
18 changed files with 236 additions and 126 deletions
+12 -7
View File
@@ -5,6 +5,7 @@ using System.Linq;
using System.Reflection;
using ExcelLibrary.SpreadSheet;
using MileageTraker.Web.Models;
using MileageTraker.Web.ViewModels;
namespace MileageTraker.Web.Utility
{
@@ -108,21 +109,25 @@ namespace MileageTraker.Web.Utility
if (p.Name == "GasPurchased") // format to the .000 place
formatString = "#,##0.000";
int intValue; // write int-looking values as numbers
if (value is string && int.TryParse((string) value, out intValue))
if (value is string valInt && int.TryParse(valInt, out var intValue))
value = intValue;
double doubleValue; // write double-looking values as numbers
if (value is string && double.TryParse((string) value, out doubleValue))
if (value is string valDbl && double.TryParse(valDbl, out var doubleValue))
value = doubleValue;
if (value is MileageLogTypeWrapper)
value = ((MileageLogTypeWrapper) value).Enum.GetDisplayName();
if (value is MileageLogTypeWrapper valMt)
value = valMt.Enum.GetDisplayName();
if (value is SelectListViewModel valSelList)
value = valSelList.ToString();
if (value == null)
value = p.GetNullDisplayText(item);
var cell = formatString != null ? new Cell(value, formatString) : new Cell(value);
var cell =
formatString != null
? new Cell(value, formatString)
: new Cell(value);
worksheet.Cells[r, c] = cell;
return (string) null;