static public void RebuildAllCreditBalances() { if (!UseBalanceCalculation) { return; } int accountId = 0; try { DataTable accounts = AccountBalancesData.GetDirtyBalancesAccounts(); for (int i = 0; i < accounts.Rows.Count; i++) { accountId = (int) accounts.Rows[i]["FinancialAccountId"]; AccountCreditBalance balance = new AccountCreditBalance(accountId); balance.Rebuild(); } FinancialAccountData.ResetAccountsTable(); DataReader.Optimize(); } catch (Exception innerException) { FinancialServicesException exception = new FinancialServicesException(FinancialServicesException.Msg.CreditBalanceRebuildFails, innerException, accountId); exception.Publish(); throw exception; } //ThreadStart job = new ThreadStart(RebuildAllCreditBalancesJob); //Thread thread = new Thread(job); //thread.Start(); }
public void RebuildCreditBalancesForced() { try { if (!UseBalanceCalculation) { return; } AccountCreditBalance balance = new AccountCreditBalance(this.Id); balance.Rebuild(); FinancialAccountData.UpdateAccountsTable(this.Id); } catch (Exception innerException) { FinancialServicesException exception = new FinancialServicesException(FinancialServicesException.Msg.CreditBalanceRebuildFails, innerException, this.Id); exception.Publish(); throw exception; } }