示例#1
0
        private static void OnMondayMorning()
        {
            try
            {
                Dictionary <int, bool> accountTested = new Dictionary <int, bool>();

                // Check the bitcoin hotwallets for forex profit/loss.

                Organizations allOrganizations = Organizations.GetAll();

                foreach (Organization organization in allOrganizations)
                {
                    FinancialAccount hotWalletAccount = organization.FinancialAccounts.AssetsBitcoinHot;

                    if (hotWalletAccount != null)
                    {
                        BitcoinUtility.CheckHotwalletForexProfitLoss(hotWalletAccount);
                        accountTested[hotWalletAccount.Identity] = true;
                    }
                }

                // Detect and log any forex difference exceeding 100 cents.

                FinancialAccounts allAccounts = FinancialAccounts.GetAll(); // across ALL ORGS!

                foreach (FinancialAccount account in allAccounts)
                {
                    // For every account, if it's based on foreign currency, and not already checked,
                    // then check for forex gains/losses

                    if (account.ForeignCurrency != null && !accountTested.ContainsKey(account.Identity))
                    {
                        account.CheckForexProfitLoss();
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionMail.Send(e, true);
                if (testMode)
                {
                    Console.WriteLine(e.ToString());
                }
            }
        }
示例#2
0
        private static void OnMondayMorning()
        {
            try
            {
                // Detect and log any forex difference exceeding 100 cents.

                FinancialAccounts allAccounts = FinancialAccounts.GetAll(); // across ALL ORGS!

                foreach (FinancialAccount account in allAccounts)
                {
                    // For every account, if it's based on foreign currency, check for forex gains/losses

                    if (account.ForeignCurrency != null)
                    {
                        account.CheckForexProfitLoss();
                    }
                }

                // Also check the bitcoin hotwallets for forex profit/loss as a special case of the above.

                Organizations allOrganizations = Organizations.GetAll();

                foreach (Organization organization in allOrganizations)
                {
                    FinancialAccount hotWalletAccount = organization.FinancialAccounts.AssetsBitcoinHot;

                    if (hotWalletAccount != null)
                    {
                        BitcoinUtility.CheckHotwalletForexProfitLoss(hotWalletAccount);
                    }
                }
            }
            catch (Exception e)
            {
                ExceptionMail.Send(e, true);
                if (testMode)
                {
                    Console.WriteLine(e.ToString());
                }
            }
        }