public Rol_X_Usuario() { usuario = new UsuariosEn(); rol = new RolEn(); }
public Permiso_X_Rol() { rol = new RolEn(); permiso = new PermisoEn(); }
public Rol_X_Menu() { rol = new RolEn(); menu = new MenuEn(); }
public static void RegistrarRol(RolEn _rol) { try { using (SqlConnection con = DataBaseManager.OpenSqlDatabase(user, pass, servidor, baseDatos)) { using (SqlCommand command = con.CreateCommand()) { command.CommandText = "sp_registrar_usuario"; command.CommandType = System.Data.CommandType.StoredProcedure; command.Parameters.AddWithValue("@p_id_rol", _rol.Id_rol); command.Parameters.AddWithValue("@p_desc_rol", _rol.Desc_rol); command.ExecuteNonQuery(); } } } catch (Exception ex) { throw ex; } }
public static List<RolEn> ConsultaRoles() { List<RolEn> response = new List<RolEn>(); try { using (SqlConnection con = DataBaseManager.OpenSqlDatabase(user, pass, servidor, baseDatos)) { using (SqlCommand command = con.CreateCommand()) { command.CommandText = "sp_consulta_roles"; command.CommandType = System.Data.CommandType.StoredProcedure; using (SqlDataReader dr = command.ExecuteReader()) { while (dr.Read()) { RolEn tmp = new RolEn(); tmp.Desc_rol = dr["id_rol"].ToString() ?? string.Empty; tmp.Id_rol = dr["DESC_ROL"] != DBNull.Value ? Convert.ToInt32(dr["id_rol"]) : 0; response.Add(tmp); } } } } } catch (Exception ex) { throw ex; } return response; }
public static void RegistrarRol(RolEn _rol) { try { ConsultasAd.RegistrarRol(_rol); } catch (Exception ex) { throw ex; } }