Ejemplo n.º 1
0
        public void Withdraw(decimal amount)
        {
            Balance -= amount;

            if (Balance < 0)
            {
                Withdrawn?.Invoke(this, new AccountArgs {
                    Message = "You are going overdrawn"
                });
            }
        }
Ejemplo n.º 2
0
 public void Withdraw(Money money)
 {
     if (CurrentBalance - money >= new Money(0, money.Currency))
     {
         CurrentBalance -= money;
         Withdrawn?.Invoke($"Со счёта списано {money.Sum} {money.Currency}");
     }
     else
     {
         Withdrawn?.Invoke("На счёте не достаточно средств для списания.");
     }
 }
Ejemplo n.º 3
0
 public void Withdraw(int sum)
 {
     if (_sum >= sum)
     {
         _sum -= sum;
         Withdrawn?.Invoke($"Со счёта снято {sum}");
     }
     else
     {
         Withdrawn?.Invoke("На счёте недостаточно средств");
     }
 }
Ejemplo n.º 4
0
 public void Withdraw(int sum)
 {
     if (sum <= Sum)
     {
         Sum    -= sum;
         Message = Withdrawn?.Invoke($"The amount of {sum} was withdrawn from the account");
     }
     else
     {
         Message = Withdrawn?.Invoke("There is not enough money on the account");
     }
 }
Ejemplo n.º 5
0
 // Списание средств со счёта
 public void Withdraw(int sum)
 {
     if (Sum >= sum)
     {
         Sum -= sum;
         Withdrawn?.Invoke(this, new AccountEventArgs($"Со счёта снято: {sum}", sum));
     }
     else
     {
         Withdrawn?.Invoke(this, new AccountEventArgs($"Недостаточно денег на счёте. Текущий баланс: {Sum}", 0));
     }
 }
 public void Withdraw(int amount)
 {
     if (_balance < amount)
     {
         var args = new WalletEventArgs($"Not enough money on wallet's balance", amount);
         Withdrawn?.Invoke(this, args);
     }
     else
     {
         _balance -= amount;
         var args = new WalletEventArgs($"{amount} of money was withdrawned from the wallet", amount);
         Withdrawn?.Invoke(this, args);
     }
 }