//search export log private void SearchLogs(int startIndex = 0) { if (!ValidationHelper.ValidateDateRange(BeginExportDate, EndExportDate)) return; if (startIndex == 0) this.KeyLogCollection = null; ExportLogSearchCriteria logSearch = new ExportLogSearchCriteria(); List<KeyExportLog> logList = new List<KeyExportLog>(); string reExportType = string.Empty; switch (this.exportType) { case Constants.ExportType.ReFulfilledKeys: reExportType = Constants.ExportType.FulfilledKeys.ToString(); break; case Constants.ExportType.ReReportKeys: reExportType = Constants.ExportType.ReportKeys.ToString(); break; case Constants.ExportType.ReCBR: reExportType = Constants.ExportType.CBR.ToString(); break; case Constants.ExportType.ReToolKeys: reExportType = Constants.ExportType.ToolKeys.ToString(); break; case Constants.ExportType.ReDuplicateCBR: reExportType = Constants.ExportType.DuplicateCBR.ToString(); break; case Constants.ExportType.ReReturnKeys: reExportType = Constants.ExportType.ReturnKeys.ToString(); break; default: break; } logSearch.StartIndex = startIndex; if (!string.IsNullOrEmpty(sortColumnLog)) { logSearch.SortBy = sortColumnLog; logSearch.SortByDesc = isDescLog; } logSearch.ExportTypes = new List<string>() { reExportType }; logSearch.PageSize = KmtConstants.DefaultPageSize; logSearch.PageSize = 15; logSearch.DateFrom = BeginExportDate; logSearch.DateTo = EndExportDate.Value.Date.AddDays(1).AddSeconds(-1); logSearch.ExportTo = SearchLogExportTo; logSearch.FileName = SearchLogFileName; logList = base.keyProxy.SearchExportLogs(logSearch); if (this.KeyLogCollection == null) this.KeyLogCollection = new ObservableCollection<KeyExportLogModel>(); if (logList != null && logList.Count > 0) { foreach (var key in logList) { if (this.exportType == Constants.ExportType.ReToolKeys || this.exportType == Constants.ExportType.ReCBR) key.IsEncrypted = false; if (!this.KeyLogCollection.Any(k => k.keyExportLog.ExportLogId == key.ExportLogId)) this.KeyLogCollection.Add(new KeyExportLogModel() { keyExportLog = key }); } } RaisePropertyChanged("KeyLogCollection"); }
public PagedList<KeyExportLog> SearchExportLogs(ExportLogSearchCriteria criteria) { return miscRepository.SearchExportLogs(criteria); }
public List<KeyExportLog> SearchExportLogs(ExportLogSearchCriteria exportLogSearchCriteria) { return miscRepository.SearchExportLogs(exportLogSearchCriteria); }
public PagedList<KeyExportLog> SearchExportLogs(ExportLogSearchCriteria criteria) { using (var context = GetContext()) { var query = context.KeyExportLogs.Where(log => log.ExportLogId >= 0); if (criteria != null) { if (criteria.DateFrom != null) query = query.Where(k => k.CreateDate >= criteria.DateFrom); if (criteria.DateTo != null) query = query.Where(k => k.CreateDate <= criteria.DateTo); if (!string.IsNullOrEmpty(criteria.ExportTo)) query = query.Where(k => k.ExportTo.Contains(criteria.ExportTo)); if (criteria.ExportTypes != null && criteria.ExportTypes.Count() > 0) query = query.Where(k => criteria.ExportTypes.Contains(k.ExportType)); if (!string.IsNullOrEmpty(criteria.CreateBy)) query = query.Where(k => k.CreateBy == criteria.CreateBy); if (criteria.IsEncrypted != null && criteria.IsEncrypted.HasValue) query = query.Where(k => k.IsEncrypted == criteria.IsEncrypted); if (!string.IsNullOrEmpty(criteria.FileName)) query = query.Where(k => k.FileName.Contains(criteria.FileName)); query = query.SortBy(criteria.SortBy, criteria.SortByDesc); } PagedList<int> logIds = new PagedList<int>(query.Select(l => l.ExportLogId), criteria.StartIndex, criteria.PageSize); Dictionary<int, KeyExportLog> dic = context.KeyExportLogs .Where(l => logIds.Contains(l.ExportLogId)).ToDictionary(l => l.ExportLogId, l => l); return logIds.Transform(id => dic[id]); } }