Example #1
0
 private List <DoctorAppointment> GetAvailableForFreeTime(TimeSpan time, List <DoctorAppointment> availableAppointments, Shift doctorShift, int doctorId, DateTime date, int patientId)
 {
     while (time != TimeSpan.Parse(doctorShift.endTime) && availableAppointments.Count < 5)
     {
         if (time < DateTime.Now.TimeOfDay && UtilityMethods.CheckIfDateIsToday(date))
         {
             time = time.Add(TimeSpan.FromMinutes(15));
             continue;
         }
         availableAppointments = GetListAvailableAppointments(availableAppointments, doctorId, time, date, patientId);
         time = time.Add(TimeSpan.FromMinutes(15));
     }
     return(availableAppointments);
 }
Example #2
0
        private List <DoctorAppointment> CreateListOfAvailableAppointments(Shift doctorShift, string dateString, int doctorId, int patientId)
        {
            List <DoctorAppointment> availableAppointments = new List <DoctorAppointment>();
            TimeSpan time = TimeSpan.Parse(doctorShift.startTime);

            while (time != TimeSpan.Parse(doctorShift.endTime))
            {
                if (time < DateTime.Now.TimeOfDay && UtilityMethods.CheckIfDateIsToday(dateString))
                {
                    time = time.Add(TimeSpan.FromMinutes(15));
                    continue;
                }
                AddAppointments(time, availableAppointments, dateString, patientId, doctorId);
                time = time.Add(TimeSpan.FromMinutes(15));
            }
            return(availableAppointments);
        }