示例#1
0
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="role"></param>
        public static void RemoveRole(Neusoft.HISFC.BizLogic.Privilege.Model.Role role)
        {
            //using (DaoManager daoMgr = new DaoManager())
            //{
            try
            {
                RoleLogic roleLogic = new RoleLogic();
                //daoMgr.BeginTransaction();
                //删除角色信息表
                roleLogic.Delete(role.ID);
                //删除角色权限对应表
                RoleResourceProcess        roleRes     = new RoleResourceProcess();
                List <RoleResourceMapping> roleResList = roleRes.QueryByRole(role.ID);
                roleRes.DeleteRoleResource(roleResList);

                //删除角色授权信息
                AuthorityLogic authorityLogic = new AuthorityLogic();
                authorityLogic.DeleteRole(role.ID);

                //daoMgr.CommitTransaction();
            }
            catch
            {
                //daoMgr.RollBackTransaction();
                throw;
            }

            //}
        }
 /// <summary>
 /// 删除用户授权
 /// </summary>
 /// <param name="userId"></param>
 /// <param name="roleId"></param>
 /// <returns></returns>
 public int CancelAuthority(string userId, string roleId)
 {
     //using (DaoManager daoMgr = new DaoManager())
     //{
     try
     {
         //daoMgr.BeginTransaction();
         int i = new AuthorityLogic().Delete(userId, roleId);;
         //daoMgr.CommitTransaction();
         return(i);
     }
     catch (Exception ex)
     {
         //daoMgr.RollBackTransaction();
         throw ex;
     }
     //}
 }