Пример #1
0
        private async void dgvSales_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (this.dgvSales.Rows[e.RowIndex].Cells["DetailSale"].Selected)
                {
                    this.PaintRowAndUnpaintLastSelectedRow(e.RowIndex);

                    long idSale = (long)this.dgvSales.Rows[e.RowIndex].Cells["idSale"].Value;
                    this.dgvDetailsSale.DataSource = await DetailSaleService.ListDetailSaleLikeCartItemByIdSale(idSale);
                }
                else if (this.dgvSales.Rows[e.RowIndex].Cells["PDFView"].Selected)
                {
                    this.PaintRowAndUnpaintLastSelectedRow(e.RowIndex);

                    long idSale = (long)this.dgvSales.Rows[e.RowIndex].Cells["idSale"].Value;
                    SaleService.ExportInPDFDetailSaleLikeCartItemByIdSale(idSale);
                }
                else if (this.dgvSales.Rows[e.RowIndex].Cells["cancelSale"].Selected)
                {
                    this.PaintRowAndUnpaintLastSelectedRow(e.RowIndex);

                    DialogResult    result          = new DialogResult();
                    FormInformation formInformation = new FormInformation("¿ESTAS SEGURO DE ANULAR LA VENTA?");
                    result = formInformation.ShowDialog();

                    if (result == DialogResult.OK)
                    {
                        long idSale = (long)this.dgvSales.Rows[e.RowIndex].Cells["idSale"].Value;
                        if (await SaleService.CancelSaleByIdSale(idSale))
                        {
                            FormSuccess.ConfirmationForm("ANULADO");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }