예제 #1
0
        public double OrderItems(IItem item, uint amount)
        {
            ISupplier supplierForItem = Marketplace.GetInstance().FindSupplier(item);

            if (supplierForItem == null)
            {
                return(0.0);
            }
            if (_stock.ContainsKey(item))
            {
                _stock[item] += amount;
            }
            else
            {
                _stock.Add(item, amount);
            }
            return(supplierForItem.Buy(item, amount));
        }
예제 #2
0
 public DefaultSupplier()
 {
     this.ItemsWithSupplyPrice = new Dictionary <IItem, double>();
     Marketplace.GetInstance().RegisterSupplier(this);
 }