示例#1
0
        public virtual bool MatchFilters(RavenJToken item)
        {
            foreach (var filter in Filters)
            {
                bool anyRecords    = false;
                bool matchedFilter = false;
                foreach (var tuple in item.SelectTokenWithRavenSyntaxReturningFlatStructure(filter.Path))
                {
                    if (tuple == null || tuple.Item1 == null)
                    {
                        continue;
                    }

                    anyRecords = true;

                    var val = tuple.Item1.Type == JTokenType.String
                                                                ? tuple.Item1.Value <string>()
                                                                : tuple.Item1.ToString(Formatting.None);
                    matchedFilter |= filter.Values.Any(value => String.Equals(val, value, StringComparison.OrdinalIgnoreCase)) ==
                                     filter.ShouldMatch;
                }

                if (filter.ShouldMatch == false && anyRecords == false) // RDBQA-7
                {
                    return(true);
                }

                if (matchedFilter == false)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
		public virtual bool MatchFilters(RavenJToken item)
		{
			foreach (var filter in Filters)
			{
			    bool anyRecords = false;
				bool matchedFilter = false;
				foreach (var tuple in item.SelectTokenWithRavenSyntaxReturningFlatStructure(filter.Path))
				{
					if (tuple == null || tuple.Item1 == null)
						continue;

				    anyRecords = true;

					var val = tuple.Item1.Type == JTokenType.String
								? tuple.Item1.Value<string>()
								: tuple.Item1.ToString(Formatting.None);
					matchedFilter |= filter.Values.Any(value => String.Equals(val, value, StringComparison.OrdinalIgnoreCase)) ==
									 filter.ShouldMatch;
				}

                if (filter.ShouldMatch == false && anyRecords == false) // RDBQA-7
                    return true;

				if (matchedFilter == false)
					return false;
			}
			return true;
		}
示例#3
0
		public virtual bool MatchFilters(RavenJToken item)
		{
			foreach (var filter in Filters)
			{
				var copy = filter;
				foreach (var tuple in item.SelectTokenWithRavenSyntaxReturningFlatStructure(copy.Key))
				{
					if (tuple == null || tuple.Item1 == null)
						continue;
					var val = tuple.Item1.Type == JTokenType.String
								? tuple.Item1.Value<string>()
								: tuple.Item1.ToString(Formatting.None);
					if (String.Equals(val, filter.Value, StringComparison.InvariantCultureIgnoreCase) == false)
						return false;
				}
			}
			return true;
		}
示例#4
0
 public bool MatchFilters(RavenJToken item)
 {
     foreach (var filter in Filters)
     {
         var copy = filter;
         foreach (var tuple in item.SelectTokenWithRavenSyntaxReturningFlatStructure(copy.Key))
         {
             if (tuple == null || tuple.Item1 == null)
             {
                 continue;
             }
             var val = tuple.Item1.Type == JTokenType.String
                                                         ? tuple.Item1.Value <string>()
                                                         : tuple.Item1.ToString(Formatting.None);
             if (string.Equals(val, filter.Value, StringComparison.InvariantCultureIgnoreCase) == false)
             {
                 return(false);
             }
         }
     }
     return(true);
 }
示例#5
0
 public virtual bool MatchFilters(RavenJToken item)
 {
     foreach (var filter in Filters)
     {
         bool matchedFilter = false;
         foreach (var tuple in item.SelectTokenWithRavenSyntaxReturningFlatStructure(filter.Path))
         {
             if (tuple == null || tuple.Item1 == null)
             {
                 continue;
             }
             var val = tuple.Item1.Type == JTokenType.String
                                                         ? tuple.Item1.Value <string>()
                                                         : tuple.Item1.ToString(Formatting.None);
             matchedFilter |= String.Equals(val, filter.Value, StringComparison.InvariantCultureIgnoreCase) ==
                              filter.ShouldMatch;
         }
         if (matchedFilter == false)
         {
             return(false);
         }
     }
     return(true);
 }