Ejemplo n.º 1
0
        public StockOne()
        {
            var item = new StockItem(ProductId);

            item.Add(5);
            this.WithData(item);
        }
Ejemplo n.º 2
0
 private static void AddStocks(CardInfo info, int qty)
 {
     if (info.ProductId > 0)
     {
         StockInfo stockInfo = new StockInfo();
         stockInfo.StockId   = StockManage.GetMaxId() + 1;
         stockInfo.Inputer   = PEContext.Current.Admin.AdminName;
         stockInfo.InputTime = DateTime.Now;
         stockInfo.Remark    = (qty > 1) ? "批量生成点卡" : "生成点卡";
         stockInfo.StockNum  = StockItem.GetInStockNum();
         stockInfo.StockType = StockType.InStock;
         if (StockManage.Add(stockInfo))
         {
             decimal price       = 0M;
             string  productNum  = string.Empty;
             string  unit        = string.Empty;
             string  productName = string.Empty;
             if (!string.IsNullOrEmpty(info.TableName))
             {
                 Product.AddStocks(info.ProductId, qty);
                 ProductInfo productById = Product.GetProductById(info.ProductId);
                 price       = productById.PriceInfo.Price;
                 productNum  = productById.ProductNum;
                 unit        = productById.Unit;
                 productName = productById.ProductName;
             }
             else
             {
                 Present.AddStocks(info.ProductId, qty);
                 PresentInfo presentById = Present.GetPresentById(info.ProductId);
                 price       = presentById.Price;
                 productNum  = presentById.PresentNum;
                 unit        = presentById.Unit;
                 productName = presentById.PresentName;
             }
             if (!string.IsNullOrEmpty(productName))
             {
                 StockItemInfo info5 = new StockItemInfo();
                 info5.Amount      = qty;
                 info5.ItemId      = StockItem.GetMaxId() + 1;
                 info5.ProductId   = info.ProductId;
                 info5.TableName   = info.TableName;
                 info5.Price       = price;
                 info5.ProductNum  = productNum;
                 info5.Unit        = unit;
                 info5.ProductName = productName;
                 StockItem.Add(info5, stockInfo.StockId);
             }
         }
     }
 }
Ejemplo n.º 3
0
 private static bool DeleteSingleCard(CardInfo info, int stockId)
 {
     if (Product.AddStocks(info.ProductId, -1))
     {
         ProductInfo productById = Product.GetProductById(info.ProductId, info.TableName);
         if (!productById.IsNull)
         {
             StockItemInfo info3 = new StockItemInfo();
             info3.Amount      = 1;
             info3.Price       = productById.PriceInfo.Price;
             info3.ProductId   = productById.ProductId;
             info3.TableName   = productById.TableName;
             info3.Unit        = productById.Unit;
             info3.ProductNum  = productById.ProductNum;
             info3.ProductName = productById.ProductName;
             return(StockItem.Add(info3, stockId));
         }
     }
     return(false);
 }