예제 #1
0
        private async Task ValidateLicenses(
            ImportResultLoginUser result,
            int companyId, int loginUserId, CancellationToken token)
        {
            var licenseKeysCount    = (await loginUserLicenseProcessor.GetAsync(companyId, token)).Count();
            var loginUsersUseClient = (await loginUserQueryProcessor.GetAsync(new LoginUserSearch {
                CompanyId = companyId, UseClient = 1,
            })).ToArray();

            if (loginUsersUseClient.Length > licenseKeysCount)
            {
                result.LicenseIsOrver = true;
            }

            var Ids       = new int[] { loginUserId };
            var loginUser = (await loginUserQueryProcessor.GetAsync(new LoginUserSearch {
                Ids = Ids
            })).ToList();

            if (loginUser == null || loginUser.Count < 1)
            {
                result.NotExistsLoginUser = true;
            }
            else if (loginUser[0].UseClient == 0)
            {
                result.LoginUserHasNotLoginLicense = true;
            }
        }
예제 #2
0
        public async Task <LoginUserLicensesResult> GetItemsAsync(string SessionKey, int CompanyId)
        {
            return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token =>
            {
                var result = (await loginUserLicenseProcessor.GetAsync(CompanyId, token)).ToList();
                return new LoginUserLicensesResult
                {
                    ProcessResult = new ProcessResult {
                        Result = true
                    },
                    LoginUserLicenses = result,
                };
            }, logger));

            throw new NotImplementedException();
        }
예제 #3
0
 public async Task <ActionResult <IEnumerable <LoginUserLicense> > > GetItems(LoginUserLicense license, CancellationToken token)
 => (await loginUserLicenseProcessor.GetAsync(license.CompanyId, token)).ToArray();