public static capaDatos.cRol RecuperarRolPorId(int pIdRol) { capaDatos.cRol resultado = new capaDatos.cRol(); DataSet dsResultado = capaSeguridad.GestiónRol(pIdRol, null, null, Constantes.cSQL_SELECT); if (dsResultado != null) { foreach (DataRow item in dsResultado.Tables["Rol"].Rows) { if (item["rol_codRol"] != DBNull.Value) { resultado.rol_codRol = Convert.ToInt32(item["rol_codRol"]); } if (item["rol_Nombre"] != DBNull.Value) { resultado.rol_Nombre = item["rol_Nombre"].ToString(); } } } return(resultado); }
public static List <capaDatos.cRol> RecuperarTodasRoles(string pFiltro) { List <capaDatos.cRol> lista = new List <capaDatos.cRol>(); DataSet dsResultado = capaSeguridad.GestiónRol(null, null, pFiltro, Constantes.cSQL_SELECT); if (dsResultado != null) { foreach (DataRow item in dsResultado.Tables["Rol"].Rows) { capaDatos.cRol obj = new capaDatos.cRol(); if (item["rol_codRol"] != DBNull.Value) { obj.rol_codRol = Convert.ToInt32(item["rol_codRol"]); } if (item["rol_Nombre"] != DBNull.Value) { obj.rol_Nombre = item["rol_Nombre"].ToString(); } lista.Add(obj); } } return(lista); }