private IEnumerable <BehaviorChain> getChainsWithoutOutput() { var filter = new JsonGridFilter { ColumnName = _viewFilter.Column.Name(), Values = new[] { ViewColumn.None } }; return(_graph .Behaviors .Where(chain => _viewFilter.AppliesTo(chain, filter) && _viewFilter.Matches(chain, filter))); }
public JsonAutocompleteResultModel Post(AutocompleteRequestModel <BehaviorGraph> request) { var filter = new JsonGridFilter { ColumnName = request.Column, Values = new List <string> { request.Query } }; var query = JsonGridQuery.ForFilter(filter); return(new JsonAutocompleteResultModel { Values = _gridService .GridFor(_behaviorGraph, query) .Rows .SelectMany(r => r.Columns.Where(c => c.Name.Equals(request.Column, StringComparison.OrdinalIgnoreCase))) .Distinct() }); }
public JsonAutocompleteResultModel Execute(AutocompleteRequestModel <RequestCacheModel> request) { var model = _modelBuilder.Build(); var filter = new JsonGridFilter { ColumnName = request.Column, Values = new List <string> { request.Query } }; var query = JsonGridQuery.ForFilter(filter); return(new JsonAutocompleteResultModel { Values = _gridService .GridFor(model, query) .Rows .SelectMany(r => r.Columns.Where(c => c.Name.Equals(request.Column, StringComparison.OrdinalIgnoreCase))) .Distinct() }); }
protected bool contains(TModel target, JsonGridFilter filter) { return(filter.Matches(_column.ValueFor(target), (filterValue, value) => value.Contains(filterValue))); }
protected bool startsWith(TModel target, JsonGridFilter filter) { return(filter.Matches(_column.ValueFor(target), (filterValue, value) => value.StartsWith(filterValue))); }
public virtual bool Matches(TModel target, JsonGridFilter filter) { return(contains(target, filter)); }
public virtual bool AppliesTo(TModel target, JsonGridFilter filter) { return(filter.ColumnName.Equals(_column.Name(), StringComparison.OrdinalIgnoreCase)); }
public static IEnumerable <JsonGridRow> ApplyFilter(this IEnumerable <JsonGridRow> rows, JsonGridFilter filter) { var filteredRows = new List <JsonGridRow>(); rows .Each(row => { if (!row.Columns.Any(c => c.Name.ToLower().Equals(filter.ColumnName.ToLower()))) { return; } // TODO: We should do some better matching here if (row.Columns.Any(c => filter.Values.Any(value => c.Value.ToLower().Contains(value.ToLower())))) { filteredRows.Add(row); } }); return(filteredRows); }
public override bool Matches(BehaviorChain target, JsonGridFilter filter) { return(startsWith(target, filter)); }
public bool Matches(BehaviorChain target, JsonGridFilter filter) { return(target.InputType() != null && filter.Values.Any(v => target.InputType().Name.ToLower().Contains(v.ToLower()))); }
public bool AppliesTo(BehaviorChain target, JsonGridFilter filter) { return(filter.ColumnName.Equals("InputModel", StringComparison.OrdinalIgnoreCase)); }