private void btnImpresion_Click(object sender, EventArgs e) { try { if (this.dgvComprasPorProveedor.SelectedRows.Count == 1) { this.Visible = false; ReporteComprasPorProveedor Datos = this.ObtenerDatosReporte(); frmVerReporteComprasPorProveedor VerReporte = new frmVerReporteComprasPorProveedor(Datos.IDReporte); VerReporte.ShowDialog(); VerReporte.Dispose(); //this.DialogResult = DialogResult.OK; this.Visible = true; } else { MessageBox.Show("Seleccione una fila.", Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "frmReportesComprasPorProveedor ~ btnImpresion_Click"); MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnGuardar_Click(object sender, EventArgs e) { try { this.txtMensajeError.Visible = false; List <Error> Errores = this.ValidarDatos(); if (Errores.Count == 0) { this.Visible = false; ReporteComprasPorProveedor Datos = this.ObtenerDatos(); ReporteComprasPorProveedor_Negocio Neg = new ReporteComprasPorProveedor_Negocio(); int IDReporte = Neg.GenerarReporteComprasPorProveedor(Comun.Conexion, Datos.FechaInicio, Datos.FechaFin, Comun.IDUsuario); if (IDReporte > 0) { //Generar el reporte frmVerReporteComprasPorProveedor VerReporte = new frmVerReporteComprasPorProveedor(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); } this.Visible = true; } else { this.MostrarMensajeError(Errores); } } catch (Exception ex) { LogError.AddExcFileTxt(ex, "frmNuevoReporteComprasPorProveedor ~ btnGuardar_Click"); MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }