void AnnounceInsideFactory(CarProduced theEvent)
        {
            // TODO:  Reduce the Inventory of parts that were just used
            // TODO:  But the whole inventory system needs to be revamped I think :)

            // Rule: an employee can only build one car a day
            // so remember who just did it

            EmployeesWhoHaveProducedACarToday.Add(theEvent.EmployeeName);
        }
Exemple #2
0
        void AnnounceInsideFactory(CarProduced e)
        {
            var wheelsRemoved = 0;
            var wheelsParts = ShipmentsWaitingToBeUnloaded.SelectMany(x => x).Where(x => x.Name == "wheels");

            foreach (var wheelsPart in wheelsParts)
            {
                var wheelsToRemove = wheelsPart.Quantity >= 4 - wheelsRemoved ? 4 - wheelsRemoved : wheelsPart.Quantity;
                wheelsRemoved += wheelsToRemove;

                wheelsPart.Quantity -= wheelsToRemove;

                if (wheelsRemoved == 4)
                    break;
            }
        }