private void btnGuardar_Click(object sender, EventArgs e) { try { this.txtMensajeError.Visible = false; List <Error> Errores = this.ValidarDatos(); if (Errores.Count == 0) { ReporteGarantias Datos = this.ObtenerDatos(); ReporteGarantiasNegocio Neg = new ReporteGarantiasNegocio(); int IDReporte = Neg.GenerarReporteGarantias(Comun.Conexion, Datos.FechaInicio, Datos.FechaFin, Comun.IDUsuario); if (IDReporte > 0) { //Generar el reporte frmVerReporteGarantias VerReporte = new frmVerReporteGarantias(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, "frmNuevoReporteGarantias ~ btnGuardar_Click"); MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LlenarGrid() { try { ReporteGarantiasNegocio Neg = new ReporteGarantiasNegocio(); List <ReporteGarantias> Lista = Neg.ObtenerReportesGarantias(Comun.Conexion);//Neg.ObtenerReporteGarantias(Comun.Conexion); this.GridViewGeneral.AutoGenerateColumns = false; this.GridViewGeneral.DataSource = Lista; } catch (Exception ex) { throw ex; } }
private void btnBuscar_Click(object sender, EventArgs e) { try { DateTime Fecha; Fecha = dtpFecha.Value; ReporteGarantiasNegocio Neg = new ReporteGarantiasNegocio(); List <ReporteGarantias> Lista = Neg.BuscarReportesGarantias(Comun.Conexion, Fecha);//Neg.ObtenerReporteGarantias(Comun.Conexion); this.GridViewGeneral.AutoGenerateColumns = false; this.GridViewGeneral.DataSource = Lista; } catch (Exception ex) { LogError.AddExcFileTxt(ex, "frmReportesGarantias ~ btnBuscar_Click"); MessageBox.Show(Comun.MensajeError, Comun.Sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void GenerarGarantias() { try { reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); reportViewer1.ZoomMode = ZoomMode.Percent; reportViewer1.ZoomPercent = 100; reportViewer1.LocalReport.DataSources.Clear(); ReporteGarantiasNegocio Neg = new ReporteGarantiasNegocio(); ReporteGarantias DatosReporte = Neg.ObtenerDetalleReporteGarantias(Comun.Conexion, IDReporte); reportViewer1.LocalReport.EnableExternalImages = true; ReportParameter[] Parametros = new ReportParameter[7]; Parametros[0] = new ReportParameter("Empresa", Comun.NombreComercial); Parametros[1] = new ReportParameter("Eslogan", Comun.Eslogan); Parametros[2] = new ReportParameter("Direccion", Comun.Direccion); Parametros[3] = new ReportParameter("TituloReporte", "REPORTE DE GARANTIAS"); if (File.Exists(@"Resources\Documents\" + Comun.UrlLogo.ToLower())) { string Aux = new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\" + Comun.UrlLogo.ToLower())).AbsoluteUri; Parametros[4] = new ReportParameter("UrlLogo", new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\" + Comun.UrlLogo.ToLower())).AbsoluteUri); } else { Parametros[4] = new ReportParameter("UrlLogo", new Uri(Path.Combine(System.Windows.Forms.Application.StartupPath, @"Resources\Documents\Default.jpg")).AbsoluteUri); } Parametros[5] = new ReportParameter("FechaInicio", DatosReporte.FechaInicio.ToShortDateString()); Parametros[6] = new ReportParameter("FechaFin", DatosReporte.FechaFin.ToShortDateString()); this.reportViewer1.LocalReport.ReportEmbeddedResource = "StephManager.Informes.Reportes.Garantias.rdlc"; reportViewer1.LocalReport.SetParameters(Parametros); reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Garantias", DatosReporte.Detalle)); this.reportViewer1.RefreshReport(); } catch (Exception ex) { throw ex; } }