public List <DoctorAppointment> GetDoctorsAllAppointments(int docId) { try { doctorDataLayer = new DoctorDataLayer(); patientDataLayer = new PatientDataLayer(); List <Appointment> appointments = doctorDataLayer.GetDoctorAllAppointments(docId); List <DoctorAppointment> doctorAppointments = new List <DoctorAppointment>(); DoctorAppointment doctorAppointment; foreach (var appointment in appointments) { doctorAppointment = new DoctorAppointment(); doctorAppointment.Id = appointment.Id; doctorAppointment.PatientId = appointment.PatientId; doctorAppointment.PatientName = patientDataLayer.GetPatientNameById(appointment.PatientId); doctorAppointment.Date = appointment.Date.ToString().Split(' ')[0]; doctorAppointment.TimeSlot = TimeSlots.Timings[appointment.Time]; doctorAppointment.Status = appointment.Status; doctorAppointments.Add(doctorAppointment); } return(doctorAppointments); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public string GetPatientNameById(int id) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetPatientNameById(id)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }