Beispiel #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);
        }
Beispiel #2
0
        private void Remove(object arg)
        {
            PressMasterItem item = arg as PressMasterItem;

            if (item != null)
            {
                _produced.Remove(item);
            }
        }
Beispiel #3
0
        public void Remove(ProductMasterItem item, ref double scheduledCount)
        {
            PressMasterItem pressItem = Produced.FirstOrDefault(p => p.MasterItem.Equals(item));

            if (pressItem != null)
            {
                if (scheduledCount >= pressItem.UnitsMade)
                {
                    Produced.Remove(pressItem);
                }

                scheduledCount -= pressItem.UnitsMade;
                RaisePropertyChangedEvent("Produced");
            }
        }
Beispiel #4
0
 public PressMasterItemControl()
 {
     InitializeComponent();
     Item = DataContext as PressMasterItem;
 }
Beispiel #5
0
 public PressMasterItemControl(PressMasterItem item)
 {
     InitializeComponent();
     Item        = item;
     DataContext = Item;
 }