Exemple #1
0
 static void SetRoleAuthority(DBC.Role role,string code,bool value)
 {
     try
     {
         var authoriy = new DBC.Authority(code);
         var sql = "update " + DBTables.RoleAuthority + " set value=? where roleid=? and authorityid=?";
         DB.SExecuteNonQuery(sql, value, role.ID, authoriy.ID);
     }
     catch { }
 }
Exemple #2
0
    public static bool Check(DBC.Role role,params string[] codes)
    {
        var res = true;
        foreach (string code in codes)
        {
            try
            {
                var authority = new DBC.Authority(code);
                var sql = "select value from " + DBTables.RoleAuthority + " where roleid=? and authorityid=?";
                var res11 = DB.SExecuteScalar(sql, role.ID, authority.ID);

                res &= Convert.ToBoolean(res11);
                if (res == false)
                    break;
            }
            catch { }
        }
        return res;
    }