public DataFilterConfiguration(DataFilterConfiguration filterToClone) : this(filterToClone.FilterName, filterToClone.IsEnabled) { foreach (var filterParameter in filterToClone.FilterParameters) { FilterParameters[filterParameter.Key] = filterParameter.Value; } }
/// <inheritdoc/> public IDisposable DisableFilter(params string[] filterNames) { //TODO: Check if filters exists? var disabledFilters = new List<string>(); foreach (var filterName in filterNames) { var filterIndex = GetFilterIndex(filterName); if (_filters[filterIndex].IsEnabled) { disabledFilters.Add(filterName); _filters[filterIndex] = new DataFilterConfiguration(filterName, false); } } disabledFilters.ForEach(ApplyDisableFilter); return new DisposeAction(() => EnableFilter(disabledFilters.ToArray())); }
private void ChangeFilterIsEnabledIfNotOverrided(List<DataFilterConfiguration> filterOverrides, string filterName, bool isEnabled) { if (filterOverrides.Any(f => f.FilterName == filterName)) { return; } var index = _filters.FindIndex(f => f.FilterName == filterName); if (index < 0) { return; } if (_filters[index].IsEnabled == isEnabled) { return; } _filters[index] = new DataFilterConfiguration(filterName, isEnabled); }
/// <inheritdoc/> public void SetFilterParameter(string filterName, string parameterName, object value) { var filterIndex = GetFilterIndex(filterName); var newfilter = new DataFilterConfiguration(_filters[filterIndex]); newfilter.FilterParameters[parameterName] = value; _filters[filterIndex] = newfilter; ApplyFilterParameterValue(filterName, parameterName, value); }