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;
            }
        }
Example #2
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";

            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;
            }
            else
            {
                ModeloMadre modelomadre = new ModeloMadre();

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

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

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

                ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();

                _grupofamiliar = modelogrupofamiliar.RecuperarPorMadreDeFamilia(IdFamilia, IdSeleccionado);

                if (TipoAccion == TipoAccion.Detalle)
                {
                    txtDocumentoIdentidad.IsEnabled     = false;
                    cboTipoDocumentoIdentidad.IsEnabled = false;
                    txtPaterno.IsEnabled         = false;
                    txtMaterno.IsEnabled         = false;
                    txtConyuge.IsEnabled         = false;
                    txtNombres.IsEnabled         = false;
                    txtNombreCompleto.IsEnabled  = false;
                    dtpFechaNacimiento.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.txtDocumentoIdentidad.Focus();
            }
        }