public bool havePerm(int id_rol, PermType perm)
 {
     return((from rp in db.Rol_Permiso where rp.id_rol == id_rol && rp.Permisos.valor == perm.ToString() select rp).Count() > 0);
 }
        public int getIdByPerm(PermType perm)
        {
            Permisos p = db.Permisos.Where(pe => pe.valor == perm.ToString()).Single();

            return(p.id_permiso);
        }
Beispiel #3
0
        //私有方法

        private OptResult GetPermByType(PermType type)
        {
            OptResult rst = null;

            try
            {
                var predicate = Predicates.Field <PermissionCacheDto>(p => p.per_type, Operator.Eq, type.ToString());
                var perFuncs  = _perRep.GetList <PermissionCacheDto>(predicate);
                rst = OptResult.Build(ResultCode.Success, Msg_GetAllFuncs, perFuncs);
            }
            catch (Exception ex)
            {
                LogHelper.LogError(Msg_GetAllFuncs, ex);
                rst = OptResult.Build(ResultCode.DbError, Msg_GetAllFuncs);
            }
            return(rst);
        }