Example #1
0
        public void Withdraw(int sum)
        {
            if (sum <= _sum)
            {
                _sum -= sum;

                _del?.Invoke($"Сумма {sum} снята со счета");
            }
            else
            {
                _del?.Invoke("Недостаточно денег на счете");
            }
        }
Example #2
0
 private void CallEvent(AccountEventArgs e, AccountStateHandler handler)
 {
     if (e != null)
     {
         handler?.Invoke(e);
     }
 }
Example #3
0
         // вызов событий
         private void CallEvent(AccountEventArgs e, AccountStateHandler handler)
         
 {
                 if(e != null)
                     handler?.Invoke(this, e);
             
 }
Example #4
0
        }                                    // Уникальный идентификатор счета

        // Определяем методы генерации:
        private void CallEvent(AccountEventArgs e, AccountStateHandler handler)  // Вызов событий
        {
            if (e != null)
            {
                handler?.Invoke(this, e);
            }
        }
 /// <summary>
 /// Базовый метод вызова событий
 /// </summary>
 /// <param name="args">Вспомогательный класс обработки событий</param>
 /// <param name="handler">Обработчик событий</param>
 private void CallEvent(AccountEventArgs args, AccountStateHandler handler)
 {
     if (args == null)
     {
         throw new Exception("При вызове определенного события, оно должно иметь содержание");
     }
     else
     {
         handler?.Invoke(args);
     }
 }
Example #6
0
 public void WithDraw(int sum)
 {
     if (sum <= this.sum)
     {
         this.sum -= sum;
         this.stateHandler.Invoke($"{sum} was withdrawed");
     }
     else
     {
         stateHandler.Invoke("You have don't enough money");
     }
 }
Example #7
0
 public void Put(int sum)
 {
     CurrentSum += sum;
     _del.Invoke($"{sum}$ were added to the account!");
 }