Beispiel #1
0
        public static IInventoryItem UpdateInventory(this IInventoryItem item, string description, int stockQuantity, int?minStockQuantity, int?maxStockQuantity)
        {
            var afterQuantity = item.GetAfterQuantity(stockQuantity, "UpdateInventory");

            if (item.StockQuantity != afterQuantity)
            {
                ServiceProvider.Current.Inventory.Item.UpdateInventory(item.ItemID, stockQuantity, afterQuantity, "UpdateInventory", 0, 0);
            }

            return(ServiceProvider.Current.Inventory.Item
                   .UpdateItem(item.ItemID, description, stockQuantity, minStockQuantity, maxStockQuantity));
        }
Beispiel #2
0
        public static IInventoryItem CheckOut(this IInventoryItem item, int updateQuantity, IItemInventoryLocation itemLoc, int clientId)
        {
            var afterQuantity = item.GetAfterQuantity(updateQuantity, "CheckOut");
            int locId         = (itemLoc == null) ? 0 : itemLoc.ItemInventoryLocationID;

            if (item.StockQuantity != afterQuantity)
            {
                ServiceProvider.Current.Inventory.Item.UpdateInventory(item.ItemID, updateQuantity, afterQuantity, "CheckOut", locId, clientId);
                return(ServiceProvider.Current.Inventory.Item.UpdateItem(item.ItemID, item.Description, Convert.ToInt32(afterQuantity), null, null));
            }

            return(item);
        }