public Dictionary <string, string> FixAppointment(AppointmentViewModel appointmentViewModel)
        {
            try
            {
                appointment         = new Appointment();
                nurseBusinessLayer  = new NurseBusinessLayer();
                doctorBusinessLayer = new DoctorBusinessLayer();
                patientDataLayer    = new PatientDataLayer();

                appointmentViewModel.TimeSlot = TimeSlots.Timings.IndexOf(doctorBusinessLayer.GetDoctorAvailableTimeSlots(appointmentViewModel.DoctorId.ToString(), appointmentViewModel.AppointmentDate.ToString())[int.Parse(appointmentViewModel.TimeSlot)]).ToString();
                int isAlreadyBooked = patientDataLayer.GetTotalAppointments(Convert.ToDateTime(appointmentViewModel.AppointmentDate), int.Parse(appointmentViewModel.TimeSlot), appointmentViewModel.DoctorId);
                if (isAlreadyBooked > 0)
                {
                    return(new Dictionary <string, string>()
                    {
                        { "", "Time slot already booked." }
                    });
                }

                int NurseId = nurseBusinessLayer.GetAvailableNurse(Convert.ToDateTime(appointmentViewModel.AppointmentDate), TimeSlots.Timings.IndexOf(appointmentViewModel.TimeSlot));
                if (NurseId == -1)
                {
                    return(new Dictionary <string, string>()
                    {
                        { "", "Appointment not booked, Please contact the clinic." }
                    });
                }

                appointment.NurseId   = NurseId;
                appointment.DoctorId  = appointmentViewModel.DoctorId;
                appointment.PatientId = appointmentViewModel.PatientId;
                appointment.Date      = Convert.ToDateTime(appointmentViewModel.AppointmentDate);
                appointment.Time      = int.Parse(appointmentViewModel.TimeSlot);
                appointment.Status    = AppointmentStatus.Pending;
                appointment           = patientDataLayer.FixAppointment(appointment);
                return(null);
            }catch (Exception e)
            {
                ExceptionHandler.PrintException(e, new StackTrace(true));
                throw;
            }
        }
 public AppointmentBusinessLayer()
 {
     patientBusinessLayer = new PatientBusinessLayer();
     doctorBusinessLayer  = new DoctorBusinessLayer();
 }