Exemple #1
0
 public string GetFilterName(object filtersCollection, FilterItemBase filter)
 {
     if (filter != null)
     {
         var count = CollectionViewModel.GetEntities(GetFilterExpression(filter)).Count();
         if (count > 0)
         {
             return(filter.Name + " (" + count + ")");
         }
         else
         {
             return(filter.Name);
         }
     }
     else
     {
         if (object.Equals(filtersCollection, StaticFilters))
         {
             return(StaticFiltersName);
         }
         if (object.Equals(filtersCollection, CustomFilters))
         {
             return(CustomFiltersName);
         }
         if (object.Equals(filtersCollection, Groups))
         {
             return(GroupFiltersName);
         }
     }
     return(null);
 }
        public virtual void DuplicateFilter(FilterItemBase filterItem)
        {
            var newItem = CreateFilterItem("Copy of " + filterItem.Name, filterItem.FilterCriteria, null);

            CustomFilters.Add(newItem);
            SaveCustomFilters();
        }
Exemple #3
0
        protected virtual T CreateCustomFilterViewModel <T>(FilterItemBase filterItem) where T : FilterViewModelBase, new()
        {
            T viewModel = ViewModelSource.Create <T>();

            ViewModelHelper.EnsureViewModel(viewModel, CollectionViewModel, filterItem);
            return(viewModel);
        }
 public virtual void ResetCustomFilters()
 {
     if (CustomFilters.Contains(SelectedItem))
     {
         SelectedItem = null;
     }
     settings.CustomFilters = new FilterInfoList();
     CustomFilters.Clear();
     settings.Settings.Save();
 }
Exemple #5
0
 void ApplyFilter(FilterItemBase filterItem)
 {
     if (filterItem != null && !object.ReferenceEquals(filterItem.FilterCriteria, null))
     {
         CollectionViewModel.FilterExpression = GetFilterExpression(filterItem);
     }
     else
     {
         CollectionViewModel.FilterExpression = null;
     }
 }
        protected void AddNewCustomFilter(FilterItemBase filterItem)
        {
            var existing = CustomFilters.FirstOrDefault(fi => fi.Name == filterItem.Name);

            if (existing != null)
            {
                CustomFilters.Remove(existing);
            }
            CustomFilters.Add(filterItem);
            SaveCustomFilters();
        }
Exemple #7
0
        void NewGroupCore(FilterItemBase newFilterItem)
        {
            GroupFilterViewModel viewModel = CreateCustomFilterViewModel <GroupFilterViewModel>(newFilterItem);

            if (ShowFilterDialog(viewModel, "Group Filter"))
            {
                if (viewModel.Save)
                {
                    AddNewGroupFilter(newFilterItem);
                    RaiseFilterTreeChanged();
                }
                SelectedItem = newFilterItem;
            }
        }
Exemple #8
0
 public QueryFilterCriteriaEventArgs(FilterItemBase item)
 {
     this.item = item;
 }
Exemple #9
0
 static Expression <Func <TEntity, bool> > GetFilterExpression(FilterItemBase filter)
 {
     return(GetFilterExpression(filter.FilterCriteria));
 }
Exemple #10
0
 public virtual void ModifyGroupFilter(FilterItemBase filterItem)
 {
     SaveGroupFilters();
 }
Exemple #11
0
 public virtual void DeleteGroupFilter(FilterItemBase filterItem)
 {
     Groups.Remove(filterItem);
     SaveGroupFilters();
 }
Exemple #12
0
 public virtual void AddNewGroupFilter(FilterItemBase filterItem)
 {
     Groups.Add(filterItem);
     SaveGroupFilters();
 }
 public virtual void DeleteCustomFilter(FilterItemBase filterItem)
 {
     CustomFilters.Remove(filterItem);
     SaveCustomFilters();
 }