Exemple #1
0
        private void CrearUsuario_Load(object sender, EventArgs e)
        {
            try
            {
                PerfilDAO perfilDAO = new PerfilDAO();
                DataTable dt        = perfilDAO.getPerfilesCbx();
                this.cbxPerfil.DataSource    = dt;
                this.cbxPerfil.DisplayMember = "NOMBRE";
                this.cbxPerfil.ValueMember   = "IDPERFIL";
            }catch (Exception ex) {
                MessageBox.Show("Error: Ha ocurrido un error grave cargando los perfiles.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                CiudadDAO ciudadDAO = new CiudadDAO();
                DataTable dt        = ciudadDAO.getCiudadesCbx();
                this.cbxCiudad.DataSource    = dt;
                this.cbxCiudad.DisplayMember = "NOMBRE";
                this.cbxCiudad.ValueMember   = "IDCIUDAD";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: Ha ocurrido un error grave cargando Ciudades.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
        private void EditarUsuario_Load(object sender, EventArgs e)
        {
            try
            {
                PerfilDAO perfilDAO = new PerfilDAO();
                DataTable dt        = perfilDAO.getPerfilesCbx();
                this.cbxPerfil.DataSource    = dt;
                this.cbxPerfil.DisplayMember = "NOMBRE";
                this.cbxPerfil.ValueMember   = "IDPERFIL";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: Ha ocurrido un error grave cargando los perfiles.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            try
            {
                CiudadDAO ciudadDAO = new CiudadDAO();
                DataTable dt        = ciudadDAO.getCiudadesCbx();
                this.cbxCiudad.DataSource    = dt;
                this.cbxCiudad.DisplayMember = "NOMBRE";
                this.cbxCiudad.ValueMember   = "IDCIUDAD";
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: Ha ocurrido un error grave cargando Ciudades.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            this.txtNombre.Text          = this.trabajadorSeleccionado.nombre.Trim();
            this.txtApellidoPaterno.Text = this.trabajadorSeleccionado.apellidoPaterno.Trim();
            this.txtApellidoMaterno.Text = this.trabajadorSeleccionado.apellidoMaterno.Trim();
            this.txtRut.Text             = this.trabajadorSeleccionado.rut + "-" + this.trabajadorSeleccionado.dv;
            this.txtDireccion.Text       = this.trabajadorSeleccionado.direccion.Trim();
            this.cbxCiudad.SelectedValue = this.trabajadorSeleccionado.idCiudad;
            this.cbxActivo.Checked       = this.trabajadorSeleccionado.isActivo == 1 ? true : false;
            this.txtTelefono.Text        = this.trabajadorSeleccionado.telefono.Trim();
            this.cbxPerfil.SelectedValue = this.usuarioSeleccionado.codigoPerfil;
            this.txtLogin.Text           = this.usuarioSeleccionado.login.Trim().ToUpper();
            this.txtEmail.Text           = this.trabajadorSeleccionado.email.Trim();
        }