Ejemplo n.º 1
0
        public bool Add(ProductMasterItem item, ref double count)
        {
            bool   added    = false;
            double numToAdd = count;

            if (!IsFull())
            {
                // get the number that can be added.
                double hoursAvailable = GetAvailableHours();
                double maxUnitsToMake = hoursAvailable * item.UnitsPerHour;

                // clamp
                numToAdd = numToAdd > maxUnitsToMake ? maxUnitsToMake : numToAdd;

                PressMasterItem pressItem = Produced.FirstOrDefault(p => p.MasterItem == item);

                if (pressItem == null)
                {
                    Produced.Add(new PressMasterItem(item, numToAdd));
                }
                else
                {
                    pressItem.UnitsMade += numToAdd;
                }
                RaisePropertyChangedEvent("Produced");
                count -= numToAdd;
                added  = true;
            }

            return(added);
        }
Ejemplo n.º 2
0
 protected void Apply(IEvent @event)
 {
     Evolve(@event);
     Produced.Add(@event);
 }