Helpful error message on import
This commit is contained in:
+11
-3
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user