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 CERptMatrimonio MostrarReporteMatrimonio(int idRegistroSacramento) { SqlCommand cmd; SqlDataReader dr; CERptMatrimonio obj = new CERptMatrimonio(); try { ConectarBD(); cmd = new SqlCommand("Sp_Reporte_Matrimonio", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@IdSacramento", SqlDbType.Int).Value = idRegistroSacramento; dr = cmd.ExecuteReader(); if (dr.Read()) { obj = new CERptMatrimonio() { Parroquia = dr["Lugar"].ToString(), Fecha = dr.GetDateTime(2), Hoy = DateTime.Today, Empleado = dr["Empleado"].ToString(), Novio = dr["Novio"].ToString(), Novia = dr["Novia"].ToString(), Padrino1 = dr["Padrino_Novia"].ToString(), Madrina1 = dr["Madrina_Novia"].ToString(), Padrino2 = dr["Padrino_Novio"].ToString(), Madrina2 = dr["Madrina_Novio"].ToString(), Logo = dr.GetBoolean(9) ? (byte [])dr["Logo"] : null }; } return(obj); } catch (Exception ex) { throw new Exception("Error al solicitar los datos. ", ex); } finally { CerrarBD(); } }
public RptMatrimonio(CERptMatrimonio obj) { InitializeComponent(); txtLugar.Text = Funciones.Funciones.nombreParroquia.ToUpper(); txtLugar2.Text = "" + obj.Parroquia; txtSubtitulo.Text = txtSubtitulo.Text.Replace("p2", Funciones.Funciones.nombreParroquia.ToUpper()); txtEmp.Text = txtEmp.Text.Replace("p1", obj.Empleado); txtNovia.Text = obj.Novia; txtNovio.Text = obj.Novio; txtMadrinaNovia.Text = obj.Madrina1; txtMadrinaNovio.Text = obj.Madrina2; txtPadrinoNovia.Text = obj.Padrino1; txtPadrinoNovio.Text = obj.Padrino2; txtFecha.Text = obj.Fecha.Day.ToString() + " de " + obj.Fecha.ToString("MMMM", CultureInfo.CreateSpecificCulture("es")) + " del " + obj.Fecha.Year.ToString(); 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); } }