Exemplo n.º 1
0
        public UriParamList ToUriParamList()
        {
            var result = new UriParamList();

            if (!String.IsNullOrEmpty(Query))
            {
                result.Add(Tuple.Create(SEARCH_PARAM_QUERY, Query));
            }
            if (!String.IsNullOrEmpty(Text))
            {
                result.Add(Tuple.Create(SEARCH_PARAM_TEXT, Text));
            }
            if (!String.IsNullOrEmpty(Content))
            {
                result.Add(Tuple.Create(SEARCH_PARAM_CONTENT, Content));
            }
            if (Count != null)
            {
                result.Add(Tuple.Create(SEARCH_PARAM_COUNT, Count.Value.ToString()));
            }
            if (Include.Any())
            {
                result.AddRange(Include.Select(i => Tuple.Create(SEARCH_PARAM_INCLUDE, i)));
            }
            if (RevInclude.Any())
            {
                result.AddRange(RevInclude.Select(i => Tuple.Create(SEARCH_PARAM_REVINCLUDE, i)));
            }
            if (Sort.Any())
            {
                result.AddRange(Sort.Select(s => Tuple.Create(createSortParamName(s.Item2), s.Item1)));
            }
            if (Summary != null)
            {
                result.Add(Tuple.Create(SEARCH_PARAM_SUMMARY, Summary.Value.ToString().ToLower()));
            }
            if (!String.IsNullOrEmpty(Filter))
            {
                result.Add(Tuple.Create(SEARCH_PARAM_FILTER, Filter));
            }
            if (Contained != null)
            {
                result.Add(Tuple.Create(SEARCH_PARAM_CONTAINED, Contained.Value.ToString().ToLower()));
            }
            if (ContainedType != null)
            {
                result.Add(Tuple.Create(SEARCH_PARAM_CONTAINEDTYPE, ContainedType.Value.ToString().ToLower()));
            }
            if (Elements.Any())
            {
                result.Add(Tuple.Create(SEARCH_PARAM_ELEMENTS, String.Join(",", Elements)));
            }

            result.AddRange(Parameters);
            return(result);
        }
Exemplo n.º 2
0
 public bool Match(ActionView action)
 {
     if (Include != null && Include.Any(m => !m.Match(action)))
     {
         return(false);
     }
     if (Exclude != null && Exclude.Any(m => m.Match(action)))
     {
         return(false);
     }
     return(true);
 }
        internal bool IsIncluded(string name)
        {
            if (Exclude != null)
            {
                return(!Exclude.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)));
            }
            else if (Include != null)
            {
                return(Include.Any(exclude => exclude.Equals(name, StringComparison.OrdinalIgnoreCase)));
            }

            return(true);
        }
Exemplo n.º 4
0
        private bool CheckIncluds(int?element)
        {
            if (element == null)
            {
                return(false);
            }

            if (Include == null || Include.Length <= 0)
            {
                return(true);
            }
            return(Include.Any(x => x == element));
        }
Exemplo n.º 5
0
        public bool IsMatch(IPAddress client)
        {
            if (!Include.Any(e => e.IsMatch(client)))
            {
                return(false);
            }

            if (Exclude.Any(e => e.IsMatch(client)))
            {
                return(false);
            }

            return(true);
        }
        private IEnumerable <KeyValuePair <string, string> > GetPairsToInclude()
        {
            var httpRequest = HttpContextAccessor?.HttpContext?.TryGetRequest();
            var pairs       = new List <KeyValuePair <string, string> >();

            if (httpRequest.Form != null)
            {
                foreach (string key in httpRequest.Form.Keys)
                {
                    if ((!Include.Any() || Include.Contains(key)) && !Exclude.Contains(key))
                    {
                        pairs.Add(new KeyValuePair <string, string>(key, httpRequest.Form[key]));
                    }
                }
            }

            return(pairs);
        }
        public virtual IQueryable <TEntity> Get(Func <TEntity, bool> Where, params Expression <Func <TEntity, object> >[] Include)
        {
            IQueryable <TEntity> result = _entities;

            if (Where != null)
            {
                result = result.Where(Where).AsQueryable();
            }

            if (Include != null && Include.Any())
            {
                foreach (var include in Include)
                {
                    result = result.Include(include);
                }
            }

            return(result);
        }
Exemplo n.º 8
0
 internal bool ShouldIncludeLabel(string label) =>
 !Include.Any() ||
 Include.Any(lbl => lbl.Equals(label, StringComparison.OrdinalIgnoreCase));
        private bool ShouldIncludeProject(Project project)
        {
            var isIncluded = !Include.Any() || Include.Any(regex => Regex.IsMatch(project.FilePath, regex));

            return(isIncluded && Exclude.All(regex => !Regex.IsMatch(project.FilePath, regex)));
        }
Exemplo n.º 10
0
        public UriParamList ToUriParamList()
        {
            var result = new UriParamList();

            if (!String.IsNullOrEmpty(Query))
            {
                result.Add(Tuple.Create(SEARCH_PARAM_QUERY, Query));
            }
            if (!String.IsNullOrEmpty(Text))
            {
                result.Add(Tuple.Create(SEARCH_PARAM_TEXT, Text));
            }
            if (!String.IsNullOrEmpty(Content))
            {
                result.Add(Tuple.Create(SEARCH_PARAM_CONTENT, Content));
            }
            if (Count != null)
            {
                result.Add(Tuple.Create(SEARCH_PARAM_COUNT, Count.Value.ToString()));
            }
            if (Include.Any())
            {
                result.AddRange(Include.Select(i => Tuple.Create(SEARCH_PARAM_INCLUDE, i)));
            }
            if (RevInclude.Any())
            {
                result.AddRange(RevInclude.Select(i => Tuple.Create(SEARCH_PARAM_REVINCLUDE, i)));
            }
            if (Sort.Any())
            {
                result.Add(createSortParam(Sort));
            }
            if (Summary != null)
            {
                result.Add(Tuple.Create(SEARCH_PARAM_SUMMARY, Summary.Value.ToString().ToLower()));
            }
            if (!String.IsNullOrEmpty(Filter))
            {
                result.Add(Tuple.Create(SEARCH_PARAM_FILTER, Filter));
            }
            if (Contained != null)
            {
                result.Add(Tuple.Create(SEARCH_PARAM_CONTAINED, Contained.Value.ToString().ToLower()));
            }
            if (ContainedType != null)
            {
                result.Add(Tuple.Create(SEARCH_PARAM_CONTAINEDTYPE, ContainedType.Value.ToString().ToLower()));
            }
            if (Elements.Any())
            {
                result.Add(Tuple.Create(SEARCH_PARAM_ELEMENTS, String.Join(",", Elements)));
            }

            result.AddRange(Parameters);
            return(result);

            Tuple <string, string> createSortParam(IList <Tuple <string, SortOrder> > sorts)
            {
                var values =
                    from s in sorts
                    let orderPrefix = s.Item2 == SortOrder.Descending ? "-" : ""
                                      select orderPrefix + s.Item1;

                return(new Tuple <string, string>(SEARCH_PARAM_SORT, String.Join(",", values)));
            }
        }