Exemple #1
0
        private void btnCancelSale_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Отменить продажу?", "Отменить", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
            {
                return;
            }
            else
            {
                try
                {
                    var helperSale = new SaleProductManager();

                    var helperProduct = new ProductManager();
                    if (helperProduct.DelSale(Convert.ToInt32(txtHiddenIdProduct.Text), Convert.ToInt32(txtHiddenCount.Text)) &&
                       helperSale.DelSale(Convert.ToInt32(txtHiddenId.Text)))
                    {
                        dtGrSale.DataSource = helperSale.GetAllSale();
                        MessageBox.Show("Продажа успешно отменена!");
                        var products = new ProductManager();
                        Form1 form = new Form1();

                       form.dtGridProducts.DataSource = products.GetAllProduct();

                    }
                    else
                    {

                    }
                }
                catch (Exception)
                {

                    MessageBox.Show("Упс! Что-то пошло не так!");
                }

            }
        }