Exemplo n.º 1
0
        public static DataRow CalcWalkInTimeslot()
        {
            DataTable workingDoctors = StaffDBConverter.GetWorkingDoctors(DateTime.Today.Date, "None", "None");

            // Doctor shift start & end times stored to be used to calculate appointment possibilities
            List <int> staffID     = new List <int>();
            List <int> shiftStarts = new List <int>();
            List <int> shiftEnds   = new List <int>();

            foreach (DataRow row in workingDoctors.Rows)
            {
                staffID.Add(int.Parse(row["Id"].ToString()));
                shiftStarts.Add(int.Parse(row["Shift_Start"].ToString()));
                shiftEnds.Add(int.Parse(row["Shift_End"].ToString()));
            }

            DataTable dt = CalcTimeslots(staffID, shiftStarts, shiftEnds, PatientDBConverter.GetBookedTimeslots(DateTime.Today.Date, staffID), false);

            foreach (DataRow dataRow in dt.Rows)
            {
                string   rowValue     = dataRow["Avaliable_Reservations"].ToString();
                DateTime selectedTime = DateTime.Parse(rowValue);

                //  Returns earliest timeslot after the current time
                if (DateTime.Now.TimeOfDay < selectedTime.TimeOfDay)
                {
                    return(dataRow);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        public static DataTable GetAvaliableTimeslots(DateTime date, string doctor = "None", string gender = "None")
        {
            date = date.Date;
            DataTable workingDoctors = GetWorkingDoctors(date, doctor, gender);

            // Doctor shift start & end times stored to be used to calculate
            List <int> staffID     = new List <int>();
            List <int> shiftStarts = new List <int>();
            List <int> shiftEnds   = new List <int>();

            foreach (DataRow row in workingDoctors.Rows)
            {
                staffID.Add(int.Parse(row["Id"].ToString()));

                shiftStarts.Add(int.Parse(row["Shift_Start"].ToString()));
                shiftEnds.Add(int.Parse(row["Shift_End"].ToString()));
            }

            DataTable dt = AppointmentLogic.CalcTimeslots(staffID, shiftStarts, shiftEnds, PatientDBConverter.GetBookedTimeslots(date, staffID), true);

            return(dt);
        }