Ejemplo n.º 1
0
        private void BtnSaleProd_Click(object sender, EventArgs e)
        {
            string nameProd = tbNameProd.Text;
            int    number   = Convert.ToInt32(tbNumProd.Text);
            bool   ifThere  = false;

            foreach (Product p in ProductManagment.ProductsSales)
            {
                if (p.Name == nameProd && p.Category == "SALES" && p.Stocks >= number)
                {
                    ProductManagment.SellProduct(nameProd, number);

                    managment.UPDATEprodSold(nameProd);
                    managment.UPDATEprodStock(nameProd);
                    MessageBox.Show("Done!");
                    ifThere = true;
                }
            }
            if (ifThere == false)
            {
                MessageBox.Show("Product not found or not enough stock!");
            }



            DataGridViewUpdateProducts();
        }