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); }
private void Remove(object arg) { PressMasterItem item = arg as PressMasterItem; if (item != null) { _produced.Remove(item); } }
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"); } }
public PressMasterItemControl() { InitializeComponent(); Item = DataContext as PressMasterItem; }
public PressMasterItemControl(PressMasterItem item) { InitializeComponent(); Item = item; DataContext = Item; }