Example #1
0
        private static IAdapter GetAdapterForAccount(IAccountSettings account)
        {
            // TODO. Here the common code, which currently resides on client project should be used.
            // GetCurrentInstance from SettingsManager.cs
            var adapter = AdapterInstanceFactory.GetCurentAdapterInstance(account.Source);

            return(adapter.GetAdapter(account));
        }
        public ServiceAccountDTO TestAccount(ServiceAccountDTO accountForTest)
        {
            IAdapter currentAdapter = AdapterInstanceFactory.GetCurentAdapterInstance(accountForTest.Source);

            if (currentAdapter != null)
            {
                IAccountSettings currentAccountForTest = SettingsManager.GetCurrentInstance(accountForTest.Source);

                currentAccountForTest = currentAccountForTest.Convert(accountForTest.ServiceAccountDTOToDomain());

                IAccountSettings testResult   = currentAdapter.TestAccount(currentAccountForTest);
                ServiceAccount   resultDomain = new ServiceAccount();
                resultDomain = testResult.Convert(testResult);
                ServiceAccountDTO result = resultDomain.ServiceAccountDomainToDTO();
                return(result);
            }
            else
            {
                accountForTest.TestResult = false;
                return(accountForTest);
            }
        }