private void AddLineItemToCart(InventoryLineItem selection, int quantityOrdered) { Log.Logger.Information("Adding a staged line item to the user's order cart.."); StagedLineItem newLineItem = new StagedLineItem(selection.Product, quantityOrdered, selection); OrderCart.Add(newLineItem); }
public void DestageLineItem(int index) { Log.Logger.Information("Removing a staged line item from the user's order cart.."); StagedLineItem selectedStagedLineItem = OrderCart.ElementAt(index); if (selectedStagedLineItem.GetType() != typeof(StagedLineItem)) { throw new Exception("What in the world happened in OrderBuilder?"); //return; } OrderCart.RemoveAt(index); }
public void StageProductForOrder(InventoryLineItem selection, int quantityOrdered) { StagedLineItem existingStagedLineItem = GetStagedLineItemForAffectedLineItemIfItExists(selection); if (existingStagedLineItem != null) { Log.Logger.Information("Changing the quantity of an existing line item in the order cart.."); existingStagedLineItem.Quantity += quantityOrdered; } else { AddLineItemToCart(selection, quantityOrdered); } }
private void ProcessStagedLineItemOutOfInventory(StagedLineItem lineItem) { Log.Logger.Information("Removing ordered product from inventory by changing or removing inventory line items.."); int newQuantity = lineItem.GetNewQuantityOfAffectedInventoryLineItem(); if (newQuantity < 1) { LocationService.RemoveInventoryLineItemInRepo(SelectedLocationStock.Find(ili => ili.ProductId == lineItem.affectedInventoryLineItem.ProductId)); //OrderService.RemoveLineItemFromLocationInventory(SelectedLocationStock.Find(ili => ili.ProductId == lineItem.affectedInventoryLineItem.ProductId)); SelectedLocationStock.Remove(SelectedLocationStock.Find(ili => ili.ProductId == lineItem.affectedInventoryLineItem.ProductId)); } else { SelectedLocationStock.Find(ili => ili.ProductId == lineItem.affectedInventoryLineItem.ProductId).ProductQuantity = newQuantity; } }