Esempio n. 1
0
        public void AddItem(Item item, double costPrice)
        {
            //foreach (var doItem in dl.GetItems())
            //{
            //    if (doItem.ItemID == item.ItemID)
            //    {
            //        dl.EditStock(item.ItemID, item.Quantity - dl.GetStockItem(doItem.ItemID));
            //        return;
            //    }
            //}
            string itemID = dl.GetNewItemID().ToString(@"00000");

            dl.AddItem(new DO.Item
            {
                ItemID      = itemID,
                Brand       = item.Brand,
                Description = item.Description,
                ModelNumber = item.ModelNumber,
                Price       = item.Price,
                IsActive    = true
            });
            dl.AddStockItem(new DO.StockItem
            {
                ItemID   = itemID,
                Quantity = item.Quantity,
                Date     = DateTime.Now,
                Price    = costPrice
            });
            if (item.Image != null)
            {
                dl.AddImage(item.ItemID, item.Image);
            }
        }