Exemple #1
0
 /// <summary>
 /// 根据新的过滤部分预取 URL,同时页序号被重置为初始值
 /// </summary>
 /// <param name="fieldName"></param>
 /// <param name="minValue"></param>
 /// <param name="includeMinValue"></param>
 /// <param name="maxValue"></param>
 /// <param name="includeMaxValue"></param>
 /// <returns></returns>
 public string PrefetchNewFilterUrl(string fieldName, DateTime minValue, bool includeMinValue, DateTime maxValue, bool includeMaxValue)
 {
     fieldName = RetrieveFieldName(fieldName);
     IFilterPart filter = new RangeDateFilterPart(fieldName, minValue, includeMinValue, maxValue, includeMaxValue);
     return PrefetchNewFilterUrlImpl(fieldName, filter);
 }
Exemple #2
0
        /// <summary>
        /// 设置过滤部分
        /// </summary>
        /// <param name="fieldName"></param>
        /// <param name="minValue"></param>
        /// <param name="includeMinValue"></param>
        /// <param name="maxValue"></param>
        /// <param name="includeMaxValue"></param>
        public void SetFilter(string fieldName, DateTime minValue, bool includeMinValue, DateTime maxValue, bool includeMaxValue)
        {
            fieldName = RetrieveFieldName(fieldName);

            IFilterPart existed = null;
            foreach (IFilterPart filter in this.m_filters)
            {
                if (string.Compare(filter.FieldName, fieldName, true) == 0)
                {
                    existed = filter;
                    break;
                }
            }

            RangeDateFilterPart part = existed as RangeDateFilterPart;
            if (part != null)
            {
                if ((part.MinValue != minValue) || (part.IncludeMinValue != includeMinValue)
                    || (part.MaxValue != maxValue) || (part.IncludeMaxValue != includeMaxValue))
                {
                    part.MinValue = minValue;
                    part.IncludeMinValue = includeMinValue;
                    part.MaxValue = maxValue;
                    part.IncludeMaxValue = includeMaxValue;
                    this.MarkDirty();
                }
                return;
            }
            else if (existed != null)
            {
                this.m_filters.Remove(existed);
            }

            part = new RangeDateFilterPart(fieldName, minValue, includeMinValue, maxValue, includeMaxValue);
            this.m_filters.Add(part);
            this.MarkDirty();
        }