private void UncheckAllManufacterers() { ManufacturerCheckboxes.ToList().ForEach(x => { (x as ProductCatalogProduct).UncheckMfg(); }); }
private void FilterButtons() { if (_categorySelected && _mfgSeclected && _PriceSelected) { foreach (ProductCatalogProduct pcp in CategoryCheckboxes.ToList()) { if (!(pcp.ManufacturersWithSameCategory.Contains(_mfgFilter)) && !PriceWithinRange(pcp)) { CategoryCheckboxes.Remove(pcp); _tempCategoryCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in ManufacturerCheckboxes.ToList()) { if (!(pcp.CategoriesWithSameManufacterer.Contains(_categoryFilter)) && !PriceWithinRange(pcp)) { ManufacturerCheckboxes.Remove(pcp); _tempManufacturerCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in PriceCheckboxes.ToList()) { if (!(pcp.CategoriesWithSameManufacterer.Contains(_categoryFilter)) && !(pcp.ManufacturersWithSameCategory.Contains(_mfgFilter))) { PriceCheckboxes.Remove(pcp); _tempPriceCheckboxesList.Add(pcp); } } } if (_categorySelected && _mfgSeclected) { foreach (ProductCatalogProduct pcp in CategoryCheckboxes.ToList()) { if (!(pcp.ManufacturersWithSameCategory.Contains(_mfgFilter))) { CategoryCheckboxes.Remove(pcp); _tempCategoryCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in ManufacturerCheckboxes.ToList()) { if (!(pcp.CategoriesWithSameManufacterer.Contains(_categoryFilter))) { ManufacturerCheckboxes.Remove(pcp); _tempManufacturerCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in PriceCheckboxes.ToList()) { if (!(pcp.CategoriesWithSameManufacterer.Contains(_categoryFilter)) && !(pcp.ManufacturersWithSameCategory.Contains(_mfgFilter))) { PriceCheckboxes.Remove(pcp); _tempPriceCheckboxesList.Add(pcp); } } } if (_PriceSelected && _mfgSeclected) { foreach (ProductCatalogProduct pcp in CategoryCheckboxes.ToList()) { if (!(pcp.ManufacturersWithSameCategory.Contains(_mfgFilter))) { CategoryCheckboxes.Remove(pcp); _tempCategoryCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in PriceCheckboxes.ToList()) { if (!pcp.ManufacturersWithSameCategory.Contains(_mfgFilter)) { PriceCheckboxes.Remove(pcp); _tempPriceCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in ManufacturerCheckboxes.ToList()) { if (!(pcp.CategoriesWithSameManufacterer.Contains(_categoryFilter)) && !PriceWithinRange(pcp)) { ManufacturerCheckboxes.Remove(pcp); _tempManufacturerCheckboxesList.Add(pcp); } } } if (_categorySelected && _PriceSelected) { foreach (ProductCatalogProduct pcp in PriceCheckboxes.ToList()) { if (pcp.CategoriesWithSameManufacterer.Contains(_categoryFilter)) { PriceCheckboxes.Remove(pcp); _tempPriceCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in ManufacturerCheckboxes.ToList()) { if (!(pcp.CategoriesWithSameManufacterer.Contains(_categoryFilter))) { ManufacturerCheckboxes.Remove(pcp); _tempManufacturerCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in CategoryCheckboxes.ToList()) { if (!(pcp.ManufacturersWithSameCategory.Contains(_mfgFilter)) && !PriceWithinRange(pcp)) { CategoryCheckboxes.Remove(pcp); _tempCategoryCheckboxesList.Add(pcp); } } } if (_mfgSeclected) { foreach (ProductCatalogProduct pcp in CategoryCheckboxes.ToList()) { if (!(pcp.ManufacturersWithSameCategory.Contains(_mfgFilter))) { CategoryCheckboxes.Remove(pcp); _tempCategoryCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in PriceCheckboxes.ToList()) { if (pcp.ManufacturersWithSameCategory.Contains(_mfgFilter)) { PriceCheckboxes.Remove(pcp); _tempPriceCheckboxesList.Add(pcp); } } } if (_categorySelected) { foreach (ProductCatalogProduct pcp in ManufacturerCheckboxes.ToList()) { if (!(pcp.CategoriesWithSameManufacterer.Contains(_categoryFilter))) { ManufacturerCheckboxes.Remove(pcp); _tempManufacturerCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in PriceCheckboxes.ToList()) { if (pcp.CategoriesWithSameManufacterer.Contains(_categoryFilter)) { PriceCheckboxes.Remove(pcp); _tempPriceCheckboxesList.Add(pcp); } } } if (_PriceSelected) { foreach (ProductCatalogProduct pcp in ManufacturerCheckboxes.ToList()) { if (PriceWithinRange(pcp)) { ManufacturerCheckboxes.Remove(pcp); _tempManufacturerCheckboxesList.Add(pcp); } } foreach (ProductCatalogProduct pcp in CategoryCheckboxes.ToList()) { if (PriceWithinRange(pcp)) { CategoryCheckboxes.Remove(pcp); _tempCategoryCheckboxesList.Add(pcp); } } } if (!_mfgSeclected) { _tempCategoryCheckboxesList.ForEach(x => CategoryCheckboxes.Add(x)); _tempCategoryCheckboxesList.Clear(); } if (!_categorySelected) { _tempManufacturerCheckboxesList.ForEach(x => ManufacturerCheckboxes.Add(x)); _tempManufacturerCheckboxesList.Clear(); } if (!_PriceSelected) { _tempPriceCheckboxesList.ForEach(x => PriceCheckboxes.Add(x)); _tempPriceCheckboxesList.Clear(); } }