Esempio n. 1
0
        private void UpdateFilterRegex()
        {
            void ClearError()
            {
                if (_errors.Remove(nameof(FilterString)))
                {
                    ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(nameof(FilterString)));
                }
            }

            _processedFilter = FilterString.Trim();

            try
            {
                var options = RegexOptions.Compiled;
                var pattern = UseRegexFilter
                    ? _processedFilter : Regex.Escape(_processedFilter);
                if (!UseCaseSensitiveFilter)
                {
                    options |= RegexOptions.IgnoreCase;
                }
                if (UseWholeWordFilter)
                {
                    pattern = $"\\b(?:{pattern})\\b";
                }

                _filterRegex = new Regex(pattern, options);
                ClearError();
            }
            catch (Exception exception)
            {
                _errors[nameof(FilterString)] = exception.Message;
                ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(nameof(FilterString)));
            }
        }
Esempio n. 2
0
        private LoadOperation <ProductManager.Web.Model.user> LoadUserEntities()
        {
            this.IsBusy = true;
            EntityQuery <ProductManager.Web.Model.user> lQuery = this.systemManageDomainContext.GetUserQuery();

            if (!String.IsNullOrWhiteSpace(FilterString))
            {
                String lFilterString = FilterString.Trim();
                lQuery = lQuery.Where(e => e.user_cname.Contains(lFilterString));
            }
            return(this.systemManageDomainContext.Load(lQuery.SortAndPageBy(this.userView)));
        }