Exemplo n.º 1
0
 public void Process(StockModel stock)
 {
     using (var db = new YintaiHZhouContext())
     {
         var sku       = db.OPC_SKU.FirstOrDefault(x => x.Id == stock.SkuId);
         var inventory = db.Inventories.FirstOrDefault(x => x.ProductId == sku.ProductId && x.PColorId == sku.ColorValueId && x.PSizeId == sku.SizeValueId);
         if (inventory == null)
         {
             db.Inventories.Add(new Inventory()
             {
                 ProductId          = sku.ProductId,
                 PColorId           = sku.ColorValueId,
                 PSizeId            = sku.SizeValueId,
                 UpdateDate         = DateTime.Now,
                 UpdateUser         = SystemDefine.SystemUser,
                 ChannelInventoryId = 0,
                 Amount             = stock.Count
             });
         }
         else
         {
             inventory.UpdateDate = DateTime.Now;
             inventory.UpdateUser = SystemDefine.SystemUser;
             inventory.Amount     = stock.Count;
         }
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public override void Process(StockModel model)
 {
     foreach (var processor in _processors)
     {
         processor.Process(model);
     }
 }
Exemplo n.º 3
0
 public void Process(StockModel stock)
 {
     using (var db = new YintaiHZhouContext())
     {
         var product = db.Products.Join(db.OPC_SKU.Where(x => x.Id == stock.SkuId), p => p.Id, x => x.ProductId, (x, p) => x).FirstOrDefault();
         if (null != product)
         {
             if (!product.Is4Sale.HasValue || !product.Is4Sale.Value || product.Price != stock.Price)
             {
                 product.Is4Sale     = true;
                 product.Price       = stock.Price;
                 product.UpdatedDate = DateTime.Now;
                 //product.UpdatedUser = SystemDefine.SystemUser;
                 db.SaveChanges();
             }
         }
     }
 }
Exemplo n.º 4
0
 public abstract void Process(StockModel model);