Esempio n. 1
0
        public IDisposable SetFilterParameter(string filterName, string parameterName, object value)
        {
            int filterIndex = GetFilterIndex(filterName);
            DataFilterConfiguration dataFilterConfiguration = new DataFilterConfiguration(_filters[filterIndex]);
            object oldValue    = null;
            bool   hasOldValue = dataFilterConfiguration.FilterParameters.ContainsKey(parameterName);

            if (hasOldValue)
            {
                oldValue = dataFilterConfiguration.FilterParameters[parameterName];
            }
            dataFilterConfiguration.FilterParameters[parameterName] = value;
            _filters[filterIndex] = dataFilterConfiguration;
            ApplyFilterParameterValue(filterName, parameterName, value);
            return(new DisposeAction(delegate
            {
                if (hasOldValue)
                {
                    SetFilterParameter(filterName, parameterName, oldValue);
                }
            }));
        }