コード例 #1
0
 public override string[] GetAllRoles()
 {
     Consulta c = new Consulta();
     try
     {
         DataTable objDtRoles = c.consultarRoles();
         if (objDtRoles == null)
         {
             return new string[0];
         }
         string[] roles = new string[objDtRoles.Rows.Count];
         int i = 0;
         foreach (DataRow objDrRow in objDtRoles.Rows)
         {
             //string cadena = objDrRow["value"] + ":" + objDrRow["text"] + ":" + objDrRow["descripcion"];
             string cadena = objDrRow["text"].ToString();
             roles[i] = cadena;
             i++;
         }
         return roles;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #2
0
 public override string[] GetRolesForUser(string username)
 {
     Consulta c = new Consulta();
     try
     {
         DataTable roles = c.consultarRolesXUsuario(username);
         if (roles == null)
         {
             return new string[0];
         }
         int i = 0;
         string[] returnRoles = new string[roles.Rows.Count];
         foreach (DataRow row in roles.Rows)
         {
             returnRoles[i] = row["text"].ToString();
             i++;
         }
         return returnRoles;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
 public override bool IsUserInRole(string username, string roleName)
 {
     Consulta c = new Consulta();
     return c.consultarDatosXrolYusuario(username, roleName).Rows.Count > 0;
 }