Пример #1
0
        private void BtnProdRestock_Click(object sender, EventArgs e)
        {
            listBox3.Items.Clear();
            string ReqName = tbReqName.Text;
            bool   ifThere = false;

            foreach (Product p in ProductManagment.RequestedProducts)
            {
                if (p.Name == ReqName)
                {
                    foreach (var item in ProductManagment.ProductsDEPOT)
                    {
                        if (item.Name == ReqName && item.Stocks >= p.Requested)
                        {
                            item.Stocks -= p.Requested;
                            ProductManagment.RestockProducts(ReqName);
                            managment.UPDATEprodRequestR(ReqName);
                            managment.UPDATEprodStockR(ReqName);
                            managment.UPDATEprodStockDepot(ReqName);
                            MessageBox.Show("Product Restocked!");
                            ifThere = true;
                        }
                    }
                }
            }
            if (ifThere == false)
            {
                MessageBox.Show("Product not found or not enough stock in Depot!");
            }

            RequestsUpdate();
            tbReqName.Text = "";
        }