public void AddStatusFilter() { if (SelectedDeliveries == null) { return; } if (SelectedDeliveries.Count == 0) { return; } _selected.Clear(); foreach (ViewStatusy i in SelectedDeliveries) { _selected.Add(i.ID_DEFSTATUS); } // see Notes on Adding Filters: if (CanRemoveMaterialFilter) { ZamowieniaViewListaLst.Clear(); // foreach (ZamowieniaViewLista item in _zamowieniaviewlistafilter.Where(x => selectedItems.Contains(x.ID_DEFSTATUS))) foreach (ZamowieniaViewLista item in _zamowieniaviewlistafilter.Where(x => _selected.Contains(x.ID_DEFSTATUS))) { ZamowieniaViewListaLst.Add(item); } } else { ZamowieniaViewListaLst.Clear(); foreach (ZamowieniaViewLista item in _zamowieniaviewlista.Where(x => _selected.Contains(x.ID_DEFSTATUS))) // foreach (ZamowieniaViewLista item in _zamowieniaviewlista.Where(x => selectedItems.Contains(x.ID_DEFSTATUS))) { _zamowieniaviewlistafilter.Add(item); ZamowieniaViewListaLst.Add(item); } } CanRemoveStatusFilter = true; }
/* * public void RemoveDataOdFilter() * { * CVS.Filter -= new FilterEventHandler(FilterByAuthor); * // SelectedAuthor = null; * // CanRemoveAuthorFilter = false; * } * public void RemoveDataDoFilter() * { * CVS.Filter -= new FilterEventHandler(FilterByYear); * SelectedYear = null; * CanRemoveYearFilter = false; * } * * * * private void FilterByYear(object sender, FilterEventArgs e) * { * // see Notes on Filter Methods: * var src = e.Item as Thing; * if (src == null) * e.Accepted = false; * else if (SelectedYear != src.Year) * e.Accepted = false; * } * private void FilterByCountry(object sender, FilterEventArgs e) * { * // see Notes on Filter Methods: * var src = e.Item as Thing; * if (src == null) * e.Accepted = false; * else if (string.Compare(SelectedCountry, src.Country) != 0) * e.Accepted = false; * } */ public void AddMaterialFilter() { // see Notes on Adding Filters: if (CanRemoveMaterialFilter) { ZamowieniaViewListaLst.Clear(); _zamowieniaviewlistafilter.Clear(); foreach (ZamowieniaViewLista item in _zamowieniaviewlista.Where(x => x.ID_KARTOTEKA == _kartotekamat.ID_IHP_KARTOTEKA)) { _zamowieniaviewlistafilter.Add(item); } foreach (ZamowieniaViewLista item in _zamowieniaviewlistafilter) { ZamowieniaViewListaLst.Add(item); } } else { CanRemoveMaterialFilter = true; } }
public void AddDatyFilter() { if (SelectedDeliveries == null) { return; } if (SelectedDeliveries.Count == 0) { return; } _selected.Clear(); foreach (ViewStatusy i in SelectedDeliveries) { _selected.Add(i.ID_DEFSTATUS); } // see Notes on Adding Filters: if ((CanRemoveMaterialFilter) || (CanRemoveStatusFilter)) { ZamowieniaViewListaLst.Clear(); foreach (ZamowieniaViewLista item in _zamowieniaviewlistafilter.Where(x => _selected.Contains(x.ID_DEFSTATUS) && x.DATADOK >= DataOd && x.DATADOK <= DataDo)) { if (!ZamowieniaViewListaLst.Any(x => x.ID_POZ == item.ID_POZ)) { ZamowieniaViewListaLst.Add(item); } } } else { ZamowieniaViewListaLst.Clear(); foreach (ZamowieniaViewLista item in _zamowieniaviewlistafilter.Where(x => x.DATADOK >= DataOd && x.DATADOK <= DataDo)) { _zamowieniaviewlistafilter.Add(item); ZamowieniaViewListaLst.Add(item); } } }