Esempio n. 1
0
        private void ReportSale_Load(object sender, EventArgs e)
        {
            lblNameReports.Text = "за все время!";
            var temp = new SaleProductManager();
            dtGrSale.DataSource = temp.GetAllSale();
            dtGrSale.Columns["Id"].Visible = false;
            dtGrSale.Columns["LabelName"].HeaderText = "Марка";
            dtGrSale.Columns["Name"].HeaderText = "Название";
            dtGrSale.Columns["Name"].FillWeight = 250;
            dtGrSale.Columns["Price"].HeaderText = "Сумма продажи";
            dtGrSale.Columns["Discount"].HeaderText = "Скидка";
            dtGrSale.Columns["Count"].HeaderText = "Количество";
            dtGrSale.Columns["DateTimeSale"].HeaderText = "Дата продажи";

            dtGrSale.Columns["Id"].Visible = false;
            txtCountProductGrid.Text = temp.GetAllSaleCount(temp.GetAllSale()).ToString();
            txtAllPriceGrid.Text = temp.GetAllSalePrice(temp.GetAllSale()).ToString();
        }
Esempio n. 2
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("Упс! Что-то пошло не так!");
                }

            }
        }