public PartCost PreviewCheckOut(PartDescription partDescription, int quantity, IPriceStrategy priceStrategy) { int totalPrice = warehousesBatches.Filter(partDescription) .AccumulatePrice(quantity, priceStrategy); return(new PartCost(totalPrice)); }
private bool Exists(PartDescription partDescription) { if (!batches.ContainsKey(partDescription.Warehouse)) { return(false); } return(batches[partDescription.Warehouse].Exists(partDescription.PartType)); }
public WarehouseBatches Filter(PartDescription partDescription) { if (!Exists(partDescription)) { return(new WarehouseBatches()); } return(batches[partDescription.Warehouse].FindBatchesBy(partDescription.PartType)); }
public int GetQuantity(PartDescription partDescription) { return(warehousesBatches.Filter(partDescription) .GetRemainingParts()); }
public void CheckOut(PartDescription partDescription, int quantity, IPriceStrategy priceStrategy) { warehousesBatches.Filter(partDescription) .ReduceStock(quantity, priceStrategy); }