Esempio n. 1
0
        private void cbOrder_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (cbOrder.SelectedIndex)
            {
            case 1:
                CurrentProductList = CurrentProductList.OrderBy(o => o.name).ToList();
                break;

            case 2:
                CurrentProductList = CurrentProductList.OrderByDescending(o => o.name).ToList();
                break;

            case 3:
                CurrentProductList = CurrentProductList.OrderBy(o => o.discountedPrice).ToList();
                break;

            case 4:
                CurrentProductList = CurrentProductList.OrderByDescending(o => o.discountedPrice).ToList();
                break;

            default:
                break;
            }
            flPnlProduct.Controls.Clear();
            foreach (Product item in CurrentProductList)//Create panels
            {
                ProductPanel pnl = panelCreator.CreatePanel(item);
                flPnlProduct.Controls.Add(pnl);
            }
        }
Esempio n. 2
0
        private void cbCategory_SelectedIndexChanged(object sender, EventArgs e)//Category selection
        {
            flPnlProduct.Controls.Clear();
            CurrentProductList.Clear();

            foreach (var item in (List <Product>)productList[cbProduct.SelectedIndex])
            {
                if (item.Category == cbCategory.SelectedItem.ToString())
                {
                    CurrentProductList.Add(item);
                    ProductPanel pnl = panelCreator.CreatePanel(item);
                    flPnlProduct.Controls.Add(pnl);
                }
                else if (cbCategory.SelectedItem.ToString() == "All")
                {
                    CurrentProductList.Add(item);
                    ProductPanel pnl = panelCreator.CreatePanel(item);
                    flPnlProduct.Controls.Add(pnl);
                }
            }
            cbOrder.SelectedIndex = 0;
        }