Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 4
0
 public int GetQuantity(PartDescription partDescription)
 {
     return(warehousesBatches.Filter(partDescription)
            .GetRemainingParts());
 }
Ejemplo n.º 5
0
 public void CheckOut(PartDescription partDescription, int quantity, IPriceStrategy priceStrategy)
 {
     warehousesBatches.Filter(partDescription)
     .ReduceStock(quantity, priceStrategy);
 }