Example #1
0
        private void brnAceptar_Click(object sender, EventArgs e)
        {
            try
            {
                UsuariosEn user = new UsuariosEn();
                Rol_X_Usuario rol = new Rol_X_Usuario();

                user.Nombre = txtNombre.Text;
                user.Apellido1 = txtApellido1.Text;
                user.Apellido2 = txtApellido2.Text;
                user.Departamento.Id_departamento = Convert.ToInt32(cbDepartamento.SelectedValue);
                user.Departamento.Desc_departamento = cbDepartamento.SelectedText;
                user.Estado = cbEstado.SelectedText;
                user.Password = Encriptar.MD5Hash(txtPassword.Text);
                user.User_name = txtUsuario.Text;

                UsuarioLn.RegistrarUsuario(user);

            }
            catch (Exception ex)
            {
                MessageBox.Show("Se produjo un error al ingresar el usuario: "+ex.Message);
            }
        }
Example #2
0
        public static void RegistrarRolesXUsuario(Rol_X_Usuario _rol_x_usuario)
        {
            try
            {
                using (SqlConnection con = DataBaseManager.OpenSqlDatabase(user, pass, servidor, baseDatos))
                {
                    using (SqlCommand command = con.CreateCommand())
                    {
                        command.CommandText = "sp_roles_x_usuario";
                        command.CommandType = System.Data.CommandType.StoredProcedure;

                        command.Parameters.AddWithValue("@IF_ROL", _rol_x_usuario.Rol.Id_rol);
                        command.Parameters.AddWithValue("@IF_PERMISO", _rol_x_usuario.Usuario.User_name);

                        command.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #3
0
 public static void RegistrarRolesXUsuario(Rol_X_Usuario _rol_x_usuario)
 {
     try
     {
         ConsultasAd.RegistrarRolesXUsuario(_rol_x_usuario);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }