Пример #1
0
 private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index)
     {
         string    idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString();
         frmVentas ventas  = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle);
         ventas.FormClosed += editVentas_FormClosed;
         ventas.ShowDialog();
     }
     if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index)
     {
         if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión",
                             MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes)
         {
             if (!BL.UtilDB.ValidarServicioMysql())
             {
                 MessageBox.Show("NO SE BORRARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos."
                                 + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK,
                                 MessageBoxIcon.Error);
                 return;
             }
             int         PK  = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString());
             frmProgress frm = new frmProgress(PK, "frmArqueoCajaAdmin_borrarVenta", "grabar");
             frm.FormClosed += progreso_FormClosed;
             frm.Show();
         }
     }
 }
Пример #2
0
        private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString());

            if (dtPicker.Value.Date != DateTime.Today)
            {
                return;
            }
            if (e.RowIndex < 0)
            {
                return;
            }
            if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index)
            {
                string    idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString();
                frmVentas ventas  = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle);
                ventas.FormClosed += editVentas_FormClosed;
                ventas.ShowDialog();
            }
            if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index)
            {
                if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes)
                {
                    Cursor.Current       = Cursors.WaitCursor;
                    viewVentas           = new DataView(tblVentas);
                    viewVentas.RowFilter = "[IdVentaVEN] = '" + PK + "'";
                    foreach (DataRowView row in viewVentas)
                    {
                        row.Delete();
                    }
                    bool borrarRemotas = false;
                    BL.TransaccionesBLL.BorrarVentasByPK(PK, ref codigoError, borrarRemotas);
                    if (codigoError != null)
                    {
                        Close();
                        return;
                    }
                    tblVentas.AcceptChanges();
                    CargarDatos();
                    Cursor.Current = Cursors.Arrow;
                }
            }
        }
Пример #3
0
 private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index)
     {
         string    idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString();
         frmVentas ventas  = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle);
         ventas.FormClosed += editVentas_FormClosed;
         ventas.ShowDialog();
     }
     if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index)
     {
         if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión",
                             MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes)
         {
             Cursor.Current = Cursors.WaitCursor;
             try
             {
                 int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString());
                 BL.VentasBLL.BorrarByPK(PK);
             }
             catch (ServidorMysqlInaccesibleException ex)
             {
                 MessageBox.Show(ex.Message, "Trend Gestión",
                                 MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             Cursor.Current = Cursors.Arrow;
         }
     }
 }
Пример #4
0
 private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dtPicker.Value.Date != DateTime.Today) return;
     if (e.RowIndex < 0) return;
     if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index)
     {
         string idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString();
         frmVentas ventas = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle);
         ventas.FormClosed += editVentas_FormClosed;
         ventas.ShowDialog();
     }
     if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index)
     {
         if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend",
                 MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes)
         {
             Cursor.Current = Cursors.WaitCursor;
             int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString());
             viewVentas = new DataView(tblVentas);
             viewVentas.RowFilter = "[IdVentaVEN] = '" + PK + "'";
             foreach (DataRowView row in viewVentas)
             {
                 row.Delete();
             }
             bool borrarRemotas = false;
             BL.TransaccionesBLL.BorrarVentasByPK(PK, ref codigoError, borrarRemotas);
             if (codigoError != null)
             {
                 Close();
                 return;
             }
             tblVentas.AcceptChanges();
             CargarDatos();
             Cursor.Current = Cursors.Arrow;
         }
     }
 }
 private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0) return;
     if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index)
     {
         string idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString();
         frmVentas ventas = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle);
         ventas.FormClosed += editVentas_FormClosed;
         ventas.ShowDialog();
     }
     if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index)
     {
         if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión",
                 MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes)
         {
             if (!BL.UtilDB.ValidarServicioMysql())
             {
                 MessageBox.Show("NO SE BORRARON LOS DATOS." + '\r' + "No se pudo conectar con el servidor de base de datos."
                         + '\r' + "Consulte al administrador del sistema.", "Trend Sistemas", MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
                 return;
             }
             int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString());
             frmProgress frm = new frmProgress(PK, "frmArqueoCajaAdmin_borrarVenta", "grabar");
             frm.FormClosed += progreso_FormClosed;
             frm.Show();
         }
     }
 }
 private void dgvVentas_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0) return;
     if (e.ColumnIndex == dgvVentas.Columns["Editar"].Index)
     {
         string idVenta = dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString();
         frmVentas ventas = new frmVentas(idVenta, idPc, tblVentas, tblVentasDetalle);
         ventas.FormClosed += editVentas_FormClosed;
         ventas.ShowDialog();
     }
     if (e.ColumnIndex == dgvVentas.Columns["Borrar"].Index)
     {
         if (MessageBox.Show("¿Desea borrar este registro y todos los movimientos relacionados?", "Trend Gestión",
                 MessageBoxButtons.YesNo, MessageBoxIcon.Stop) == DialogResult.Yes)
         {
             Cursor.Current = Cursors.WaitCursor;
             try
             {
                 int PK = Convert.ToInt32(dgvVentas.CurrentRow.Cells["IdVentaVEN"].Value.ToString());
                 BL.VentasBLL.BorrarByPK(PK);
             }
             catch (ServidorMysqlInaccesibleException ex)
             {
                 MessageBox.Show(ex.Message, "Trend Gestión",
                 MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             Cursor.Current = Cursors.Arrow;
         }
     }
 }