internal List <ExportSearchResult> GetExports(ExportsSearchCryteria exportsSearchCryteria) { using (LSIEntities context = new LSIEntities()) { var exports = context.Export.Select(r => r); if (!string.IsNullOrWhiteSpace(exportsSearchCryteria.ExportLocalName)) { exports = exports.Where(x => x.ExportLocalName.StartsWith(exportsSearchCryteria.ExportLocalName)); } if (exportsSearchCryteria.ExportDateFrom.HasValue) { exports = exports.Where(x => x.ExportDateTime >= exportsSearchCryteria.ExportDateFrom.Value); } if (exportsSearchCryteria.ExportDateTo.HasValue) { DateTime endOfday = exportsSearchCryteria.ExportDateTo.Value.AddDays(1); exports = exports.Where(x => x.ExportDateTime < endOfday); } return(exports.Select(x => new ExportSearchResult() { ExportId = x.ExportId, ExportDateTime = x.ExportDateTime, ExportLocalName = x.ExportLocalName, ExportUserName = x.ExportUserName, ExportName = x.ExportName }).ToList()); } }
public void Search(string exportLocalName, DateTime exportDateFrom, DateTime exportDateTo) { LoadStarted?.Invoke(); ExportsSearchCryteria searchCryteria = BuildCryteria(exportLocalName, exportDateFrom, exportDateTo); List <Export> result = Map(searchService.GetExports(searchCryteria)); LoadCompleted?.Invoke(); RefreshList?.Invoke(result); }
public List <ExportSearchResult> GetExports(ExportsSearchCryteria searchCryteria) { return(exportSearchRepo.GetExports(searchCryteria)); }