public virtual IEnumerable<ActiveObjects.IActiveObject> FilterData(ActiveObjects.IActiveCollection data) { IEnumerable<IActiveObject> e = data as IEnumerable<IActiveObject>; if (e == null) { List<IActiveObject> list = new List<IActiveObject>(data.Count); foreach (IActiveObject obj in data) { list.Add(obj); } e = list; } return e; }
/// <summary> /// Gets the current working set of filters /// </summary> protected List<IAuthorFilter> GetFilters() { int startIndex = 0; List<IAuthorFilter> set = new List<IAuthorFilter>(this.Filters); if (set.Count == 0) { set.Insert(0, new ScopeFilter()); } for (int i = 0; i < set.Count; i++) { set[i].Parent = this; if (set[i] is ClearFilters) startIndex = i; } return set.GetRange(startIndex, set.Count - startIndex); }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { Dictionary<string, object> parameters = null; foreach (IAuthorFilter filter in this.GetFilters()) { if (filter is ScopeFilter) { IAuthors authors = Control.GetCurrentScope<IAuthors>(this); if(authors != null) { IList<string> a = authors.GetAuthors(); List<Author> items = new List<Author>(a.Count); foreach (string name in a) { items.Add(DataBroker.GetAuthor(name)); } this.DataSource = items; } } else { if(parameters == null) parameters = new Dictionary<string, object>(); filter.Before(parameters); } } if (parameters != null) { this.DataSource = Author.Find(parameters); } if(this.DataSource != null) { base.DataBind(); if (this.Items.Count > 0) { base.Render(writer); } } }
public void SetParent(List parent) { this.Parent = parent; }
public virtual void GetVisibleIndexes(Mubble.Models.QueryEngine.QueryResults results, List<int> visibleIndexes) { }
public override void GetVisibleIndexes(QueryResults results, List<int> visibleIndexes) { for (int i = results.Count - 1; i >= 0; i--) { IActiveObject current = results[i]; Content result = results.GetQueryObject(i); if (current.GetType().Equals(this.Content.GetType()) && current.DataManager.PrimaryKeyValue.Equals(this.Content.DataManager.PrimaryKeyValue)) { visibleIndexes.Remove(i); continue; } //Content result = QueryResults.GetRawQueryContent(current); if (result.Score < this.Relevance) { visibleIndexes.Remove(i); } } }
public IEnumerable<IActiveObject> FilterData(IActiveCollection data) { QueryResults results = data as QueryResults; if (results == null) return (IEnumerable<IActiveObject>)data; List<int> visibleIndexes = new List<int>(data.Count); for (int i = 0; i < data.Count; i++) { visibleIndexes.Add(i); } foreach (IQueryFilter filter in this.Filters) { filter.GetVisibleIndexes(results, visibleIndexes); } List<IActiveObject> list = new List<IActiveObject>(visibleIndexes.Count); foreach (int i in visibleIndexes) { IActiveObject obj = results[i]; Guid aid = results.GetQueryObject(i).ActiveObjectID; if (!this.GroupItems.Contains(aid)) { list.Add(obj); } else { this.r.Add(aid); } } return list; }