public void RemoveBanknote(uint banknote, byte count) { if (_banknotes.TryGetValue(banknote, out byte value)) { if (value >= count) { _banknotes[banknote] = (byte)(value - count); if (_banknotes[banknote] == 0) { _banknotes.Remove(banknote); } //Sieve calcGrants = SieveForRemove; calcGrants(banknote, count); _total -= banknote * count; countBanknotes -= count; } else { Console.WriteLine("Нет стольких купюр такого номинала"); } } else { Console.WriteLine("Нет купюры такого номинала"); } }
public void AddBanknote(uint banknote, byte count) { if (_banknotes.TryGetValue(banknote, out byte value)) { _banknotes[banknote] = (byte)(count + value); } else { _banknotes.Add(banknote, count); } //Sieve calcGrants = SieveForAdd; calcGrants(banknote, count); _total += banknote * count; countBanknotes += count; }