public void SetFilterResult(IFilterPart <T> filter) { if (requestList == null) { throw new NullReferenceException(); } listFilters = filter.GetFilter(); DoAllFilter(); listFilters.Clear(); }
/// <summary> /// 根据新的过滤部分预取 URL /// </summary> /// <param name="fieldName"></param> /// <param name="newFilter"></param> /// <returns></returns> private string PrefetchNewFilterUrlImpl(string fieldName, IFilterPart newFilter) { if ((this.m_filters.Count == 0) || ((this.m_filters.Count == 1) && (string.Compare((this.m_filters[0] as IFilterPart).FieldName, fieldName, true) == 0))) { if (newFilter == null) { return BuildUrl(new IFilterPart[] { }, this.m_sorts, FIRST_PAGE_INDEX); } else { return BuildUrl(new IFilterPart[] { newFilter }, this.m_sorts, FIRST_PAGE_INDEX); } } else { IList<IFilterPart> filters = new List<IFilterPart>(); foreach (IFilterPart filter in this.m_filters) { if (string.Compare(filter.FieldName, fieldName, true) == 0) { if (newFilter != null) { filters.Add(newFilter); newFilter = null; } } else { filters.Add(filter); } } if (newFilter != null) { filters.Add(newFilter); } return BuildUrl(filters, this.m_sorts, FIRST_PAGE_INDEX); } }
/// <summary> /// 设置过滤参数 /// </summary> /// <param name="filter"></param> public void SetFilter(IFilterPart filter) { TermNumberFilterPart tn = filter as TermNumberFilterPart; if (tn != null) { this.SetFilter(tn.FieldName, tn.Value); return; } TermStringFilterPart ts = filter as TermStringFilterPart; if (ts != null) { this.SetFilter(ts.FieldName, ts.Value); return; } RangeNumberFilterPart rn = filter as RangeNumberFilterPart; if (rn != null) { this.SetFilter(rn.FieldName, rn.MinValue, rn.IncludeMinValue, rn.MaxValue, rn.IncludeMaxValue); return; } RangeDateFilterPart rd = filter as RangeDateFilterPart; if (rd != null) { this.SetFilter(rd.FieldName, rd.MinValue, rd.IncludeMinValue, rd.MaxValue, rd.IncludeMaxValue); return; } }