Update existing reports, removing mileage drill down
This commit is contained in:
+26
-22
@@ -38,7 +38,8 @@ namespace MileageTraker.Web.Utility
|
||||
{
|
||||
return
|
||||
typeof (T).GetProperties()
|
||||
.Where(p => !p.PropertyType.IsCollection())
|
||||
.Where(p => !p.PropertyType.IsNonStringEnumerable())
|
||||
.Where(p => !p.IsHiddenFromModel())
|
||||
.Where(p => !p.Name.Contains("PreviousLog"))
|
||||
.ToList();
|
||||
}
|
||||
@@ -92,36 +93,39 @@ namespace MileageTraker.Web.Utility
|
||||
(item, r) =>
|
||||
GetProperties().Zip(CustomExtensions.GetNumbers().Skip(startCol),
|
||||
(p, c) => {
|
||||
var value = p.GetValue(item);
|
||||
var value = p.GetValue(item);
|
||||
|
||||
string formatString = null;
|
||||
string formatString = null;
|
||||
|
||||
if (value is decimal) // assume that it's currency
|
||||
formatString = "#,##0.00";
|
||||
if (value is decimal) // assume that it's currency
|
||||
formatString = "#,##0.00";
|
||||
|
||||
if (value is DateTime && p.Name == "Date")
|
||||
formatString = @"MM/DD/YYYY";
|
||||
else if (value is DateTime)
|
||||
formatString = @"MM/DD/YYYY hh:mm:ss";
|
||||
if (value is DateTime && p.Name.Contains("Date"))
|
||||
formatString = @"MM/DD/YYYY";
|
||||
else if (value is DateTime)
|
||||
formatString = @"MM/DD/YYYY hh:mm:ss";
|
||||
|
||||
if (p.Name == "GasPurchased") // format to the .000 place
|
||||
formatString = "#,##0.000";
|
||||
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))
|
||||
value = intValue;
|
||||
int intValue; // write int-looking values as numbers
|
||||
if (value is string && int.TryParse((string) value, out intValue))
|
||||
value = intValue;
|
||||
|
||||
double doubleValue; // write double-looking values as numbers
|
||||
if (value is string && double.TryParse((string) value, out doubleValue))
|
||||
value = doubleValue;
|
||||
double doubleValue; // write double-looking values as numbers
|
||||
if (value is string && double.TryParse((string) value, out doubleValue))
|
||||
value = doubleValue;
|
||||
|
||||
if (value is MileageLogTypeWrapper)
|
||||
value = ((MileageLogTypeWrapper) value).Enum.GetDisplayName();
|
||||
if (value is MileageLogTypeWrapper)
|
||||
value = ((MileageLogTypeWrapper) value).Enum.GetDisplayName();
|
||||
|
||||
var cell = formatString != null ? new Cell(value, formatString) : new Cell(value);
|
||||
worksheet.Cells[r, c] = cell;
|
||||
if (value == null)
|
||||
value = p.GetNullDisplayText(item);
|
||||
|
||||
return (string) null;
|
||||
var cell = formatString != null ? new Cell(value, formatString) : new Cell(value);
|
||||
worksheet.Cells[r, c] = cell;
|
||||
|
||||
return (string) null;
|
||||
}).ToList()).ToList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user