Esempio n. 1
0
        public HttpResponseMessage GetAllCommonInfo(int type)
        {
            HttpResponseMessage result = new HttpResponseMessage();
            string strcontent          = null;

            switch (type)
            {
            case 1:    // 取得所有结构
                List <StructureDTO> structure = _ICommonServices.GetAllStructure();
                strcontent = JsonConvert.SerializeObject(structure);
                break;

            case 2:
                List <ButtonDTO> buttons = _ICommonServices.GetAllButton();
                strcontent = JsonConvert.SerializeObject(buttons);
                break;

            case 3:
                break;

            default:
                break;
            }

            result.Content = new StringContent(strcontent, System.Text.Encoding.GetEncoding("UTF-8"), "application/json");

            return(result);
        }
Esempio n. 2
0
        public void TestMethod1()
        {
            //取得所有模块
            List <StructureDTO> list = _ICommonServices.GetAllStructure();

            Assert.IsNotNull(list);

            //取得所有功能按钮
            List <ButtonDTO> list1 = _ICommonServices.GetAllButton();

            Assert.IsNotNull(list1);

            //取得取得用户权限
            //用户名为系统管理员的权限
            List <CurrentAuthorityDTO> list2 = _ICommonServices.GetUserAuthority(1);

            Assert.IsNotNull(list2);

            //取得角色权限
            //角色为系统管理员的权限
            List <CurrentAuthorityDTO> list3 = _ICommonServices.GetRoleAuthority(new List <int> {
                1
            });

            Assert.IsNotNull(list3);

            //取得角色类型权限
            //类型为系统管理员的权限
            List <CurrentAuthorityDTO> list4 = _ICommonServices.GetRoleTypeAuthority(0);

            Assert.IsNotNull(list4);

            //取得所有管理员信息
            //系统管理员的信息
            AdminSearchDTO dto = new AdminSearchDTO();

            dto.RoleIdList = new List <int>()
            {
                0
            };
            List <AdminDTO> list5 = _ICommonServices.GetAdminInfo(dto);

            Assert.IsNotNull(list5);
        }