Example #1
0
        public void Search()
        {
            var predicates = new SearchCretia();

            if (_screen.MatchLicenseNumber)
            {
                predicates.AddCretia(dto => dto.LicensePlateNumber.ToUpper().Contains(_screen.LicenseNumber.ToUpper()));
            }

            if (_screen.MatchTimeRange)
            {
                var range = _screen.Range;
                predicates.AddCretia(dto => dto.CaptureTime >= range.From && dto.CaptureTime <= range.To);
            }

            var searcher = Task.Factory.StartNew(() =>
            {
                _screen.IsBusy = true;
                try
                {
                    var query = _repository.GetLicensePlates(predicates);
                    _screen.Clear();
                    foreach (var licensePlateInfo in query)
                    {
                        _screen.AddLicensePlateInfo(licensePlateInfo);
                    }
                }
                finally
                {
                    _screen.IsBusy = false;
                }
            });

            searcher.ContinueWith(ant =>
            {
                var ignore = ant.Exception;
                _messageBoxService.ShowError("搜索车牌的过程中发生错误,错误信息已经被记录在系统日志中,请联系技术支持。");
            },
                                  TaskContinuationOptions.OnlyOnFaulted);
        }
        public void Search()
        {
            var predicates = new SearchCretia();

            if (_screen.MatchLicenseNumber)
            {
                predicates.AddCretia(dto => dto.LicensePlateNumber.ToUpper().Contains(_screen.LicenseNumber.ToUpper()));
            }

            if (_screen.MatchTimeRange)
            {
                var range = _screen.Range;
                predicates.AddCretia(dto => dto.CaptureTime >= range.From && dto.CaptureTime <= range.To);
            }

            var searcher = Task.Factory.StartNew(() =>
                                                             {
                                                                 _screen.IsBusy = true;
                                                                 try
                                                                 {
                                                                     var query = _repository.GetLicensePlates(predicates);
                                                                     _screen.Clear();
                                                                     foreach (var licensePlateInfo in query)
                                                                     {
                                                                         _screen.AddLicensePlateInfo(licensePlateInfo);
                                                                     }
                                                                 }
                                                                 finally
                                                                 {
                                                                     _screen.IsBusy = false;
                                                                 }
                                                             });

            searcher.ContinueWith(ant =>
                                      {
                                          var ignore = ant.Exception;
                                          _messageBoxService.ShowError("搜索车牌的过程中发生错误,错误信息已经被记录在系统日志中,请联系技术支持。");
                                      },
                TaskContinuationOptions.OnlyOnFaulted);
        }
 private SearchCretia GetLicensePlateQueryCretia(DateTimeRange range)
 {
     var cretia = new SearchCretia();
     cretia.AddCretia(lpi => lpi.CaptureTime >= range.From && lpi.CaptureTime <= range.To);
     return cretia;
 }
 public IEnumerable<LicensePlateInfo> GetLicensePlates(SearchCretia searchCretia)
 {
     var dtos = _dataProvider.GetLicensePlates(searchCretia.MatchWith);
     return dtos.Select(dto => _mapper.ToBusinessObject(dto));
 }
Example #5
0
        public IEnumerable <LicensePlateInfo> GetLicensePlates(SearchCretia searchCretia)
        {
            var dtos = _dataProvider.GetLicensePlates(searchCretia.MatchWith);

            return(dtos.Select(dto => _mapper.ToBusinessObject(dto)));
        }