private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                this.txtMensajeError.Visible = false;
                List <Error> Errores = this.ValidarDatos();

                if (Errores.Count == 0)
                {
                    ReporteComprasCliente         Datos = this.ObtenerDatos();
                    Reporte_NegocioComprasCliente Neg   = new Reporte_NegocioComprasCliente();
                    int IDReporte = Neg.GenerarReporteComprasCliente(Comun.Conexion, Datos.FechaInicio, Datos.FechaFin, Datos.IDCliente, Comun.IDUsuario);
                    if (IDReporte > 0)
                    {
                        frmVerReporteComprasCliente VerReporte = new frmVerReporteComprasCliente(IDReporte);
                        VerReporte.ShowDialog();
                        VerReporte.Dispose();
                        this.DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        MessageBox.Show("Ocurrió un error al generar el reporte.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    this.MostrarMensajeError(Errores);
                }
            }
            catch (Exception ex)
            {
                LogError.AddExcFileTxt(ex, "frmNuevoReporteComprasCliente ~ btnGuardar_Click");
                MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
 private void btnImpresion_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvReporteComprasCliente.SelectedRows.Count == 1)
         {
             ReporteComprasCliente       Datos      = this.ObtenerDatosReporte();
             frmVerReporteComprasCliente VerReporte = new frmVerReporteComprasCliente(Datos.IDReporte);
             VerReporte.ShowDialog();
             VerReporte.Dispose();
         }
         else
         {
             MessageBox.Show("Seleccione una fila.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     catch (Exception ex)
     {
         LogError.AddExcFileTxt(ex, "frmReporteComprasCliente ~ btnImpresion_Click");
         MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }