Exemple #1
0
        /// <summary>
        /// Delete this shift
        /// </summary>
        /// <param name="shift">Shift</param>
        public void DeleteShift(Shift shift)
        {
            if (!Shifts.Contains(shift))
            {
                return;
            }

            // can't be in use
            foreach (Shift inUseShift in Shifts)
            {
                foreach (Team team in Teams)
                {
                    Rotation rotation = team.Rotation;

                    foreach (TimePeriod period in rotation.GetPeriods())
                    {
                        if (period.Equals(inUseShift))
                        {
                            string msg = String.Format(WorkSchedule.GetMessage("shift.in.use"), shift.Name);
                            throw new Exception(msg);
                        }
                    }
                }
            }

            Shifts.Remove(shift);
        }
 public void SetCloseShiftClicked()
 {
     Mediator.GetInstance().ShiftCloseClicked += (s, e) =>
     {
         if (e.Shift.GetType() == typeof(ScheduleShift))
         {
             Shifts.Remove((ScheduleShift)e.Shift);
             DeletedShifts.Add((ScheduleShift)e.Shift);
             DayColumnList.ForEach(x => x.ResetTimeCells());
             Clear();
             LoadShiftsIntoCalendar();
         }
     };
 }