Beispiel #1
0
        public bool AddExternalAccountMapping(string clientId, string datafeed, string vendorID, string accountID, string externalAccountID)
        {
            if (string.IsNullOrEmpty(datafeed) || string.IsNullOrEmpty(vendorID) || string.IsNullOrEmpty(accountID) || string.IsNullOrEmpty(externalAccountID))
            {
                return(false);
            }
            var account = new AccountProcessor(_connectionString).GetAccountById(accountID, clientId);

            if (account == null)
            {
                return(false);
            }

            return(_datafeedDataService.AddAccountDatafeedMapping(clientId, datafeed, vendorID, accountID, externalAccountID));
        }
Beispiel #2
0
        public bool RemoveExternalAccountMapping(string clientId, string accountID, string externalAccountId)
        {
            if (string.IsNullOrEmpty(accountID) || string.IsNullOrEmpty(externalAccountId))
            {
                return(false);
            }

            var account = new AccountProcessor(_connectionString).GetAccountById(accountID, clientId);

            if (account == null)
            {
                return(false);
            }

            return(_datafeedDataService.RemoveAccountDatafeedMapping(clientId, accountID, externalAccountId));
        }
        public void LoadTransactionAccountNames(List <Transaction> transactions, string clientId)
        {
            Dictionary <string, string> accountNames     = new Dictionary <string, string>();
            AccountProcessor            accountProcessor = new AccountProcessor(_connectionString);

            foreach (Transaction transaction in transactions)
            {
                if (accountNames.ContainsKey(transaction.AccountID))
                {
                    transaction.AccountName = accountNames[transaction.AccountID];
                }
                else
                {
                    string accountName = accountProcessor.GetAccountNameById(transaction.AccountID, clientId);
                    transaction.AccountName = accountName;
                    accountNames.Add(transaction.AccountID, accountName);
                }
            }
        }
        public bool RefreshAccount(string clientId, string accountId)
        {
            // Check if client owns account
            Account account = new AccountProcessor(_connectionString).GetAccountById(accountId, clientId);

            if (account == null)
            {
                return(false);
            }

            Task task = new Task($"Account Refresh [{account.AccountName}]", clientId, TaskType.AccountRefresh);

            task.Data.Add("AccountID", account.ID);

            var args = new Dictionary <string, object> {
                { "AccountID", account.ID }
            };

            _backgroundJobs.Enqueue <AccountRefresh>(t => t.Execute(task));
            return(true);
            // return _taskDataService.AddTaskToQueue(task);
        }
 public StatisticsProcessor(string connectionString, TransactionLogoCalculator logoCalculator)
 {
     _transactionProcessor = new TransactionProcessor(connectionString, logoCalculator);
     _accountProcessor     = new AccountProcessor(connectionString);
 }