コード例 #1
0
        private void btnCart(object sender, EventArgs e)
        {
            try
            {
                SaleController saleController = new SaleController();

                foreach (var item in productsShop)
                {
                    item.Quantity = 1;
                }

                string message = VerifyStock.Verify(productsShop);

                if (message != null)
                {
                    throw new Exception(message);
                }

                Sale sale = saleController.addSale(productsShop);
                Cart cart = new Cart(productsShop, sale);
                cart.Show();
                Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }