public ServiceAccountDTO TestExcelAccount(ServiceAccountDTO accountForTest, Byte[] fileForParce)
        {
            IAccountSettings currentAccountForTest = SettingsManager.GetCurrentInstance(accountForTest.Source);

            currentAccountForTest = currentAccountForTest.Convert(accountForTest.ServiceAccountDTOToDomain());
            ExcelAdapter currentAdapter = new ExcelAdapter(currentAccountForTest, fileForParce);

            IAccountSettings testResult   = currentAdapter.TestAccount(currentAccountForTest);
            ServiceAccount   resultDomain = new ServiceAccount();

            resultDomain = testResult.Convert(testResult);
            ServiceAccountDTO result = resultDomain.ServiceAccountDomainToDTO();

            return(result);
        }
        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);
            }
        }
        public ServiceAccountDTO GetUserAccountsByUserIDAndAccountId(Int32 userId, Int32 seviceAccountId)
        {
            ServiceAccountDTO UserAccountsDTO;


            ISessionFactory sessionFactory = NhibernateSessionFactory.GetSessionFactory(NhibernateSessionFactory.SessionFactoryConfiguration.Application);

            using (ISession session = sessionFactory.OpenSession())
            {
                UserLinkDAO userLink = session.QueryOver <UserLinkDAO>().Where(x => x.UserId == userId).And(x => x.Account.ServiceAccountId == seviceAccountId).SingleOrDefault();
                if (userLink != null)
                {
                    ServiceAccount account = userLink.Account.ServiceAccountDAOToDomain(IsDetailsNeed: true);
                    UserAccountsDTO = account.ServiceAccountDomainToDTO();
                }
                else
                {
                    UserAccountsDTO = null;
                }

                return(UserAccountsDTO);
            }
        }
        public ServiceAccountDTO TestExcelAccount(ServiceAccountDTO accountForTest, Byte[] fileForParce)
        {
            IAccountSettings currentAccountForTest = SettingsManager.GetCurrentInstance(accountForTest.Source);

            currentAccountForTest = currentAccountForTest.Convert(accountForTest.ServiceAccountDTOToDomain());
            ExcelAdapter currentAdapter = new ExcelAdapter(currentAccountForTest, fileForParce);

            IAccountSettings testResult = currentAdapter.TestAccount(currentAccountForTest);
            ServiceAccount resultDomain = new ServiceAccount();
            resultDomain = testResult.Convert(testResult);
            ServiceAccountDTO result = resultDomain.ServiceAccountDomainToDTO();
            return result;
        }
        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;
            }
        }