Ejemplo n.º 1
0
 public Boolean AddGoods(MarketGoods goods, Int32 count)
 {
     if (goods.GoodsCount == -1 || goods.GoodsCount > count) // enough goods to add
     {
         if (count <= LeftCapacity)                          // enough room to place the goods
         {
             if (MyGoods.Exists(t => t.GoodsName == goods.GoodsName))
             {
                 var g = MyGoods.Find(t => t.GoodsName == goods.GoodsName);
                 g.InventoryGoodsAdd(goods, count);
             }
             else
             {
                 var g = new InventoryGoods(goods, count);
                 MyGoods.Add(g);
             }
             return(true);
         }
     }
     // no enough goods or no enough space
     return(false);
 }