Ejemplo n.º 1
0
        void RecuperarFamilia()
        {
            ModeloFamilia modelofamilia = new ModeloFamilia();

            _familia = modelofamilia.Recuperar(IdSeleccionado);
            dtpFechaInscripcion.SelectedDate = _familia.FechaInscripcion;
            txtPaterno.Text = _familia.PrimerApellido;
            txtMaterno.Text = _familia.SegundoApellido;
        }
Ejemplo n.º 2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ControlPreliminar = false;

            ModeloDepartamento modelodepartamento = new ModeloDepartamento();

            this.cboDepartamento.ItemsSource       = modelodepartamento.Listar();
            this.cboDepartamento.DisplayMemberPath = "Descripcion";
            this.cboDepartamento.SelectedValuePath = "Id";
            if (IdSeleccionado == 0)
            {
                this.dtpFechaInscripcion.SelectedDate = DateTime.Today;
                this.cboDepartamento.SelectedIndex    = -1;
            }
            else
            {
                ModeloFamilia modelofamilia = new ModeloFamilia();

                _familia = modelofamilia.Recuperar(IdSeleccionado);
                dtpFechaInscripcion.SelectedDate = _familia.FechaInscripcion;
                txtPaterno.Text = _familia.PrimerApellido;
                txtMaterno.Text = _familia.SegundoApellido;
                txtLugar.Text   = _familia.Localidad;
                cboDepartamento.SelectedValue = _familia.IdDepartamento;
                RecuperarProvincias(_familia.IdDepartamento.ToString());
                cboProvincia.SelectedValue = _familia.IdProvincia;
                RecuperarMunicipios(_familia.IdProvincia.ToString());
                cboMunicipio.SelectedValue = _familia.IdMunicipio;
                if (TipoAccion == TipoAccion.Detalle)
                {
                    dtpFechaInscripcion.IsEnabled = false;
                    txtPaterno.IsEnabled          = false;
                    txtMaterno.IsEnabled          = false;
                    txtLugar.IsEnabled            = false;
                    cboDepartamento.IsEnabled     = false;
                    cboProvincia.IsEnabled        = false;
                    cboMunicipio.IsEnabled        = false;
                    cmdAceptar.IsEnabled          = false;
                }
            }
            ControlPreliminar = true;
            if ((TipoAccion == TipoAccion.Nuevo) || (TipoAccion == TipoAccion.Edicion))
            {
                this.dtpFechaInscripcion.Focus();
            }
        }
Ejemplo n.º 3
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();
            }
        }
Ejemplo n.º 4
0
        private void cmdAceptar_Click(object sender, RoutedEventArgs e)
        {
            bool ok = false;

            if (!(txtPaterno.Text.Length > 0) && !(txtMaterno.Text.Length > 0))
            {
                MessageBox.Show("Se requiere especificar apellidos de familia.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if (!(Convert.ToInt64(cboDepartamento.SelectedValue) >= 0))
            {
                MessageBox.Show("Se requiere especificar departamento.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if (!(Convert.ToInt64(cboProvincia.SelectedValue) >= 0))
            {
                MessageBox.Show("Se requiere especificar provincia.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if (!(Convert.ToInt64(cboMunicipio.SelectedValue) >= 0))
            {
                MessageBox.Show("Se requiere especificar municipio.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }
            else if (!(txtLugar.Text.Length > 0))
            {
                MessageBox.Show("Se requiere especificar lugar.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                ok = true;
            }

            if (ok == false)
            {
                switch (MessageBox.Show("¿Desea guardar los datos correspondiente a este familia?", "Consulta", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
                {
                case MessageBoxResult.Yes:
                    ModeloFamilia modelofamilia = new ModeloFamilia();

                    ModeloAsignacionMedico modeloAsignacionMedico = new ModeloAsignacionMedico();

                    _familia.IdEstablecimientoSalud = modeloAsignacionMedico.EstablecimientoDeSaludHabilitado(SessionManager.getCurrentSession().User.IdUserRelation).IdEstablecimientoSalud;
                    _familia.FechaInscripcion       = dtpFechaInscripcion.SelectedDate.Value;
                    _familia.PrimerApellido         = txtPaterno.Text;
                    _familia.SegundoApellido        = txtMaterno.Text;
                    _familia.Observaciones          = "";
                    _familia.IdDepartamento         = Convert.ToInt64(cboDepartamento.SelectedValue);
                    _familia.IdProvincia            = Convert.ToInt64(cboProvincia.SelectedValue);
                    _familia.IdMunicipio            = Convert.ToInt64(cboMunicipio.SelectedValue);
                    _familia.Localidad = txtLugar.Text;

                    if (IdSeleccionado > 0)
                    {
                        modelofamilia.Editar(IdSeleccionado, _familia);
                    }
                    else
                    {
                        modelofamilia.Crear(_familia);
                    }

                    Id        = _familia.Id;
                    Resultado = true;

                    this.Close();
                    break;

                case MessageBoxResult.Cancel:
                    Id        = 0;
                    Resultado = false;
                    this.Close();
                    break;
                }
            }
        }