Exemplo n.º 1
0
        public RegCel()
        {
            try
            {
                InitializeComponent();

                Ciudad        p         = new Ciudad();
                List <Object> lstCiudad = p.GetCiudades();
                if (lstCiudad == null)
                {
                    lstCiudad = new List <Object>();
                }

                cbCiudad.SelectedValuePath = "Key";
                cbCiudad.DisplayMemberPath = "Value";
                foreach (Ciudad pe in lstCiudad)
                {
                    cbCiudad.Items.Add(new KeyValuePair <int?, string>(pe.id_ciudad, pe.nombre));
                }

                cbCiudad.SelectedIndex = 0;
            }
            catch (Exception)
            {
                Menu menu = new Menu();
                menu.Show();
                this.Close();
            }
        }
Exemplo n.º 2
0
        public UsuariosActualizar(Usuario usuario)
        {
            try
            {
                InitializeComponent();
                lblNombre.Content = AuthUser.nombre;

                Ciudad        p         = new Ciudad();
                List <Object> lstCiudad = p.GetCiudades();
                if (lstCiudad == null)
                {
                    lstCiudad = new List <Object>();
                }

                cbCiudad.SelectedValuePath = "Key";
                cbCiudad.DisplayMemberPath = "Value";
                foreach (Ciudad pe in lstCiudad)
                {
                    cbCiudad.Items.Add(new KeyValuePair <int?, string>(pe.id_ciudad, pe.nombre));
                }

                if (usuario != null)
                {
                    usr                 = usuario;
                    txtNombre.Text      = usuario.persona.nombre;
                    txtApp.Text         = usuario.persona.app_paterno;
                    txtApm.Text         = usuario.persona.app_materno;
                    txtRut.Text         = usuario.persona.rut;
                    fchNac.SelectedDate = usuario.persona.fech_nacimiento;
                    txtCorreo.Text      = usuario.persona.contacto.desc_contacto;

                    cbCiudad.SelectedValue = usuario.persona.direccion.id_ciudad;
                    txtCalle.Text          = usuario.persona.direccion.calle;
                    txtNum.Text            = usuario.persona.direccion.numeracion;
                    txtDpto.Text           = usuario.persona.direccion.departamento;
                }
            }
            catch (Exception)
            {
                Menu menu = new Menu();
                menu.Show();
                this.Close();
            }
        }