Vehicle Recall integrated into Vehicle Service
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user