Ejemplo n.º 1
0
 // Show borrowed money in red
 private Color getBalanceColor(BankAccount account)
 {
     if (account.AccountIsOverdrawn())
     {
         return(Color.Red);
     }
     return(Color.Black);
 }
Ejemplo n.º 2
0
        // If the account balance is negative (credit line only), display it inside parentheses.
        private string getBalanceDisplayString(BankAccount account)
        {
            decimal absoluteBalance = Math.Abs(account.Balance);
            string  balanceString   = absoluteBalance.ToString("N2");

            if (account.AccountIsOverdrawn())
            {
                return(string.Format("({0})", balanceString));
            }

            return(balanceString);
        }