public void AddInventory()
        {
            Console.Clear();
            AsciiHeader.AsciiHead();
            Location  trackedLocation = new Location();
            Inventory newInventory    = new Inventory();
            Product   newProduct      = new Product();


            Console.WriteLine("Please enter the appropriate information to update a store's inventory");

            Console.WriteLine("Enter Location Name: ");



            trackedLocation = _locationBL.FilterLocationByName(Console.ReadLine());
            if (trackedLocation.LocationID == 0)
            {
                Console.WriteLine("That's not a location Name :( please try again!");
                Console.WriteLine("Press Enter to Continue.");
                Console.ReadLine();
                return;
            }
            else
            {
                newInventory.InventoryLocation = trackedLocation.LocationID;
            }

            Console.WriteLine("Create a name for your inventory: ");
            newInventory.InventoryName = Console.ReadLine();

            Console.WriteLine("Please enter a product name to store in this inventory: ");
            newProduct = _productBL.GetFilteredProduct(Console.ReadLine());

            if (newProduct.ProductName == null)
            {
                Console.WriteLine("This product does not exist in our system. Please try again :(");
                return;
            }
            newInventory.ProductID = newProduct.ProductID;

            Console.WriteLine($"how many {newProduct.ProductName} items should be added to this inventory?");

            newInventory.ProductQuantity = Int32.Parse(Console.ReadLine());

            Console.WriteLine($"Great! the {trackedLocation.LocationName} location has been updated with an inventory of {newInventory.ProductQuantity} {newProduct.ProductName}");

            _inventoryBL.AddInventory(newInventory);
            Console.WriteLine("Inventory update successful! Press enter to continue.");
            Log.Information($"Inventory at the {trackedLocation.LocationName} location has been updated with {newInventory.ProductQuantity} {newProduct.ProductName}s");
            Console.ReadLine();
            Console.Clear();



            //Console.WriteLine(newInventory.InventoryLocation);
        }
        private void AddInventory(Location location)
        {
            //ToDo - entery name as well?
            string barcode  = _validate.ValidateEmptyInput("Enter product barcode");
            int    quantity = _validate.ValidateQuantity("Enter quantity for this item");

            // ToDo - check if new product has inventory already
            // Display a list of new product which has no quantity
            Product product = _productBL.GetProduct(barcode);

            _inventoryBL.AddInventory(location, product, new Item(quantity));
            Console.WriteLine($"{product.Name}'s quantity is added");
        }
Exemplo n.º 3
0
        public void AddNewProduct(int locId)
        {
            //create new product & inventory for that product
            Product   newProduct   = new Product();
            Inventory newInventory = new Inventory();

            Console.WriteLine("Please enter product name: ");
            newProduct.ProductName = Console.ReadLine();
            Console.WriteLine("Please enter price of product per pint: ");
            newProduct.ProductPrice = decimal.Parse(Console.ReadLine());
            Console.WriteLine("Please enter quantity of product in pints: ");
            newInventory.Quantity = int.Parse(Console.ReadLine());

            _productBL.AddProduct(newProduct);

            newInventory.ProductId  = _productBL.GetProducts().Last().ProductID;
            newInventory.LocationId = locId;

            _inventoryBL.AddInventory(newInventory);

            Console.WriteLine($"{newProduct.ProductName} added to products!");
        }