예제 #1
0
        /// <summary>
        /// 找到某个商品在这个仓库中的库存项
        ///
        /// 如果不存在,则创建一个对应项。
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        public StorageProduct FindOrCreateItem(Product product)
        {
            var children = this.StorageProductList;
            var item     = children.Cast <StorageProduct>().FirstOrDefault(e => e.ProductId == product.Id);

            if (item != null)
            {
                return(item);
            }

            item = new StorageProduct
            {
                Product = product
            };

            children.Add(item);

            return(item);
        }
예제 #2
0
 public void Insert(int index, StorageProduct entity)
 {
     base.Insert(index, entity);
 }
예제 #3
0
 public int IndexOf(StorageProduct entity)
 {
     return(base.IndexOf(entity));
 }
예제 #4
0
 public bool Contains(StorageProduct entity)
 {
     return(base.Contains(entity));
 }
예제 #5
0
 public void Add(StorageProduct entity)
 {
     base.Add(entity);
 }
예제 #6
0
 public bool Remove(StorageProduct entity)
 {
     return(base.Remove(entity));
 }