Example #1
0
        public int ActualizarRegistroSacramento(CESacramento objS)
        {
            int resultado;

            try
            {
                SqlCommand cmd = new SqlCommand("Sp_Actualizar_RegistroSacramento", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@Id_Registro_Sacramento", SqlDbType.Int).Value = objS.Id_Registro_Sacramento;
                cmd.Parameters.Add("@Id_Sacramento", SqlDbType.Int).Value          = objS.Id_Sacramento;
                cmd.Parameters.Add("@Fecha", SqlDbType.Date).Value             = objS.Fecha;
                cmd.Parameters.Add("@Num_Identidad", SqlDbType.Char, 20).Value = objS.Num_Identidad;
                cmd.Parameters.Add("@Id_Lugar", SqlDbType.Int).Value           = objS.Id_Lugar;
                cmd.Parameters.Add("@Numero_Libro", SqlDbType.Int).Value       = objS.Numero_Libro;
                cmd.Parameters.Add("@Numero_Pagina", SqlDbType.Int).Value      = objS.Numero_Pagina;
                cmd.Parameters.Add("@Numero_Acta", SqlDbType.Int).Value        = objS.Numero_Acta;
                cmd.Parameters.Add("@Id_Usuario", SqlDbType.Int).Value         = objS.Id_Usuario;
                cmd.Parameters.Add("@Nota_Marginal", SqlDbType.NVarChar).Value = objS.Nota_Marginal;

                ConectarBD();
                resultado = cmd.ExecuteNonQuery();
                cmd.Dispose();
            }
            catch (Exception ex)
            {
                throw new Exception("Error al tratar de almacenar el registro de sacramento", ex);
            }
            finally
            {
                CerrarBD();
            }

            return(resultado);
        }
Example #2
0
        private void MostrarDatosMatrinmonio(int id)
        {
            CNFeligres   objfeligres                   = new CNFeligres();
            CNSacramento objObtenerSacramento          = new CNSacramento();
            CESacramento objSacramento                 = objObtenerSacramento.ObtenerSacramento(id);
            List <CEPadrinoPorFeligres>    objPadrinos = objObtenerSacramento.ObtenerPadrinosFeligres(id);
            List <CESacramentoPorFeligres> objNovios   = objObtenerSacramento.SeleccionarNoviosMatrimonio(id);
            CESacramentoPorFeligres        objFeligres = objObtenerSacramento.ObtenerFeligresSacramento(id);
            CEPadrinoPorFeligres           objPadrinoH = new CEPadrinoPorFeligres();
            CEPadrinoPorFeligres           objMadrinaH = new CEPadrinoPorFeligres();
            CEPadrinoPorFeligres           objPadrinoM = new CEPadrinoPorFeligres();
            CEPadrinoPorFeligres           objMadrinaM = new CEPadrinoPorFeligres();

            txtIdRegistro.EditValue = objSacramento.Id_Registro_Sacramento;
            deFecha.EditValue       = objSacramento.Fecha;
            slueEmpleado.EditValue  = objSacramento.Num_Identidad.ToString().Trim();
            lueLugar.EditValue      = objSacramento.Id_Lugar;
            txtNumLibro.EditValue   = objSacramento.Numero_Libro;
            txtNumPagina.EditValue  = objSacramento.Numero_Pagina;
            txtNumActa.EditValue    = objSacramento.Numero_Acta;

            slueNovio.EditValue = objNovios[0].Feligres_Num_Identidad.ToString();
            slueNovia.EditValue = objNovios[1].Feligres_Num_Identidad.ToString();

            foreach (CEPadrinoPorFeligres padrino in objPadrinos)
            {
                if (padrino.De_Novio)
                {
                    if (objfeligres.ObtenerFeligres(padrino.Feligres_Num_Identidad).IdSexo == 1)
                    {
                        objMadrinaH = padrino;
                    }
                    else
                    {
                        objPadrinoH = padrino;
                    }
                }
                else
                {
                    if (objfeligres.ObtenerFeligres(padrino.Feligres_Num_Identidad).IdSexo == 1)
                    {
                        objMadrinaM = padrino;
                    }
                    else
                    {
                        objPadrinoM = padrino;
                    }
                }
            }

            slueMadrinaNovio.EditValue = objMadrinaH.Feligres_Num_Identidad;
            sluePadrinoNovio.EditValue = objPadrinoH.Feligres_Num_Identidad;
            slueMadrinaNovia.EditValue = objMadrinaM.Feligres_Num_Identidad;
            sluePadrinoNovia.EditValue = objPadrinoM.Feligres_Num_Identidad;
        }
Example #3
0
        private void MostrarUnSacramento(int id)
        {
            CNFeligres   feligres                   = new CNFeligres();
            CNSacramento objObtenerSacramento       = new CNSacramento();
            CESacramento objSacramento              = objObtenerSacramento.ObtenerSacramento(id);
            List <CEPadrinoPorFeligres> objPadrinos = objObtenerSacramento.ObtenerPadrinosFeligres(id);
            CESacramentoPorFeligres     objFeligres = objObtenerSacramento.ObtenerFeligresSacramento(id);

            txtIdRegistro.EditValue   = objSacramento.Id_Registro_Sacramento;
            lueSacramentos.EditValue  = objSacramento.Id_Sacramento;
            deFecha.EditValue         = objSacramento.Fecha;
            slueEmpleado.EditValue    = objSacramento.Num_Identidad.ToString().Trim();
            lueLugar.EditValue        = objSacramento.Id_Lugar;
            txtNumLibro.EditValue     = objSacramento.Numero_Libro;
            txtNumPagina.EditValue    = objSacramento.Numero_Pagina;
            txtNumActa.EditValue      = objSacramento.Numero_Acta;
            txtNotaMarginal.EditValue = objSacramento.Nota_Marginal == null ? "" : objSacramento.Nota_Marginal.ToString();

            slueFeligres.EditValue = objFeligres.Feligres_Num_Identidad.ToString().Trim();

            if (objPadrinos.Count == 1)
            {
                CEFeligres padrino = feligres.ObtenerFeligres(objPadrinos[0].Feligres_Num_Identidad);
                if (padrino.IdSexo == 1)
                {
                    slueMadrina.EditValue = objPadrinos[0].Feligres_Num_Identidad;
                }
                else
                {
                    sluePadrino.EditValue = objPadrinos[0].Feligres_Num_Identidad;
                }
            }
            else if (objPadrinos.Count == 2)
            {
                CEFeligres padrino = feligres.ObtenerFeligres(objPadrinos[0].Feligres_Num_Identidad);
                if (padrino.IdSexo == 1)
                {
                    slueMadrina.EditValue = objPadrinos[0].Feligres_Num_Identidad;
                    sluePadrino.EditValue = objPadrinos[1].Feligres_Num_Identidad;
                }
                else
                {
                    sluePadrino.EditValue = objPadrinos[0].Feligres_Num_Identidad;
                    slueMadrina.EditValue = objPadrinos[1].Feligres_Num_Identidad;
                }
            }
        }
Example #4
0
        public CESacramento MostrarUnSacramento(int Id_Registro_Sacramento)
        {
            SqlCommand    cmd;
            SqlDataReader dr;
            CESacramento  objSacramento = new CESacramento();

            try
            {
                ConectarBD();
                cmd             = new SqlCommand("Sp_Mostrar_Un_Sacramento", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@Id_Registro_Sacramento", SqlDbType.Int).Value = Id_Registro_Sacramento;
                dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    objSacramento.Id_Registro_Sacramento = int.Parse(dr["Id_Registro_Sacramento"].ToString());
                    objSacramento.Id_Sacramento          = int.Parse(dr["Id_Sacramento"].ToString());
                    objSacramento.Fecha         = dr.GetDateTime(2);
                    objSacramento.Num_Identidad = dr["Num_Identidad"].ToString();
                    objSacramento.Id_Lugar      = int.Parse(dr["Id_Lugar"].ToString());
                    objSacramento.Numero_Libro  = int.Parse(dr["Numero_Libro"].ToString());
                    objSacramento.Numero_Pagina = int.Parse(dr["Numero_Pagina"].ToString());
                    objSacramento.Numero_Acta   = int.Parse(dr["Numero_Acta"].ToString());
                    objSacramento.Nota_Marginal = dr["Nota_Marginal"].ToString();
                }
                return(objSacramento);
            }
            catch (Exception ex)
            {
                throw new Exception("Error al solicitar los datos", ex);
            }
            finally
            {
                CerrarBD();
            }
        }
Example #5
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            this.Validate();
            if (Validar())
            {
                int idRegistro;

                CNSacramento objActualizarRegistro = new CNSacramento();
                CESacramento objSacramento         = new CESacramento()
                {
                    Id_Registro_Sacramento = int.Parse(txtIdRegistro.EditValue.ToString()),
                    Id_Sacramento          = int.Parse(lueSacramentos.EditValue.ToString()),
                    Fecha         = deFecha.DateTime.Date,
                    Num_Identidad = slueEmpleado.EditValue.ToString(),
                    Id_Lugar      = int.Parse(lueLugar.EditValue.ToString()),
                    Numero_Libro  = int.Parse(txtNumLibro.EditValue.ToString()),
                    Numero_Pagina = int.Parse(txtNumPagina.EditValue.ToString()),
                    Numero_Acta   = int.Parse(txtNumActa.EditValue.ToString()),
                    Id_Usuario    = Funciones.Funciones.idUsuario,
                    Nota_Marginal = txtNotaMarginal.EditValue.ToString()
                };

                idRegistro = int.Parse(txtIdRegistro.EditValue.ToString());

                CESacramentoPorFeligres objSacramentoFeligres = new CESacramentoPorFeligres()
                {
                    Id_Registro_Sacramento = idRegistro,
                    Feligres_Num_Identidad = slueFeligres.EditValue.ToString()
                };

                CEPadrinoPorFeligres objPadrino = new CEPadrinoPorFeligres()
                {
                    Id_Registro_Sacramento = idRegistro,
                    Feligres_Num_Identidad = sluePadrino.EditValue.ToString()
                };

                CEPadrinoPorFeligres objMadrina = new CEPadrinoPorFeligres()
                {
                    Id_Registro_Sacramento = idRegistro,
                    Feligres_Num_Identidad = slueMadrina.EditValue.ToString()
                };

                if (objActualizarRegistro.ActualizarRegistroSacramento(objSacramento) > 0)
                {
                    if (objPadrino.Feligres_Num_Identidad != "" && String.IsNullOrEmpty(padrinoAnterior))
                    {
                        objActualizarRegistro.InsertarPadrinoPorFeligresNovios(objPadrino);
                    }
                    else if (objPadrino.Feligres_Num_Identidad != "")
                    {
                        objActualizarRegistro.ActualizarPadrinosPorFeligres(objPadrino, padrinoAnterior);
                    }

                    if (objMadrina.Feligres_Num_Identidad != "" && String.IsNullOrEmpty(madrinaAnterior))
                    {
                        objActualizarRegistro.InsertarPadrinoPorFeligresNovios(objMadrina);
                    }
                    else if (objMadrina.Feligres_Num_Identidad != "")
                    {
                        objActualizarRegistro.ActualizarPadrinosPorFeligres(objMadrina, madrinaAnterior);
                    }

                    XtraMessageBox.Show("Registro actualizado satisfactoriamente.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Limpiar();
                    HabilitarControles(true, false, false, false, false, true);
                    slueFeligres.Enabled = true;
                    LlenarGridSacramentos();
                }
                else
                {
                    XtraMessageBox.Show("Error al almacenar el registro.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #6
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            CNSacramento objInsertarRegistro = new CNSacramento();

            CESacramentoPorFeligres objSF = new CESacramentoPorFeligres()
            {
                Feligres_Num_Identidad = slueFeligres.EditValue.ToString().Trim()
            };

            if (objInsertarRegistro.Existe_Registro(objSF, int.Parse(lueSacramentos.EditValue.ToString())))
            {
                XtraMessageBox.Show("Este feligrés ya tiene registrado este sacramento.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                this.Validate();
                if (Validar())
                {
                    int idRegistro;
                    int resultado = 1;

                    CESacramento objSacramento = new CESacramento()
                    {
                        Id_Sacramento = int.Parse(lueSacramentos.EditValue.ToString()),
                        Fecha         = deFecha.DateTime.Date,
                        Num_Identidad = slueEmpleado.EditValue.ToString(),
                        Id_Lugar      = int.Parse(lueLugar.EditValue.ToString()),
                        Numero_Libro  = int.Parse(txtNumLibro.EditValue.ToString()),
                        Numero_Pagina = int.Parse(txtNumPagina.EditValue.ToString()),
                        Numero_Acta   = int.Parse(txtNumActa.EditValue.ToString()),
                        Id_Usuario    = Funciones.Funciones.idUsuario,
                        Nota_Marginal = txtNotaMarginal.EditValue.ToString()
                    };

                    idRegistro = objInsertarRegistro.NuevoRegistroSacramento(objSacramento);

                    CESacramentoPorFeligres objSacramentoFeligres = new CESacramentoPorFeligres()
                    {
                        Id_Registro_Sacramento = idRegistro,
                        Feligres_Num_Identidad = slueFeligres.EditValue.ToString()
                    };

                    CEPadrinoPorFeligres objPadrino = new CEPadrinoPorFeligres()
                    {
                        Id_Registro_Sacramento = idRegistro,
                        Feligres_Num_Identidad = sluePadrino.EditValue.ToString(),
                        De_Novio = false
                    };

                    CEPadrinoPorFeligres objMadrina = new CEPadrinoPorFeligres()
                    {
                        Id_Registro_Sacramento = idRegistro,
                        Feligres_Num_Identidad = slueMadrina.EditValue.ToString(),
                        De_Novio = false
                    };

                    if (objInsertarRegistro.RegistroSacramentoPorFeligres(objSacramentoFeligres) > 0)
                    {
                        if (objPadrino.Feligres_Num_Identidad != "")
                        {
                            resultado = objInsertarRegistro.RegistroPadrinoPorFeligres(objPadrino);
                        }

                        if (objMadrina.Feligres_Num_Identidad != "")
                        {
                            resultado = objInsertarRegistro.RegistroPadrinoPorFeligres(objMadrina);
                        }

                        if (resultado > 0)
                        {
                            XtraMessageBox.Show("Registro almacenado satisfactoriamente.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            XtraMessageBox.Show("Error al almacenar el registro.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        Limpiar();
                        HabilitarControles(true, false, false, false, false, true);
                        LlenarGridSacramentos();
                    }
                    else
                    {
                        XtraMessageBox.Show("Error al almacenar el registro.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #7
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            if (!ValidarNovios())
            {
                XtraMessageBox.Show("Uno de los novios ya está casado con otra persona.");
            }
            else
            {
                this.Validate();
                if (Validar())
                {
                    int          idRegistro;
                    CNSacramento objInsertarRegistro = new CNSacramento();

                    CESacramento objSacramento = new CESacramento()
                    {
                        Id_Sacramento = idSacramento,
                        Fecha         = deFecha.DateTime.Date,
                        Num_Identidad = slueEmpleado.EditValue.ToString(),
                        Id_Lugar      = int.Parse(lueLugar.EditValue.ToString()),
                        Numero_Libro  = int.Parse(txtNumLibro.EditValue.ToString()),
                        Numero_Pagina = int.Parse(txtNumPagina.EditValue.ToString()),
                        Numero_Acta   = int.Parse(txtNumActa.EditValue.ToString()),
                        Id_Usuario    = 6
                    };

                    if (nuevoRegistro)
                    {
                        idRegistro = objInsertarRegistro.NuevoRegistroSacramento(objSacramento);
                    }
                    else
                    {
                        idRegistro = int.Parse(txtIdRegistro.EditValue.ToString());
                    }

                    CESacramentoPorFeligres objNovio = new CESacramentoPorFeligres()
                    {
                        Id_Registro_Sacramento = idRegistro,
                        Feligres_Num_Identidad = slueNovio.EditValue.ToString()
                    };
                    CESacramentoPorFeligres objNovia = new CESacramentoPorFeligres()
                    {
                        Id_Registro_Sacramento = idRegistro,
                        Feligres_Num_Identidad = slueNovia.EditValue.ToString()
                    };

                    CEPadrinoPorFeligres objPadrinoNovio = new CEPadrinoPorFeligres()
                    {
                        Id_Registro_Sacramento = idRegistro,
                        Feligres_Num_Identidad = sluePadrinoNovio.EditValue.ToString(),
                        De_Novio = true
                    };

                    CEPadrinoPorFeligres objMadrinaNovio = new CEPadrinoPorFeligres()
                    {
                        Id_Registro_Sacramento = idRegistro,
                        Feligres_Num_Identidad = slueMadrinaNovio.EditValue.ToString(),
                        De_Novio = true
                    };
                    CEPadrinoPorFeligres objPadrinoNovia = new CEPadrinoPorFeligres()
                    {
                        Id_Registro_Sacramento = idRegistro,
                        Feligres_Num_Identidad = sluePadrinoNovia.EditValue.ToString(),
                        De_Novio = false
                    };

                    CEPadrinoPorFeligres objMadrinaNovia = new CEPadrinoPorFeligres()
                    {
                        Id_Registro_Sacramento = idRegistro,
                        Feligres_Num_Identidad = slueMadrinaNovia.EditValue.ToString(),
                        De_Novio = false
                    };

                    if (objInsertarRegistro.RegistroSacramentoPorFeligres(objNovio) > 0 && objInsertarRegistro.RegistroSacramentoPorFeligres(objNovia) > 0)
                    {
                        if (objInsertarRegistro.InsertarPadrinoPorFeligresNovios(objPadrinoNovio) > 0 && objInsertarRegistro.InsertarPadrinoPorFeligresNovios(objMadrinaNovio) > 0 && objInsertarRegistro.InsertarPadrinoPorFeligresNovios(objPadrinoNovia) > 0 && objInsertarRegistro.InsertarPadrinoPorFeligresNovios(objMadrinaNovia) > 0)
                        {
                            XtraMessageBox.Show("Registro almacenado satisfactoriamente.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            XtraMessageBox.Show("Error al almacenar el registro.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        Limpiar();
                        HabilitarControles(true, false, false, false, false);
                        this.Close();
                    }
                    else
                    {
                        XtraMessageBox.Show("Error al almacenar el registro.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Example #8
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            this.Validate();
            if (Validar())
            {
                int idRegistro;

                CNSacramento objActualizarRegistro = new CNSacramento();
                CESacramento objSacramento         = new CESacramento()
                {
                    Id_Registro_Sacramento = int.Parse(txtIdRegistro.EditValue.ToString()),
                    Id_Sacramento          = int.Parse(idSacramento.ToString()),
                    Fecha         = deFecha.DateTime.Date,
                    Num_Identidad = slueEmpleado.EditValue.ToString(),
                    Id_Lugar      = int.Parse(lueLugar.EditValue.ToString()),
                    Numero_Libro  = int.Parse(txtNumLibro.EditValue.ToString()),
                    Numero_Pagina = int.Parse(txtNumPagina.EditValue.ToString()),
                    Numero_Acta   = int.Parse(txtNumActa.EditValue.ToString()),
                    Id_Usuario    = 6
                };

                idRegistro = int.Parse(txtIdRegistro.EditValue.ToString());

                CEPadrinoPorFeligres objPadrinoNovio = new CEPadrinoPorFeligres()
                {
                    Id_Registro_Sacramento = idRegistro,
                    Feligres_Num_Identidad = sluePadrinoNovio.EditValue.ToString()
                };

                CEPadrinoPorFeligres objMadrinaNovio = new CEPadrinoPorFeligres()
                {
                    Id_Registro_Sacramento = idRegistro,
                    Feligres_Num_Identidad = slueMadrinaNovio.EditValue.ToString(),
                    De_Novio = true
                };
                CEPadrinoPorFeligres objPadrinoNovia = new CEPadrinoPorFeligres()
                {
                    Id_Registro_Sacramento = idRegistro,
                    Feligres_Num_Identidad = sluePadrinoNovia.EditValue.ToString()
                };

                CEPadrinoPorFeligres objMadrinaNovia = new CEPadrinoPorFeligres()
                {
                    Id_Registro_Sacramento = idRegistro,
                    Feligres_Num_Identidad = slueMadrinaNovia.EditValue.ToString()
                };

                if (objActualizarRegistro.ActualizarRegistroSacramento(objSacramento) > 0)
                {
                    if (objPadrinoNovio.Feligres_Num_Identidad != "")
                    {
                        objActualizarRegistro.ActualizarPadrinosPorFeligres(objPadrinoNovio, padrinoAnteriorH);
                    }

                    if (objMadrinaNovio.Feligres_Num_Identidad != "")
                    {
                        objActualizarRegistro.ActualizarPadrinosPorFeligres(objMadrinaNovio, madrinaAnteriorH);
                    }

                    if (objPadrinoNovia.Feligres_Num_Identidad != "")
                    {
                        objActualizarRegistro.ActualizarPadrinosPorFeligres(objPadrinoNovia, padrinoAnteriorM);
                    }

                    if (objMadrinaNovia.Feligres_Num_Identidad != "")
                    {
                        objActualizarRegistro.ActualizarPadrinosPorFeligres(objMadrinaNovia, madrinaAnteriorM);
                    }

                    XtraMessageBox.Show("Registro actualizado satisfactoriamente.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Limpiar();
                    HabilitarControles(true, false, false, false, false);
                    this.Close();
                }
                else
                {
                    XtraMessageBox.Show("Error al almacenar el registro.", "Parroquia", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #9
0
 public int ActualizarRegistroSacramento(CESacramento objSacramento)
 {
     return(objS.ActualizarRegistroSacramento(objSacramento));
 }
Example #10
0
 public int NuevoRegistroSacramento(CESacramento objSacramento)
 {
     return(objS.InsertarRegistroSacramento(objSacramento));
 }