コード例 #1
0
        private void VerCorresponsabilidadDeMenor(long IdMenor, TipoAccion TipoAccion)
        {
            ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();
            GrupoFamiliar       grupofamiliar       = new GrupoFamiliar();

            grupofamiliar = modelogrupofamiliar.RecuperarTitularHabilitado(IdSeleccionado);

            if (grupofamiliar != null)
            {
                this.Cursor = Cursors.Wait;
                frmCorresponsabilidadMenor objCorresponsabilidadMenorWindow = new frmCorresponsabilidadMenor();
                objCorresponsabilidadMenorWindow.IdFamilia      = IdSeleccionado;
                objCorresponsabilidadMenorWindow.IdSeleccionado = IdMenor;
                objCorresponsabilidadMenorWindow.TipoAccion     = TipoAccion;
                objCorresponsabilidadMenorWindow.Owner          = this;
                objCorresponsabilidadMenorWindow.ShowDialog();
                this.Cursor = Cursors.Arrow;
                objCorresponsabilidadMenorWindow = null;
            }
            else
            {
                MessageBox.Show("Se requiere especificar previamente titular de pago.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            CantidadDeControles = 4;

            ////this.lblDepartamento.Content = "";
            ////this.lblEstablecimiento.Content = "";

            ModeloMadre modelomadre = new ModeloMadre();
            Madre       madre       = new Madre();

            madre = modelomadre.Recuperar(IdSeleccionado);

            if (madre != null)
            {
                this.lblNombresMadre.Content         = madre.NombreCompleto;
                this.lblFechaNacimientoMadre.Content = string.Format("{0:dd/MM/yyyy}", madre.FechaNacimiento);
            }
            else
            {
                this.lblNombresMadre.Content         = "";
                this.lblFechaNacimientoMadre.Content = "";
            }

            ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();

            _grupofamiliar = modelogrupofamiliar.RecuperarPorMadreDeFamilia(IdFamilia, IdSeleccionado);

            if (_grupofamiliar.TitularPagoVigente == true)
            {
                this.lblNombreTitular.Content     = this.lblNombresMadre.Content;
                this.lblParentesco.Content        = "";
                this.lblParentescoTitular.Content = "MADRE GESTANTE";
            }
            else
            {
                _grupofamiliar = modelogrupofamiliar.RecuperarTitularHabilitado(IdFamilia);

                if (_grupofamiliar != null)
                {
                    ModeloTutor modelotutor = new ModeloTutor();
                    Tutor       tutor       = new Tutor();
                    tutor = modelotutor.Recuperar(_grupofamiliar.IdTutor.Value);
                    this.lblNombreTitular.Content = tutor.NombreCompleto;

                    ModeloTipoParentesco modelotipoparentesco = new ModeloTipoParentesco();
                    TipoParentesco       tipoparentesco       = new TipoParentesco();

                    tipoparentesco = modelotipoparentesco.Recuperar(_grupofamiliar.IdTipoParentesco.Value);
                    this.lblParentescoTitular.Content = tipoparentesco.Descripcion;
                }
                else
                {
                    this.lblNombreTitular.Content     = "";
                    this.lblParentescoTitular.Content = "";
                }
            }

            ModeloCorresponsabilidadMadre modelocorresponsabilidadmadre = new ModeloCorresponsabilidadMadre();

            IdCorresponsabilidadMadre = modelocorresponsabilidadmadre.RecuperarLaUltimaCorresponsabilidadValidaDeMadre(IdSeleccionado);

            ValoresPorDefecto();

            if (IdCorresponsabilidadMadre > 0)
            {
                RecuperarCorresponsabilidadMadre();
            }
            else
            {
                this.txtCodigoFormulario.IsEnabled = true;
                this.dtpFechaFUM.IsEnabled         = true;
                this.dtpFechaInscripcion.IsEnabled = true;
                this.dtpFechaUltimoParto.IsEnabled = true;
                this.txtNumeroEmbarazo.IsEnabled   = true;
                this.chkARO.IsEnabled           = true;
                this.rdbNueva.IsEnabled         = true;
                this.rdbTransferencia.IsEnabled = true;
                this.cmdGuardar.IsEnabled       = true;
            }

            if (TipoAccion == TipoAccion.Detalle)
            {
                this.txtCodigoFormulario.IsEnabled = false;
                this.dtpFechaFUM.IsEnabled         = false;
                this.dtpFechaInscripcion.IsEnabled = false;
                this.dtpFechaSalida.IsEnabled      = false;
                this.dtpFechaUltimoParto.IsEnabled = false;
                this.txtNumeroEmbarazo.IsEnabled   = false;
                this.chkARO.IsEnabled                 = false;
                this.chkSalida.IsEnabled              = false;
                this.rdbAborto.IsEnabled              = false;
                this.rdbCumplimiento.IsEnabled        = false;
                this.rdbFallecimiento.IsEnabled       = false;
                this.rdbIncumplimiento.IsEnabled      = false;
                this.rdbNueva.IsEnabled               = false;
                this.rdbObitoFetal.IsEnabled          = false;
                this.rdbTransferencia.IsEnabled       = false;
                this.rdbTransferenciaSalida.IsEnabled = false;
                this.txtAutorizado.IsEnabled          = false;
                this.txtCargo.IsEnabled               = false;
                this.cmdGuardar.IsEnabled             = false;
            }
        }
コード例 #3
0
ファイル: frmMadre.xaml.cs プロジェクト: hernanUNO6/BJA
        private void cmdAceptar_Click(object sender, RoutedEventArgs e)
        {
            ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();
            GrupoFamiliar       gf = new GrupoFamiliar();

            gf = modelogrupofamiliar.RecuperarTitularHabilitado(IdFamilia);
            bool ok  = false;
            bool OK  = false;
            int  OKM = 0;

            if (!(txtDocumentoIdentidad.Text.Length > 0))
            {
                MessageBox.Show("Se requiere especificar documento de identidad.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if ((Convert.ToInt64(cboTipoDocumentoIdentidad.SelectedIndex) < 0))
            {
                MessageBox.Show("Se requiere especificar tipo de documento de identidad.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if (!(txtPaterno.Text.Length > 0) && !(txtMaterno.Text.Length > 0))
            {
                MessageBox.Show("Se requiere especificar apellidos.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if (!(txtNombres.Text.Length > 0))
            {
                MessageBox.Show("Se requiere especificar nombre.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if (!(txtNombreCompleto.Text.Length > 0))
            {
                MessageBox.Show("Se requiere especificar nombre completo.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if ((Convert.ToInt64(cboDepartamento.SelectedIndex) < 0))
            {
                ok = true;
                MessageBox.Show("Se requiere especificar departamento.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            else if ((Convert.ToInt64(cboProvincia.SelectedIndex) < 0))
            {
                MessageBox.Show("Se requiere especificar provincia.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if ((Convert.ToInt64(cboMunicipio.SelectedIndex) < 0))
            {
                MessageBox.Show("Se requiere especificar municipio.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if (!(txtLugarNacimiento.Text.Length > 0))
            {
                MessageBox.Show("Se requiere especificar lugar de nacimiento.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }

            if (ok == false)
            {
                if (txtPaterno.Text != txtMaternoFamilia.Text)
                {
                    if (MessageBox.Show("El apellido paterno de la madre no es igual al apellido materno de la familia. ¿Desea continua?", "Advertencia", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                    {
                        ok = true;
                    }
                }
            }

            if (gf == null)
            {
                if (ok == false)
                {
                    switch (MessageBox.Show("¿Desea guardar los datos correspondiente a este madre?", "Consulta", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
                    {
                    case MessageBoxResult.Yes:
                        OKM = 1;
                        break;

                    case MessageBoxResult.No:
                        OKM = 2;
                        break;

                    case MessageBoxResult.Cancel:
                        OKM = 3;
                        break;
                    }

                    if (OKM == 1)
                    {
                        DateTime FechitaDeNacimiento;
                        DateTime FechitaActual;

                        FechitaDeNacimiento = dtpFechaNacimiento.SelectedDate.Value;
                        FechitaActual       = DateTime.Now;
                        FechitaActual       = FechitaActual.AddYears(-16);

                        if (FechitaDeNacimiento > FechitaActual)
                        {
                            if (MessageBox.Show("La fecha de nacimiento de la madre es: " + string.Format("{0:dd/MM/yyyy}", FechitaDeNacimiento) + ", lo cual a la fecha determina que es menor de edad. ¿Desea registrar ahora un nuevo titular de pago para la familia?", "Advertencia", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                            {
                                this.Cursor = Cursors.Wait;
                                frmTutor objTutorWindow = new frmTutor();
                                objTutorWindow.IdFamilia      = IdFamilia;
                                objTutorWindow.IdSeleccionado = 0;
                                objTutorWindow.TipoAccion     = TipoAccion.Nuevo;
                                objTutorWindow.Owner          = this;
                                objTutorWindow.ShowDialog();
                                this.Cursor = Cursors.Arrow;
                                if (objTutorWindow.Resultado == true)
                                {
                                    GrupoFamiliar grupofamiliar = new GrupoFamiliar();

                                    grupofamiliar = modelogrupofamiliar.RecuperarPorTutorDeFamilia(IdFamilia, objTutorWindow.IdSeleccionado);
                                    grupofamiliar.TitularPagoVigente = true;
                                    modelogrupofamiliar.Editar(grupofamiliar.Id, grupofamiliar);

                                    OK = true;
                                }
                                objTutorWindow = null;
                            }
                        }
                    }
                }
            }
            else
            {
                switch (MessageBox.Show("¿Desea guardar los datos correspondiente a este madre?", "Consulta", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
                {
                case MessageBoxResult.Yes:
                    OKM = 1;
                    break;

                case MessageBoxResult.No:
                    OKM = 2;
                    break;

                case MessageBoxResult.Cancel:
                    OKM = 3;
                    break;
                }
            }

            if (ok == false)
            {
                switch (OKM)
                {
                case 1:
                    ModeloMadre modelomadre = new ModeloMadre();

                    _madre.DocumentoIdentidad = txtDocumentoIdentidad.Text;
                    switch (cboTipoDocumentoIdentidad.SelectedIndex)
                    {
                    case 0:
                        _madre.TipoDocumentoIdentidad = TipoDocumentoIdentidad.CarnetIdentidad;
                        break;

                    case 1:
                        _madre.TipoDocumentoIdentidad = TipoDocumentoIdentidad.CertificadoNacimiento;
                        break;

                    case 2:
                        _madre.TipoDocumentoIdentidad = TipoDocumentoIdentidad.Pasaporte;
                        break;
                    }
                    _madre.PrimerApellido      = txtPaterno.Text;
                    _madre.SegundoApellido     = txtMaterno.Text;
                    _madre.TercerApellido      = txtConyuge.Text;
                    _madre.Nombres             = txtNombres.Text;
                    _madre.NombreCompleto      = txtNombreCompleto.Text;
                    _madre.FechaNacimiento     = dtpFechaNacimiento.SelectedDate.Value;
                    _madre.Defuncion           = (chkDefuncion.IsChecked == true) ? true : false;
                    _madre.Observaciones       = "";
                    _madre.IdDepartamento      = Convert.ToInt64(cboDepartamento.SelectedValue);
                    _madre.IdProvincia         = Convert.ToInt64(cboProvincia.SelectedValue);
                    _madre.IdMunicipio         = Convert.ToInt64(cboMunicipio.SelectedValue);
                    _madre.LocalidadNacimiento = txtLugarNacimiento.Text;

                    if (IdSeleccionado > 0)
                    {
                        modelomadre.Editar(IdSeleccionado, _madre);
                    }
                    else
                    {
                        modelomadre.Crear(_madre);
                        IdSeleccionado = _madre.Id;

                        _grupofamiliar.IdFamilia         = IdFamilia;
                        _grupofamiliar.IdMadre           = _madre.Id;
                        _grupofamiliar.TipoGrupoFamiliar = TipoGrupoFamiliar.Madre;
                        if (gf == null)
                        {
                            if (OK == false)
                            {
                                _grupofamiliar.TitularPagoVigente = true;
                            }
                        }

                        modelogrupofamiliar.Crear(_grupofamiliar);
                    }

                    Resultado = true;

                    this.Close();
                    break;

                case 3:
                    IdSeleccionado = 0;
                    Resultado      = false;
                    this.Close();
                    break;
                }
            }
        }
コード例 #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            CantidadDeControles = 12;

            ////this.lblDepartamento.Content = "";
            ////this.lblEstablecimiento.Content = "";

            ModeloMenor modelomenor = new ModeloMenor();
            Menor       menor       = new Menor();

            menor = modelomenor.Recuperar(IdSeleccionado);

            if (menor != null)
            {
                this.lblNombresMenor.Content         = menor.PrimerApellido + " " + menor.SegundoApellido + " " + menor.Nombres;
                this.lblFechaNacimientoMenor.Content = string.Format("{0:dd/MM/yyyy}", menor.FechaNacimiento);
            }
            else
            {
                this.lblNombresMenor.Content         = "";
                this.lblFechaNacimientoMenor.Content = "";
            }

            ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();

            _grupofamiliar      = modelogrupofamiliar.RecuperarTitularHabilitado(IdFamilia);
            _grupofamiliarmadre = modelogrupofamiliar.RecuperarMadreDeFamilia(IdFamilia);

            if (_grupofamiliar != null)
            {
                if (_grupofamiliar.TipoGrupoFamiliar == TipoGrupoFamiliar.Madre)
                {
                    ModeloMadre modelomadre = new ModeloMadre();
                    Madre       madre       = new Madre();

                    madre = modelomadre.Recuperar(_grupofamiliar.IdMadre.Value);
                    this.lblNombreTitular.Content = madre.NombreCompleto;

                    this.lblParentescoTitular.Content = "MADRE";
                }
                else if (_grupofamiliar.TipoGrupoFamiliar == TipoGrupoFamiliar.Tutor)
                {
                    ModeloTutor modelotutor = new ModeloTutor();
                    Tutor       tutor       = new Tutor();
                    tutor = modelotutor.Recuperar(_grupofamiliar.IdTutor.Value);
                    this.lblNombreTitular.Content = tutor.NombreCompleto;

                    ModeloTipoParentesco modelotipoparentesco = new ModeloTipoParentesco();
                    TipoParentesco       tipoparentesco       = new TipoParentesco();

                    tipoparentesco = modelotipoparentesco.Recuperar(_grupofamiliar.IdTipoParentesco.Value);
                    this.lblParentescoTitular.Content = tipoparentesco.Descripcion;
                }
                else
                {
                    this.lblNombreTitular.Content     = "";
                    this.lblParentescoTitular.Content = "";
                }
            }
            else
            {
                this.lblNombreTitular.Content     = "";
                this.lblParentescoTitular.Content = "";
            }

            ModeloCorresponsabilidadMenor modelocorresponsabilidadmenor = new ModeloCorresponsabilidadMenor();

            IdCorresponsabilidadMenor = modelocorresponsabilidadmenor.RecuperarLaUltimaCorresponsabilidadValidaDeMenor(IdSeleccionado);

            ValoresPorDefecto();

            if (IdCorresponsabilidadMenor > 0)
            {
                RecuperarCorresponsabilidadMenor();
            }
            else
            {
                this.txtCodigoFormulario.IsEnabled = true;
                this.dtpFechaInscripcion.IsEnabled = true;
                this.rdbNueva.IsEnabled            = true;
                this.rdbTransferencia.IsEnabled    = true;
                this.cmdGuardar.IsEnabled          = true;
            }

            if (TipoAccion == TipoAccion.Detalle)
            {
                this.txtCodigoFormulario.IsEnabled    = false;
                this.dtpFechaInscripcion.IsEnabled    = false;
                this.dtpFechaSalida.IsEnabled         = false;
                this.chkSalida.IsEnabled              = false;
                this.rdbCumplimiento.IsEnabled        = false;
                this.rdbFallecimiento.IsEnabled       = false;
                this.rdbIncumplimiento.IsEnabled      = false;
                this.rdbNueva.IsEnabled               = false;
                this.rdbTransferencia.IsEnabled       = false;
                this.rdbTransferenciaSalida.IsEnabled = false;
                this.txtAutorizado.IsEnabled          = false;
                this.txtCargo.IsEnabled               = false;
                this.cmdGuardar.IsEnabled             = false;
            }
        }