예제 #1
0
        /// <summary>
        /// 授权
        /// </summary>
        private void EmpowerAdd(decimal userid, decimal ROLEID)
        {
            decimal MENUID   = 0; //菜单编号默认为0
            decimal ACTIONID = 0; //动作编号默认为0

            //判断用户是否拥有权限;如果已有权限,删除已有权限
            if (userRolebll.ExistsUserid(userid))
            {
                string strwhere = "USERID=" + userid;
                userRolebll.deletelist(strwhere);                            //删除已有权限
                userRolebll.Add(GetModel(userid, ROLEID, MENUID, ACTIONID)); //用户授权
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('授权成功!')", true);
            }
            else
            {
                userRolebll.Add(GetModel(userid, ROLEID, MENUID, ACTIONID));//用户授权
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "alert('授权成功!')", true);
            }
        }
예제 #2
0
 /// <summary>
 /// 从用户表中根据用户编号删除用户
 /// </summary>
 /// <param name="userId"></param>
 private void DelUser(decimal userId)
 {
     //删除用户之前先删除用户所拥有的权限
     //判断权限列表中是否有该用户存在
     if (urbll.ExistsUserid(userId))
     {
         if (urbll.deletelist("USERID=" + userId))
         {
             DelUserByID(userId);
         }
         else
         {
             AjaxAlert(this.UpdatePanel1, "请先检查该用户权限关系!");
         }
     }
     else
     {
         DelUserByID(userId);
     }
 }