private void eliminarToolStripMenuItem_Click(object sender, EventArgs e) { int idRegistro = int.Parse(gvDatosSacramentos.GetRowCellValue(gvDatosSacramentos.FocusedRowHandle, colIdRegistroSacramento).ToString()); String sacramento = gvDatosSacramentos.GetRowCellValue(gvDatosSacramentos.FocusedRowHandle, colSacramento).ToString(); CDReportes objR = new CDReportes(); if (sacramento.Equals("Matrimonio")) { CERptMatrimonio obj = objR.MostrarReporteMatrimonio(idRegistro); Reportes.RptMatrimonio reporte = new Reportes.RptMatrimonio(obj); Funciones.Funciones.MostrarReportes("Reporte de Matrimonio", reporte, this.MdiParent, false); } else if (sacramento.Equals("Primera comunión")) { CERptPrimeraComunion obj = objR.MostrarReportePrimeraComunion(idRegistro); Reportes.RptPrimeraComunion reporte = new Reportes.RptPrimeraComunion(obj); Funciones.Funciones.MostrarReportes("Reporte de Primera comunión", reporte, this.MdiParent, false); } else if (sacramento.Equals("Bautismo")) { CERptBautismo obj = objR.MostrarReporteBautismo(idRegistro); Reportes.RptBautismo reporte = new Reportes.RptBautismo(obj); Funciones.Funciones.MostrarReportes("Reporte de Bautismo", reporte, this.MdiParent, false); } else { CERptConfirmacion obj = objR.MostrarReporteConfirmacion(idRegistro); Reportes.RptConfirmacion reporte = new Reportes.RptConfirmacion(obj); Funciones.Funciones.MostrarReportes("Reporte de Confirmación", reporte, this.MdiParent, false); } }
public RptPrimeraComunion(CERptPrimeraComunion obj) { InitializeComponent(); txtLugar.Text = Funciones.Funciones.nombreParroquia.ToUpper(); txtSubtitulo.Text = txtSubtitulo.Text.Replace("p2", Funciones.Funciones.nombreParroquia.ToUpper()); txtFeligres.Text = obj.Feligres; txtFecha.Text = txtFecha.Text.Replace("p4", obj.Fecha.Day.ToString()).Replace("p5", obj.Fecha.ToString("MMMM", CultureInfo.CreateSpecificCulture("es"))).Replace("p6", obj.Fecha.Year.ToString()); txtR1.Rtf = txtR1.Rtf.Replace("p7", obj.Parroquia); txtR2.Rtf = txtR2.Rtf.Replace("p8", obj.Empleado); txtHoy.Rtf = txtHoy.Rtf.Replace("p9", obj.Hoy.Day.ToString()).Replace("p10", obj.Hoy.ToString("MMMM", CultureInfo.CreateSpecificCulture("es"))).Replace("p11", obj.Hoy.Year.ToString()); if (obj.Logo != null) { MemoryStream ms = new MemoryStream((byte[])obj.Logo); pbLogo.Image = Image.FromStream(ms); } }
public CERptPrimeraComunion MostrarReportePrimeraComunion(int idRegistroSacramento) { SqlCommand cmd; SqlDataReader dr; CERptPrimeraComunion obj = new CERptPrimeraComunion(); try { ConectarBD(); cmd = new SqlCommand("Sp_Reporte_Primera_Comunion", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@IdSacramento", SqlDbType.Int).Value = idRegistroSacramento; dr = cmd.ExecuteReader(); if (dr.Read()) { obj = new CERptPrimeraComunion() { Parroquia = dr["Lugar"].ToString(), Fecha = dr.GetDateTime(2), Hoy = DateTime.Today, Empleado = dr["Empleado"].ToString(), Feligres = dr["Feligres"].ToString(), Logo = dr.GetBoolean(4) ? (byte[])dr["Logo"] : null }; } return(obj); } catch (Exception ex) { throw new Exception("Error al solicitar los datos. ", ex); } finally { CerrarBD(); } }