コード例 #1
0
        void RecuperarFamilia()
        {
            ModeloFamilia modelofamilia = new ModeloFamilia();

            _familia = modelofamilia.Recuperar(IdSeleccionado);
            dtpFechaInscripcion.SelectedDate = _familia.FechaInscripcion;
            txtPaterno.Text = _familia.PrimerApellido;
            txtMaterno.Text = _familia.SegundoApellido;
        }
コード例 #2
0
ファイル: frmFamilia.xaml.cs プロジェクト: hernanUNO6/BJA
        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;
                }

            }
        }
コード例 #3
0
ファイル: frmMadre.xaml.cs プロジェクト: hernanUNO6/BJA
        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();
        }
コード例 #4
0
ファイル: frmFamilia.xaml.cs プロジェクト: hernanUNO6/BJA
        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();
        }