private void CreateShifts() { _shifts.Clear(); for (DateTime current = StartTime; current < EndTime; current = current.AddDays(1)) { Shift matchingShift = null; foreach (var s in ProductionShifts) { if (s.DaysList.Contains(current.DayOfWeek)) { if (s.StartDate <= current) { if (s.EndDate >= current) { matchingShift = s; PressShift newShift = new PressShift(new DateTime(current.Year, current.Month, current.Day, matchingShift.StartTime.Hour, matchingShift.StartTime.Minute, matchingShift.StartTime.Second), matchingShift.Duration, s.Name); _shifts.Add(newShift); } } } } } }
public PressShiftControl() { InitializeComponent(); Shift = DataContext as PressShift; if (Shift == null) { Shift = Content as PressShift; } ProductSelectionBox.ItemsSource = StaticInventoryTracker.PressMasterList; }
public PressShift GetShift(DateTime start, DateTime end) { PressShift shift = null; foreach (var pressShift in _shifts) { if (pressShift.EndTime + PressManager.Instance.DelayTime <= end && pressShift.EndTime + PressManager.Instance.DelayTime > start) { shift = pressShift; break; } } return(shift); }
public PressShiftControl(PressShift shift) { InitializeComponent(); if (shift != null) { Shift = shift; DataContext = Shift; } else { Shift = DataContext as PressShift; } ProductSelectionBox.ItemsSource = StaticInventoryTracker.PressMasterList; }