示例#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));
 }