Example #1
0
 private void create_from_form()
 {
     Usuario user = new Usuario(0);
     user.password = (String)this.txtPassword.Text;
     user.username = (String)this.txtUsername.Text;
     user.empleado_dni = this.empleado.dni;
     Context.instance.dao.user.insertar(user);
     this.user = Context.instance.dao.user.findByName(user.username);
     // Cargo el usuario recientemente creado.
     for (int i = 0; i < chkListadoRoles.Items.Count; ++i) {
         if (chkListadoRoles.GetItemChecked(i)) {
             Context.instance.dao.user.insertarRol(this.user, (Rol)chkListadoRoles.Items[i]);
         }
     }
 }
Example #2
0
 private void limpiar()
 {
     bCrear.Visible = true;
     bCrearOtro.Visible = true;
     bModificar.Visible = false;
     bBorrar.Visible = false;
     this.txtUsername.Text = "";
     this.txtEmpleado.Text = "";
     this.empleado = null;
     this.user = null;
     this.txtConfirmarPassword.Text = "";
     this.txtPassword.Text = "";
     for (int i = 0; i < chkListadoRoles.Items.Count; ++i)
         chkListadoRoles.SetItemChecked(i, false);
     txtUsername.Enabled = true;
     txtPassword.Enabled = true;
     txtConfirmarPassword.Enabled = true;
     chkListadoRoles.Enabled = true;
     bBuscarEmpleado.Enabled = true;
     bCrearOtro.Show();
     bCrear.Show();
     bModificar.Hide();
     bBorrar.Hide();
     bBorrar.Text = "Borrar";
 }
Example #3
0
 private void cargarUsuario(Usuario cargoUsuario)
 {
     this.user = cargoUsuario;
     txtUsername.Text = cargoUsuario.username;
 }