Beispiel #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="res"></param>
        public void RemoveResourcesItem(Resource res)
        {
            //using (DaoManager daoMge = new DaoManager())
            //{
            try
            {
                //daoMge.BeginTransaction();
                Delete(res.Id);
                RoleResourceProcess        resourceProcess    = new RoleResourceProcess();
                List <RoleResourceMapping> currentRoleResList = resourceProcess.QueryRoleRes(res.Type, res.Id);
                resourceProcess.DeleteRoleResource(currentRoleResList);
                //daoMge.CommitTransaction();
            }
            catch
            {
                //daoMge.RollBackTransaction();
            }

            //}
        }