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

            if (Balance < 0)
            {
                Withdrawn?.Invoke(this, new AccountArgs {
                    Message = "You are going overdrawn"
                });
            }
        }
Esempio 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("На счёте не достаточно средств для списания.");
     }
 }
Esempio n. 3
0
        private void BackgroundWorker_ReadRZ_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (Withdrawn != null)
            {
                foreach (Delegate d in Withdrawn.GetInvocationList())
                {
                    d.DynamicInvoke(_resultRecive);
                }
            }

            //  Withdrawn?.Invoke(_resultRecive);
        }
Esempio n. 4
0
 public void Withdraw(int sum)
 {
     if (_sum >= sum)
     {
         _sum -= sum;
         Withdrawn?.Invoke($"Со счёта снято {sum}");
     }
     else
     {
         Withdrawn?.Invoke("На счёте недостаточно средств");
     }
 }
Esempio n. 5
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");
     }
 }
Esempio n. 6
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);
     }
 }
 public BankAccountState Apply(Withdrawn evnt)
 {
     Balance -= evnt.Amount;
     return(this);
 }
Esempio n. 9
0
 private void OnMoneyWithdrawn(Withdrawn e)
 {
     lastEvent = e;
     accountShardRegion.Tell(new ShardEnvelope <Deposit>(toAccount, new Deposit(PersistenceId, amount)));
     Become(AwaitDeposited);
 }