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

            if (item != null)
            {
                _produced.Remove(item);
            }
        }
Exemple #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");
            }
        }
Exemple #4
0
 public PressMasterItemControl()
 {
     InitializeComponent();
     Item = DataContext as PressMasterItem;
 }
Exemple #5
0
 public PressMasterItemControl(PressMasterItem item)
 {
     InitializeComponent();
     Item        = item;
     DataContext = Item;
 }