예제 #1
0
 public bool DoctorWouldExceedMaxConsecutiveShifts(Slot slot, Doctor doctor)
 {
     if (MaxConsecutiveShifts == 0)
         return false;
     var list = GetSlotsByDoctorAndRotation(doctor, slot).ToList();
     list.Add(slot);
     return CalcMaxConsecutiveShifts(list.OrderBy(x => x.week)) > MaxConsecutiveShifts;
 }
예제 #2
0
        public bool DoctorHasExceededMaxDaysThisRotation(Slot slot, Doctor doctor)
        {
            if (MaxShiftsPerRotation == 0)
                return false;
            var list = GetSlotsByDoctorAndRotation(doctor, slot).ToList();
            list.Add(slot);

            return CountShifts(list) >
                   MaxShiftsPerRotation;
        }
예제 #3
0
 public IEnumerable<Doctor> GetEligibleDoctors(Slot slot)
 {
     return GetRankedDoctorList(slot.is24)
         .Where(x => !x.HasVacation(slot))
         .Where(x => x.Rotations[slot.rotationNumber] == slot.location);
 }
예제 #4
0
 public IEnumerable<Doctor> GetCrossCallDoctors(Slot slot)
 {
     return GetRankedDoctorList(slot.is24)
         .Where(x => !x.HasVacation(slot))
         .Where(x => x.Rotations[slot.rotationNumber] != "NA" && x.Rotations[slot.rotationNumber] != slot.location);
 }
예제 #5
0
 public bool DoctorHasExceededHisPersonalMaxShifts(Slot slot, Doctor doctor)
 {
     return doctor.TotalShiftCount + (slot.is24 ? 2 : 1) > doctor.MaxShifts;
 }
예제 #6
0
 private string GetDoctorName(Slot slot)
 {
     return slot.doctor != null
                ? string.Format(",{0}{1}", slot.doctor.Name, slot.crossCall ? " (C)" : string.Empty)
                : ",<blank>";
 }
예제 #7
0
 private IEnumerable<Slot> GetSlotsByDoctorAndRotation(Doctor doctor, Slot slot)
 {
     return Schedule.Where(x => x.doctor == doctor && x.rotationNumber == slot.rotationNumber);
 }
예제 #8
0
 private bool DoctorHasExceededMaxWeekendsPerRotation(Slot slot, Doctor doctor)
 {
     if (MaxWeekends == 0)
         return false;
     return GetSlotsByDoctorAndRotation(doctor, slot).Count() >= MaxWeekends;
 }
예제 #9
0
 private bool DoctorHasExceededMaxSameShiftsPerRotation(Slot slot, Doctor doctor)
 {
     if (MaxSameShifts == 0)
         return false;
     return GetSlotsByDoctorAndRotation(doctor, slot).Where(x => x.shift == slot.shift).Count() >= MaxSameShifts;
 }
예제 #10
0
 private bool DoctorHasExceededMaxLifetime(Slot slot, Doctor doctor)
 {
     if (MaxShiftsPerLifetime == 0)
         return false;
     return doctor.TotalShiftCount + (slot.is24 ? 2 : 1) > MaxShiftsPerLifetime;
 }
예제 #11
0
 private bool DoctorAlreadyWorkingThisWeekend(Slot slot, Doctor doctor)
 {
     return Schedule.Where(x => x.week == slot.week).Where(x => x.doctor == doctor).Any();
 }
예제 #12
0
 private bool CanWork(Slot slot, Doctor doctor)
 {
     if (DoctorAlreadyWorkingThisWeekend(slot, doctor))
     {
         return false;
     }
     if (DoctorHasExceededMaxDaysThisRotation(slot, doctor))
     {
         return false;
     }
     if (DoctorHasExceededMaxLifetime(slot, doctor))
     {
         return false;
     }
     if (DoctorHasExceededMaxSameShiftsPerRotation(slot, doctor))
     {
         return false;
     }
     if (DoctorWouldExceedMaxConsecutiveShifts(slot, doctor))
     {
         return false;
     }
     if (DoctorHasExceededMaxWeekendsPerRotation(slot, doctor))
     {
         return false;
     }
     if (DoctorHasExceededHisPersonalMaxShifts(slot, doctor))
     {
         return false;
     }
     return true;
 }