Пример #1
0
        public bool SearchFilter()
        {
            _filteredLogs = _levelInput == Level.Empty &&
                            string.IsNullOrWhiteSpace(_id) && string.IsNullOrWhiteSpace(_dateInput) &&
                            string.IsNullOrWhiteSpace(_thread) && string.IsNullOrWhiteSpace(_message) &&
                            string.IsNullOrWhiteSpace(_searchBarInput) && string.IsNullOrWhiteSpace(_id) ? _logEntryRepository.GetAllLogs : null;

            _id       = !string.IsNullOrWhiteSpace(_searchBarInput) ? _searchBarInput : _id;
            _parsedId = _myServices.ParseInputToInt(_id);

            if (_filteredLogs == null)
            {
                _filteredLogs = string.IsNullOrWhiteSpace(_id) ? _logEntryRepository.AdvancedSearchFilter(_levelInput, _dateInput, _thread, _message) : null;
            }


            if (_filteredLogs == null)
            {
                _filteredLogs = _logEntryRepository.IsBiggerThenMaxId(_parsedId) || _parsedId == 0 ||
                                _logEntryRepository.GetLogbyId(_parsedId) == null ? _filteredLogs : _filteredLogs = _logEntryRepository.GetLogbyId(_parsedId);
            }

            if (_filteredLogs == null && !string.IsNullOrWhiteSpace(_searchBarInput))
            {
                _filteredLogs = _myServices.IsNumber(_searchBarInput) || !_myServices.IsLetters(_searchBarInput)
                    ? null : _logEntryRepository.GetLogByLevel(_myServices.FirstCharToUpper(_searchBarInput));
            }

            if (_filteredLogs == null)
            {
                return(false);
            }

            return(true);
        }