예제 #1
0
 /// <summary>
 /// Выдаем товар
 /// </summary>
 /// <param name="goodItem"></param>
 /// <param name="customer"></param>
 public virtual void TakeTheGood(GoodsItem goodItem, Customer customer)
 {
     if (customer.GetTheGood(goodItem))
     {
         GoodsStorage.RemoveItems(a => a.Equals(goodItem));
         DBalance = 0;
     }
 }
예제 #2
0
        /// <summary>
        /// продаем товар
        /// </summary>
        /// <param name="sellItem"></param>
        /// <param name="customer"></param>
        /// <returns></returns>
        private bool _SellTheItem(GoodsItem sellItem, Customer customer)
        {
            List <Coin> change;

            if (customer.GetTheGood(sellItem))
            {
                GoodsStorage.RemoveItems(a => a == sellItem);
                change = CountChange(sellItem, DBalance);
            }
            else
            {
                change = CountChange(null, DBalance);
            }
            if (customer.GetCoins(change))
            {
                Wallet.RemoveItems(a => change.Contains(a));
                DBalance = 0;
                NewMessage("Thank you!");
                return(true);
            }
            return(false);
        }