Example #1
0
        private void SearchItemsByName()
        {
            ICollection <Tuple <Item, Price, Store> > itemsPricesStoresList;

            if (comboBox_chain.SelectedItem.ToString().Equals("All Chains"))
            {
                itemsPricesStoresList = _catalogManager.GetAllUpdatedPricesByItemName(txt_searchItemName.Text);
            }
            else if (comboBox_store.SelectedItem.ToString().Equals("All Stores"))
            {
                itemsPricesStoresList = _catalogManager.GetItemsByNameAndChain(txt_searchItemName.Text, _chain);
            }
            else
            {
                itemsPricesStoresList = _catalogManager.GetItemsByNameAndStore(txt_searchItemName.Text, _store);
            }

            lbl_resultsNum.Visible = true;

            flowLayoutPanel_items.Controls.Clear();
            if (itemsPricesStoresList.Count() == 0)
            {
                lbl_resultsNum.Text = "0 results";
            }
            lbl_resultsNum.Text = $"({itemsPricesStoresList.Count().ToString()})";
            LayoutItems(itemsPricesStoresList);
        }