コード例 #1
0
        /// <summary>
        /// 刷新角色
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        private async Task GetOrganizationUnitRoles(GetOrganizationUnitRolesInput input)
        {
            await SetBusyAsync(async() =>
            {
                var pagedResult = await appService.GetOrganizationUnitRoles(input);
                if (pagedResult != null)
                {
                    roledataPager.SetList(pagedResult);
                }

                UpdateOrganizationUnit(input.Id);
            });
        }
コード例 #2
0
        public OrganizationsViewModel(IOrganizationUnitAppService userAppService)
        {
            this.appService = userAppService;
            SelectedCommand = new DelegateCommand <OrganizationListModel>(Selected);

            AddRootUnitCommand = new DelegateCommand <OrganizationListModel>(AddOrganizationUnit);
            ChangeCommand      = new DelegateCommand <OrganizationListModel>(EditOrganizationUnit);
            RemoveCommand      = new DelegateCommand <OrganizationListModel>(DeleteOrganizationUnit);

            DeleteRoleCommand   = new DelegateCommand <OrganizationUnitRoleListDto>(DeleteRole);
            DeleteMemberCommand = new DelegateCommand <OrganizationUnitUserListDto>(DeleteMember);

            usersInput    = new GetOrganizationUnitUsersInput();
            rolesInput    = new GetOrganizationUnitRolesInput();
            roledataPager = ContainerLocator.Container.Resolve <IDataPagerService>();
            roledataPager.OnPageIndexChangedEventhandler += RoleOnPageIndexChangedEventhandler;
            memberdataPager = ContainerLocator.Container.Resolve <IDataPagerService>();
            memberdataPager.OnPageIndexChangedEventhandler += MemberdataPager_OnPageIndexChangedEventhandler;

            ExecuteItemCommand = new DelegateCommand <string>(ExecuteItem);
        }
コード例 #3
0
        public async Task <PagedResultDto <OrganizationUnitRoleListDto> > GetOrganizationUnitRoles(GetOrganizationUnitRolesInput input)
        {
            var query = from ouRole in _organizationUnitRoleRepository.GetAll()
                        join ou in _organizationUnitRepository.GetAll() on ouRole.OrganizationUnitId equals ou.Id
                        join role in _roleManager.Roles on ouRole.RoleId equals role.Id
                        where ouRole.OrganizationUnitId == input.Id
                        select new
            {
                ouRole,
                role
            };

            var totalCount = await query.CountAsync();

            var items = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync();

            return(new PagedResultDto <OrganizationUnitRoleListDto>(
                       totalCount,
                       items.Select(item =>
            {
                var organizationUnitRoleDto = ObjectMapper.Map <OrganizationUnitRoleListDto>(item.role);
                organizationUnitRoleDto.AddedTime = item.ouRole.CreationTime;
                return organizationUnitRoleDto;
            }).ToList()));
        }
コード例 #4
0
        public async Task <PagedResultDto <OrganizationUnitRoleListDto> > GetOrganizationUnitRolesAsync(GetOrganizationUnitRolesInput input)
        {
            var query = from ouRole in await _organizationUnitRoleRepository
                        .FindOrganizationUnitRolesAsync(input.Id, input.MaxResultCount, input.SkipCount).ConfigureAwait(false)
                        join role in _roleManager.Roles on ouRole.RoleId equals role.Id
                            where ouRole.OrganizationUnitId == input.Id
                        select new
            {
                ouRole,
                role
            };
            var totalCount = await _organizationUnitRoleRepository.GetCountAsync(input.Id);

            var items = query.ToList();

            return(new PagedResultDto <OrganizationUnitRoleListDto>(
                       totalCount,
                       items.Select(item =>
            {
                var organizationUnitRoleDto = ObjectMapper.Map <IdentityRole, OrganizationUnitRoleListDto>(item.role);
                organizationUnitRoleDto.AddedTime = item.ouRole.CreationTime;
                return organizationUnitRoleDto;
            }).ToList()));
        }
コード例 #5
0
 public async Task <PagedResultDto <OrganizationUnitRoleListDto> > GetOrganizationUnitRolesAsync(GetOrganizationUnitRolesInput input)
 {
     return(await _organizationUnitRoleAppService.GetOrganizationUnitRolesAsync(input));
 }