Exemplo n.º 1
0
        private bool ValidarNovios()
        {
            CNSacramento objSacramento = new CNSacramento();

            //Se toma los datos del novio para verificar si no essta casado con otra persona.
            CESacramentoPorFeligres objSNovio = new CESacramentoPorFeligres()
            {
                Feligres_Num_Identidad = slueNovio.EditValue.ToString().Trim()
            };

            //Se toma los datos del novia para verificar si no essta casado con otra persona.
            CESacramentoPorFeligres objSNovia = new CESacramentoPorFeligres()
            {
                Feligres_Num_Identidad = slueNovia.EditValue.ToString().Trim()
            };

            if (objSacramento.Existe_Registro(objSNovio, idSacramento))
            {
                slueNovio.ErrorText = "Ya está casado con otra persona.";
                return(false);
            }

            if (objSacramento.Existe_Registro(objSNovia, idSacramento))
            {
                slueNovia.ErrorText = "Ya está casado con otra persona.";
                return(false);
            }

            return(true);
        }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
        public void LlenarCombobox()
        {
            CNSacramento objS = new CNSacramento();

            lueSacramentos.Properties.DataSource = objS.ListadoSacramentos().Tables["Sacramentos"];

            slueMadrina.Properties.DataSource = objS.ListadoFeligresSexo(1).Tables["Feligres"];
            sluePadrino.Properties.DataSource = objS.ListadoFeligresSexo(2).Tables["Feligres"];

            slueFeligres.Properties.DataSource = objS.ListadoTodoFeligreses().Tables["ListadoFeligres"];

            slueEmpleado.Properties.DataSource = objS.ListadoEmpleado().Tables["Empleados"];

            lueLugar.Properties.DataSource = objS.ListadoLugar().Tables["Lugar"];
        }
Exemplo n.º 4
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;
                }
            }
        }
Exemplo n.º 5
0
        private void LlenarCombobox()
        {
            CNSacramento objS = new CNSacramento();

            slueNovia.Properties.DataSource = objS.ListadoFeligresSexo2(1).Tables["Feligres"];
            slueNovio.Properties.DataSource = objS.ListadoFeligresSexo2(2).Tables["Feligres"];

            slueMadrinaNovio.Properties.DataSource = objS.ListadoFeligresSexo(1).Tables["Feligres"];
            sluePadrinoNovio.Properties.DataSource = objS.ListadoFeligresSexo(2).Tables["Feligres"];

            slueMadrinaNovia.Properties.DataSource = objS.ListadoFeligresSexo(1).Tables["Feligres"];
            sluePadrinoNovia.Properties.DataSource = objS.ListadoFeligresSexo(2).Tables["Feligres"];

            slueEmpleado.Properties.DataSource = objS.ListadoEmpleado().Tables["Empleados"];

            lueLugar.Properties.DataSource = objS.ListadoLugar().Tables["Lugar"];
        }
Exemplo n.º 6
0
        private void LlenarGridSacramentos()
        {
            CNSacramento objS = new CNSacramento();

            gcDatosSacramentos.DataSource = objS.ListadoRegistroSacramentos().Tables["ListadoRegistroSacramentos"];
        }
Exemplo n.º 7
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);
                }
            }
        }
Exemplo n.º 8
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);
                    }
                }
            }
        }
Exemplo n.º 9
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);
                    }
                }
            }
        }
Exemplo n.º 10
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);
                }
            }
        }