示例#1
0
        private void menBusMen_Click(object sender, RoutedEventArgs e)
        {
            this.Cursor = Cursors.Wait;
            frmLista formularioListaMenores = new frmLista();

            formularioListaMenores.ModificarRegistro += formularioListaMenores_ModificarRegistro;
            formularioListaMenores.DetallesRegistro += formularioListaMenores_DetallesRegistro;

            ModeloMenor modelomenor = new ModeloMenor();

            formularioListaMenores.proveedorDatos = modelomenor;
            formularioListaMenores.titulo = "Menores";
            formularioListaMenores.ShowDialog();
            this.Cursor = Cursors.Arrow;
        }
示例#2
0
 void RecuperarMenores()
 {
     ModeloMenor modelomenor = new ModeloMenor();
     this.grdMenor.ItemsSource = modelomenor.ListarMenoresDeUnaFamilia(IdSeleccionado);
 }
示例#3
0
        private void cmdAceptar_Click(object sender, RoutedEventArgs e)
        {
            bool ok = false;
            string s = "-";
            string ss = "";

            if (rdbFemenino.IsChecked == true)
            {
                s = "F";
                ss = "¿Desea guardar los datos correspondiente a esta niña?";
            }
            else if (rdbFemenino.IsChecked == false)
            {
                s = "M";
                ss = "¿Desea guardar los datos correspondiente a esta niño?";
            }

            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 (Convert.ToInt32(cboTipoDocumentoIdentidad.SelectedValue) == Convert.ToInt32(TipoDocumentoIdentidad.CertificadoNacimiento))
            {
                if (!(txtOficialia.Text.Length > 0))
                {
                    MessageBox.Show("Se requiere especificar oficialía.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    ok = true;
                }
                else if (!(txtLibro.Text.Length > 0))
                {
                    MessageBox.Show("Se requiere especificar libro.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    ok = true;
                }
                else if (!(txtPartida.Text.Length > 0))
                {
                    MessageBox.Show("Se requiere especificar partida.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    ok = true;
                }
                else if (!(txtFolio.Text.Length > 0))
                {
                    MessageBox.Show("Se requiere especificar folio.", "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 (s == "-")
            {
                MessageBox.Show("Se requiere especificar sexo.", "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)
            {
                if ((txtPaterno.Text != txtPaternoFamilia.Text) || (txtMaterno.Text != txtMaternoFamilia.Text))
                {
                    if (MessageBox.Show("El apellido paterno o materno no son iguales a los apellidos paterno o materno de la familia. ¿Desea continua?", "Advertencia", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No)
                        ok = true;
                }
            }

            if (ok == false)
            {
                switch (MessageBox.Show(ss, "Consulta", MessageBoxButton.YesNoCancel, MessageBoxImage.Question))
                {
                    case MessageBoxResult.Yes:
                        ModeloMenor modelomenor = new ModeloMenor();
                        ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();

                        _menor.DocumentoIdentidad = txtDocumentoIdentidad.Text;
                        switch (cboTipoDocumentoIdentidad.SelectedIndex)
                        {
                            case 0:
                                _menor.TipoDocumentoIdentidad = TipoDocumentoIdentidad.CarnetIdentidad;
                                break;
                            case 1:
                                _menor.TipoDocumentoIdentidad = TipoDocumentoIdentidad.CertificadoNacimiento;
                                break;
                            case 2:
                                _menor.TipoDocumentoIdentidad = TipoDocumentoIdentidad.Pasaporte;
                                break;
                        }
                        _menor.Oficialia = txtOficialia.Text;
                        _menor.Libro = txtLibro.Text;
                        _menor.Partida = txtPartida.Text;
                        _menor.Folio = txtFolio.Text;
                        _menor.PrimerApellido = txtPaterno.Text;
                        _menor.SegundoApellido = txtMaterno.Text;
                        _menor.Nombres = txtNombres.Text;
                        _menor.FechaNacimiento = dtpFechaNacimiento.SelectedDate.Value;
                        _menor.Defuncion = (chkDefuncion.IsChecked == true) ? true : false;
                        _menor.Observaciones = "";
                        _menor.IdDepartamento = Convert.ToInt64(cboDepartamento.SelectedValue);
                        _menor.IdProvincia = Convert.ToInt64(cboProvincia.SelectedValue);
                        _menor.IdMunicipio = Convert.ToInt64(cboMunicipio.SelectedValue);
                        _menor.LocalidadNacimiento = txtLugarNacimiento.Text;
                        _menor.Sexo = s;

                        if (IdSeleccionado > 0)
                            modelomenor.Editar(IdSeleccionado, _menor);
                        else
                        {
                            modelomenor.Crear(_menor);
                            IdSeleccionado = _menor.Id;

                            _grupofamiliar.IdFamilia = IdFamilia;
                            _grupofamiliar.IdMenor = _menor.Id;
                            _grupofamiliar.TipoGrupoFamiliar = TipoGrupoFamiliar.Menor;

                            modelogrupofamiliar.Crear(_grupofamiliar);
                        }

                        Resultado = true;

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

            }
        }
示例#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";

            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
            {
                ModeloMenor modelomenor = new ModeloMenor();

                _menor = modelomenor.Recuperar(IdSeleccionado);
                txtDocumentoIdentidad.Text = _menor.DocumentoIdentidad;
                switch (_menor.TipoDocumentoIdentidad)
                {
                    case TipoDocumentoIdentidad.CarnetIdentidad:
                        cboTipoDocumentoIdentidad.SelectedIndex = 0;
                        break;
                    case TipoDocumentoIdentidad.CertificadoNacimiento:
                        cboTipoDocumentoIdentidad.SelectedIndex = 1;
                        break;
                    case TipoDocumentoIdentidad.Pasaporte:
                        cboTipoDocumentoIdentidad.SelectedIndex = 2;
                        break;
                }
                txtOficialia.Text = _menor.Oficialia;
                txtLibro.Text = _menor.Libro;
                txtPartida.Text = _menor.Partida;
                txtFolio.Text = _menor.Folio;
                txtPaterno.Text = _menor.PrimerApellido;
                txtMaterno.Text = _menor.SegundoApellido;
                txtNombres.Text = _menor.Nombres;
                if (_menor.Sexo == "F")
                    rdbFemenino.IsChecked = true;
                else if (_menor.Sexo == "M")
                    rdbMasculino.IsChecked = true;
                dtpFechaNacimiento.SelectedDate = _menor.FechaNacimiento;
                if (_menor.Defuncion == true)
                    chkDefuncion.IsChecked = true;
                txtLugarNacimiento.Text = _menor.LocalidadNacimiento;
                cboDepartamento.SelectedValue = _menor.IdDepartamento;
                RecuperarProvincias(_menor.IdDepartamento.ToString());
                cboProvincia.SelectedValue = _menor.IdProvincia;
                RecuperarMunicipios(_menor.IdProvincia.ToString());
                cboMunicipio.SelectedValue = _menor.IdMunicipio;

                ModeloGrupoFamiliar modelogrupofamiliar = new ModeloGrupoFamiliar();

                _grupofamiliar = modelogrupofamiliar.RecuperarPorMenorDeFamilia(IdFamilia, IdSeleccionado);

                if (TipoAccion == TipoAccion.Detalle)
                {
                    txtDocumentoIdentidad.IsEnabled = false;
                    cboTipoDocumentoIdentidad.IsEnabled = false;
                    txtOficialia.IsEnabled = false;
                    txtLibro.IsEnabled = false;
                    txtPartida.IsEnabled = false;
                    txtFolio.IsEnabled = false;
                    txtPaterno.IsEnabled = false;
                    txtMaterno.IsEnabled = false;
                    txtNombres.IsEnabled = false;
                    rdbFemenino.IsEnabled = false;
                    rdbMasculino.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();
        }
        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;
            }
        }