46dfaba731
Improve matching
46 lines
1.4 KiB
C#
46 lines
1.4 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace MileageTraker.Web.ViewModels.Log
|
|
{
|
|
public class LogResultsViewModel
|
|
{
|
|
public IEnumerable<LogIndexViewModel> Logs { get; set; }
|
|
public Dictionary<string, List<string>> AvailableYearMonths { get; set; }
|
|
public IEnumerable<string> SelectedYearMonths{get
|
|
{
|
|
if (!string.IsNullOrEmpty(Year))
|
|
return AvailableYearMonths[Year];
|
|
return new List<string>();
|
|
}}
|
|
|
|
// filter parameters
|
|
public string Year { get; set; }
|
|
public string Month { get; set; }
|
|
public string MonthRange { get; set; }
|
|
public string LogType { get; set; }
|
|
public string VehicleId { get; set; }
|
|
public string EmployeeName { get; set; }
|
|
|
|
public LogResultsViewModel(IEnumerable<LogIndexViewModel> logs, LogQueryViewModel query, Dictionary<string, List<string>> availableYearMonths)
|
|
{
|
|
Logs = logs;
|
|
AvailableYearMonths = availableYearMonths;
|
|
Year = query.Year.HasValue ? query.Year.Value.ToString() : string.Empty;
|
|
Month = query.Month.HasValue ? query.Month.Value.ToString() : string.Empty;
|
|
MonthRange = query.MonthRange.HasValue ? query.MonthRange.Value.ToString() : string.Empty;
|
|
LogType = query.LogType.ToString();
|
|
EmployeeName = query.EmployeeName;
|
|
VehicleId = query.VehicleId;
|
|
}
|
|
|
|
public bool SecondRowSet
|
|
{
|
|
get
|
|
{
|
|
return !string.IsNullOrEmpty(LogType) ||
|
|
!string.IsNullOrEmpty(VehicleId) ||
|
|
!string.IsNullOrEmpty(EmployeeName);
|
|
}
|
|
}
|
|
}
|
|
} |