Exemple #1
0
 public string CashOut(int value, CurrencyType currency)
 {
     try
     {
         var cashOutAmountList = new List <(int value, int count)>();
         _handler.CashOut(cashOutAmountList, new Banknote(value, currency));
         return($"{value}{(char)currency} = {string.Join(" + ", cashOutAmountList.Select(t => $"{t.value}{(char)currency}*{t.count}"))}");
     }
     catch (Exception)
     {
         return($"Sorry, the bancomat can not cash {value}{(char) currency}");
     }
 }
        public IEnumerable <IBanknote> CashOut(string value)
        {
            var result = handler.CashOut(ref value);

            return(Regex.Match(value, @"^[^1-9]$").Success ? result : null);
        }
 //Обналичивает купюры, возвращает true, если смог обналичить, false если не смог обналичить
 public virtual bool CashOut(int amount, CurrencyType currency)
 {
     return(_nextHandler != null && _nextHandler.CashOut(amount, currency));
 }
 public bool CashOut(int amount, CurrencyType currency)
 {
     return(_handler.CashOut(amount, currency));
 }