Example #1
0
 private void listBox_Products_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (listBox_Products.SelectedItem != null)
     {
         Product P = BoughtProducts[listBox_Products.SelectedIndex];
         foreach (Product Pr in listOfProducts)
         {
             if (Pr.ProductID == P.ProductID)
             {
                 Pr.IncreaseQuantity(P.Quantity);
             }
         }
         listBox_Products.Items.Remove(listBox_Products.SelectedItem);
         BoughtProducts.Remove(P);
     }
 }
Example #2
0
 private void btn_RemoveProd_shop_Click(object sender, EventArgs e)
 {
     if (listBox_Products.SelectedItem != null)
     {
         Product P = BoughtProducts[listBox_Products.SelectedIndex];
         foreach (Product Pr in listOfProducts)
         {
             if (Pr.ProductID == P.ProductID)
             {
                 Pr.IncreaseQuantity(P.Quantity);
             }
         }
         listBox_Products.Items.Remove(listBox_Products.SelectedItem);
         BoughtProducts.Remove(P);
     }
     UpdateList();
 }
Example #3
0
 private void btn_Clear_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < listBox_Products.Items.Count; i++)
     {
         Product P = BoughtProducts[i];
         foreach (Product Pr in listOfProducts)
         {
             if (Pr.ProductID == P.ProductID)
             {
                 Pr.IncreaseQuantity(P.Quantity);
             }
         }
     }
     BoughtProducts = new List <Product>();
     listBox_Products.Items.Clear();
     UpdateList();
 }