Пример #1
0
        private void menBusTut_Click(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.Wait;
            frmLista formularioListaTutores = new frmLista();

            formularioListaTutores.ModificarRegistro += formularioListaTutores_ModificarRegistro;
            formularioListaTutores.DetallesRegistro  += formularioListaTutores_DetallesRegistro;

            ModeloTutor modelotutor = new ModeloTutor();

            formularioListaTutores.proveedorDatos = modelotutor;
            formularioListaTutores.titulo         = "Tutores";
            formularioListaTutores.ShowDialog();
            this.Cursor = Cursors.Arrow;
        }
Пример #2
0
        private void cmdTitularTutor_Click(object sender, RoutedEventArgs e)
        {
            if (registrotitularpago != null)
            {
                Button Img = (Button)sender;
                if (Img.Tag != null)
                {
                    Int64 Id = (Int64)Img.Tag;
                    if (Id > 0)
                    {
                        if (registrotitularpago.Titular != "SI")
                        {
                            string NombreCompleto = "";

                            if (registrotitularpago.Tipo == "Madre")
                            {
                                ModeloMadre modelomadre = new ModeloMadre();
                                Madre       __madre     = new Madre();
                                __madre        = modelomadre.Recuperar(Id);
                                NombreCompleto = __madre.NombreCompleto;
                            }
                            else
                            {
                                ModeloTutor modelotutor = new ModeloTutor();
                                Tutor       __tutor     = new Tutor();
                                __tutor        = modelotutor.Recuperar(Id);
                                NombreCompleto = __tutor.NombreCompleto;
                            }

                            if (MessageBox.Show("¿Desea establecer a " + NombreCompleto + " como titular de pago para esta familia?", "Advertencia", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
                            {
                                ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();
                                modelogrupofamiliar.EstablecerTitularDePagoVigenteDeFamilia(IdSeleccionado, registrotitularpago.IdGrupoFamiliar);
                                RecuperarMadresYTutoresALaVez();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Esta persona ya se halla establecida como titular de pago de esta familia.", "Mensaje", MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                    }
                }
            }
        }
        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;
            }
        }
Пример #4
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ControlPreliminar = false;

            SoporteCombo.cargarEnumerador(cboTipoDocumentoIdentidad, typeof(TipoDocumentoIdentidad));
            ModeloDepartamento modelodepartamento = new ModeloDepartamento();

            this.cboDepartamento.ItemsSource       = modelodepartamento.Listar();
            this.cboDepartamento.DisplayMemberPath = "Descripcion";
            this.cboDepartamento.SelectedValuePath = "Id";

            ModeloTipoParentesco modelotipoparentesco = new ModeloTipoParentesco();

            this.cboTipoParentesco.ItemsSource       = modelotipoparentesco.Listar();
            this.cboTipoParentesco.DisplayMemberPath = "Descripcion";
            this.cboTipoParentesco.SelectedValuePath = "Id";

            if (IdFamilia > 0)
            {
                ModeloFamilia modelofamilia = new ModeloFamilia();
                Familia       familia       = new Familia();

                familia = modelofamilia.Recuperar(IdFamilia);
                this.txtPaternoFamilia.Text = familia.PrimerApellido;
                this.txtMaternoFamilia.Text = familia.SegundoApellido;
            }

            if (IdSeleccionado == 0)
            {
                this.cboTipoDocumentoIdentidad.SelectedIndex = -1;
                this.dtpFechaNacimiento.SelectedDate         = DateTime.Today;
                this.cboDepartamento.SelectedIndex           = -1;

                this.cboTipoParentesco.SelectedIndex = -1;
            }
            else
            {
                ModeloTutor modelotutor = new ModeloTutor();

                _tutor = modelotutor.Recuperar(IdSeleccionado);
                txtDocumentoIdentidad.Text = _tutor.DocumentoIdentidad;
                switch (_tutor.TipoDocumentoIdentidad)
                {
                case TipoDocumentoIdentidad.CarnetIdentidad:
                    cboTipoDocumentoIdentidad.SelectedIndex = 0;
                    break;

                case TipoDocumentoIdentidad.CertificadoNacimiento:
                    cboTipoDocumentoIdentidad.SelectedIndex = 1;
                    break;

                case TipoDocumentoIdentidad.Pasaporte:
                    cboTipoDocumentoIdentidad.SelectedIndex = 2;
                    break;
                }
                txtPaterno.Text                 = _tutor.PrimerApellido;
                txtMaterno.Text                 = _tutor.SegundoApellido;
                txtConyuge.Text                 = _tutor.TercerApellido;
                txtNombres.Text                 = _tutor.Nombres;
                txtNombreCompleto.Text          = _tutor.NombreCompleto;
                dtpFechaNacimiento.SelectedDate = _tutor.FechaNacimiento;
                if (_tutor.Sexo == "F")
                {
                    rdbFemenino.IsChecked = true;
                }
                else if (_tutor.Sexo == "M")
                {
                    rdbMasculino.IsChecked = true;
                }
                if (_tutor.Defuncion == true)
                {
                    chkDefuncion.IsChecked = true;
                }
                txtLugarNacimiento.Text       = _tutor.LocalidadNacimiento;
                cboDepartamento.SelectedValue = _tutor.IdDepartamento;
                RecuperarProvincias(_tutor.IdDepartamento.ToString());
                cboProvincia.SelectedValue = _tutor.IdProvincia;
                RecuperarMunicipios(_tutor.IdProvincia.ToString());
                cboMunicipio.SelectedValue = _tutor.IdMunicipio;

                ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();
                _grupofamiliar = modelogrupofamiliar.RecuperarPorTutorDeFamilia(IdFamilia, IdSeleccionado);

                cboTipoParentesco.SelectedValue = _grupofamiliar.IdTipoParentesco;

                if (TipoAccion == TipoAccion.Detalle)
                {
                    cboTipoParentesco.IsEnabled         = false;
                    txtDocumentoIdentidad.IsEnabled     = false;
                    cboTipoDocumentoIdentidad.IsEnabled = false;
                    txtPaterno.IsEnabled         = false;
                    txtMaterno.IsEnabled         = false;
                    txtConyuge.IsEnabled         = false;
                    txtNombres.IsEnabled         = false;
                    dtpFechaNacimiento.IsEnabled = false;
                    rdbFemenino.IsEnabled        = false;
                    rdbMasculino.IsEnabled       = false;
                    chkDefuncion.IsEnabled       = false;
                    txtLugarNacimiento.IsEnabled = false;
                    cboDepartamento.IsEnabled    = false;
                    cboProvincia.IsEnabled       = false;
                    cboMunicipio.IsEnabled       = false;
                    cmdAceptar.IsEnabled         = false;
                }
            }
            ControlPreliminar = true;
            if ((TipoAccion == TipoAccion.Nuevo) || (TipoAccion == TipoAccion.Edicion))
            {
                this.cboTipoParentesco.Focus();
            }
        }
Пример #5
0
        private void cmdAceptar_Click(object sender, RoutedEventArgs e)
        {
            bool ok = false;

            if ((Convert.ToInt64(cboTipoParentesco.SelectedIndex) < 0))
            {
                MessageBox.Show("Se requiere especificar tipo de parentesco.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else 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))
            {
                MessageBox.Show("Se requiere especificar departamento.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            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)
            {
                switch (MessageBox.Show("¿Desea guardar los datos correspondiente a este titular de pago?", "Consulta", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
                {
                case MessageBoxResult.Yes:
                    ModeloTutor         modelotutor         = new ModeloTutor();
                    ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();

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

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

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

                    _grupofamiliar.IdTipoParentesco = Convert.ToInt64(cboTipoParentesco.SelectedValue);

                    if (IdSeleccionado > 0)
                    {
                        modelotutor.Editar(IdSeleccionado, _tutor);

                        modelogrupofamiliar.Editar(_grupofamiliar.Id, _grupofamiliar);
                    }
                    else
                    {
                        modelotutor.Crear(_tutor);
                        IdSeleccionado = _tutor.Id;

                        _grupofamiliar.IdFamilia         = IdFamilia;
                        _grupofamiliar.IdTutor           = _tutor.Id;
                        _grupofamiliar.TipoGrupoFamiliar = TipoGrupoFamiliar.Tutor;

                        modelogrupofamiliar.Crear(_grupofamiliar);
                    }

                    Resultado = true;

                    this.Close();
                    break;

                case MessageBoxResult.Cancel:
                    IdSeleccionado = 0;
                    Resultado      = false;
                    this.Close();
                    break;
                }
            }
        }
Пример #6
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;
            }
        }