Helpful error message on import

This commit is contained in:
2016-01-21 14:14:29 -05:00
parent 42f0c12249
commit d92ccb1f02
+11 -3
View File
@@ -60,8 +60,11 @@ namespace MileageTraker.Web.DAL
return dateTimeValue.ToShortDateString(); return dateTimeValue.ToShortDateString();
}; };
var logImportViewModel = ImportLogViewModel logImportViewModel;
new ImportLogViewModel
try
{
logImportViewModel = new ImportLogViewModel
{ {
CityName = getRowValue("Destination City"), CityName = getRowValue("Destination City"),
Date = getRowDateValue("Date"), Date = getRowDateValue("Date"),
@@ -72,8 +75,13 @@ namespace MileageTraker.Web.DAL
Purpose = getRowValue("Purpose"), Purpose = getRowValue("Purpose"),
VehicleId = getRowValue("Vehicle ID") VehicleId = getRowValue("Vehicle ID")
}; };
}
catch (Exception ex)
{
throw new ImportException(ex.Message + " on row " + (r + 1));
}
yield return logImportViewModel; yield return logImportViewModel;
} }
} }
private static IDictionary<string, int> GetColumnIndex(Row headerRow, int columnCount) private static IDictionary<string, int> GetColumnIndex(Row headerRow, int columnCount)