Beispiel #1
0
 /// <summary>
 /// 当前用户是否拥有角色
 /// </summary>
 /// <returns>是、否</returns>
 public bool IsHaveRole(int roleId)
 {
     HEemployeeBB userBB = new HEemployeeBB();
     try
     {
         return userBB.IsHaveRole(this.currentUser.empId, roleId);
     }
     finally
     {
         userBB.Dispose();
     }
 }
Beispiel #2
0
    public DataTable GetModule(int empId)
    {
        Base_ModuleBB moduleBB = new Base_ModuleBB();
        HEemployeeBB empBB = new HEemployeeBB();

        try
        {
            DataTable dt = new DataTable();
            bool isHaveRole = false;

            isHaveRole = empBB.IsHaveRole(empId, 1);//判断当前人是否拥有管理员权限
            if (isHaveRole)//当前人员拥有管理员权限
            {
                dt = moduleBB.GetList("").Tables[0];
            }
            else
            {
                //判断当前人员是否有收货员权限
                isHaveRole = empBB.IsHaveRole(empId, 15);
                if (isHaveRole)
                {
                    dt = moduleBB.GetList("id not in ('10000010','10000006')").Tables[0];

                    return dt;
                }

                //判断当前人员是否有叉车司机权限
                isHaveRole = empBB.IsHaveRole(empId, 16);
                if (isHaveRole)
                {
                    dt = moduleBB.GetList("id in ('10000003','10000004','10000010')").Tables[0];

                    return dt;
                }

                //判断当前人员是否检验员权限
                isHaveRole = empBB.IsHaveRole(empId, 18);
                if (isHaveRole)
                {
                    dt = moduleBB.GetList("id in ('10000003','10000004','10000006')").Tables[0];

                    return dt;
                }
            }

            return dt;
        }
        finally
        {
            moduleBB.Dispose();
            empBB.Dispose();
        }
    }