Пример #1
0
        public static string Message(ShipmentUnpackedInCargoBay e)
        {
            var builder = new StringBuilder();
            builder.AppendFormat("{0} unload:", e.EmployeeName).AppendLine();
            foreach (var inventoryShipment in e.InventoryShipments)
            {
                builder.AppendFormat("\tshipment name '{0}' and parts:\r\n", inventoryShipment.Name);
                foreach (var carPart in inventoryShipment.Cargo)
                    builder.AppendFormat("\t\t{0} {1} pcs", carPart.Name, carPart.Quantity).AppendLine();
            }

            return builder.ToString();
        }
Пример #2
0
        public static string Message(ShipmentUnpackedInCargoBay e)
        {
            var builder = new StringBuilder();

            builder.AppendFormat("{0} unload:", e.EmployeeName).AppendLine();
            foreach (var inventoryShipment in e.InventoryShipments)
            {
                builder.AppendFormat("\tshipment name '{0}' and parts:\r\n", inventoryShipment.Name);
                foreach (var carPart in inventoryShipment.Cargo)
                {
                    builder.AppendFormat("\t\t{0} {1} pcs", carPart.Name, carPart.Quantity).AppendLine();
                }
            }

            return(builder.ToString());
        }
Пример #3
0
        public void When(ShipmentUnpackedInCargoBay theEvent)
        {
            foreach (var shipmentInCargoBay in theEvent.InventoryShipments)
            {
                ShipmentsWaitingToBeUnpacked.Remove(shipmentInCargoBay.Name);

                foreach (var part in shipmentInCargoBay.Cargo)
                {
                    if (!_availableParts.ContainsKey(part.Name))
                        _availableParts.Add(part.Name, part.Quantity);
                    else
                        _availableParts[part.Name] += part.Quantity;
                }
            }

            // Rule: an Employee can only unpack shipments in the cargo bay once a day
            // so remember who just did it
            EmployeesWhoHaveUnpackedCargoBayToday.Add(theEvent.EmployeeName);
        }
 public void When(ShipmentUnpackedInCargoBay e)
 {
     Factories[e.Id].PartsInCargoBay -= e.InventoryShipments.Sum(s => s.Cargo.Sum(p => p.Quantity));
 }