Exemplo n.º 1
0
        public CurrencyData ChangeValue(CurrencyType currencyType, int amount, string source)
        {
            CurrencyData currencyData = this.CurrentAmounts.ChangeValue(currencyType, amount);

            if (currencyData == null)
            {
                return(null);
            }

            this.Transactions.Enqueue(new CurrencyTransaction
            {
                Type   = currencyType,
                Amount = amount,
                Source = source,
                Time   = DateTime.UtcNow
            });
            while (this.Transactions.Count > 20)
            {
                this.Transactions.Dequeue();
            }

            return(currencyData);
        }
Exemplo n.º 2
0
 public virtual void SetValue(CurrencyData newBalance)
 {
     this.CurrentAmounts.SetValue(newBalance);
 }
Exemplo n.º 3
0
 public bool CanAfford(CurrencyData cost)
 {
     return(this.CurrentAmounts.CanAfford(cost));
 }