コード例 #1
0
ファイル: RemoteTaskService.cs プロジェクト: minkione/HES
        private async Task ExecuteRemoteTask(Device remoteDevice, HardwareVaultTask task)
        {
            switch (task.Operation)
            {
            case TaskOperation.Create:
                if (task.Account.UpdateInActiveDirectory)
                {
                    var ldapSettings = await _appSettingsService.GetLdapSettingsAsync();

                    if (ldapSettings?.Password == null)
                    {
                        throw new Exception("Active Directory Credentials Required");     // TODO use Communication.dll ex
                    }
                    await _ldapService.SetUserPasswordAsync(task.HardwareVault.EmployeeId, task.Password, ldapSettings);
                }
                await AddAccountAsync(remoteDevice, task);

                break;

            case TaskOperation.Update:
                await UpdateAccountAsync(remoteDevice, task);

                break;

            case TaskOperation.Delete:
                await DeleteAccountAsync(remoteDevice, task);

                break;

            case TaskOperation.Primary:
                await SetAccountAsPrimaryAsync(remoteDevice, task);

                break;

            case TaskOperation.Profile:
                await ProfileVaultAsync(remoteDevice, task);

                break;
            }
        }