static void Cache(IActiveCollection collection, bool overwrite) { foreach (IActiveObject obj in collection) { Cache(obj, overwrite); } }
public void EnsureData() { if (this.Pager != null) this.Pager.SetParent(this); if (this.dataList == null) { int startIndex = this.Offset; int endIndex = startIndex + this.MaxResults; if (this.Pager != null) { if (this.Pager.PageSize > 0) { startIndex = (this.Pager.PageNumber - 1) * this.Pager.PageSize; endIndex = startIndex + this.Pager.PageSize; } } this.dataList = new ActiveCollection<IActiveObject>(); IDataSource dataSource = null; foreach (IDataSource ds in this.Data) { dataSource = ds; ds.Parent = this; IActiveCollection col = ds.GetData(startIndex, endIndex); this.dataList = col != null ? col : this.dataList; break; } this.DataSource = this.dataList.Count > 0 && dataSource != null ? dataSource.FilterData(this.dataList) : null; } }
static void Cache(IActiveCollection collection) { Cache(collection, true); }
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; }