Beispiel #1
0
 public List <AppointmentListViewModel> AppointmentList(int doctorId)
 {
     try {
         patientBusinessLayer     = new PatientBusinessLayer();
         appointmentListViewModel = new AppointmentListViewModel();
         List <Appointment> appointmentList = GetDoctorAppointments(doctorId);
         appointmentListViewModelList = new List <AppointmentListViewModel>();
         foreach (var appointment in appointmentList)
         {
             appointmentListViewModel             = new AppointmentListViewModel();
             appointmentListViewModel.Id          = appointment.Id;
             appointmentListViewModel.PatientId   = appointment.PatientId;
             appointmentListViewModel.PatientName = patientBusinessLayer.GetPatientNameById(appointment.PatientId);
             appointmentListViewModel.DoctorName  = GetDoctorNameById(appointment.DoctorId);
             appointmentListViewModel.Date        = appointment.Date.ToString().Split(' ')[0];
             if (appointment.Time == -1)
             {
                 appointmentListViewModel.Time = "---";
             }
             else
             {
                 appointmentListViewModel.Time = TimeSlots.Timings[appointment.Time];
             }
             appointmentListViewModel.Status = appointment.Status;
             appointmentListViewModelList.Add(appointmentListViewModel);
         }
         return(appointmentListViewModelList);
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
 public Boolean ChangeAppointmentStatus(int appointmentId)
 {
     try
     {
         appointmentBusinessLayer = new AppointmentBusinessLayer();
         appointment          = appointmentBusinessLayer.GetAppointmentById(appointmentId);
         patientBusinessLayer = new PatientBusinessLayer();
         appointment.Status   = AppointmentStatus.Closed;
         appointment          = patientBusinessLayer.UpdateAppointment(appointment);
         return(true);
     }catch (Exception e)
     {
         Database.ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
 public int EditAppointment(AppointmentListViewModel appointmentListViewModel, int Role)
 {
     try
     {
         appointmentBusinessLayer = new AppointmentBusinessLayer();
         patientBusinessLayer     = new PatientBusinessLayer();
         appointment = appointmentBusinessLayer.GetAppointmentById(appointmentListViewModel.Id);
         if (Role == 1)
         {
             appointment.Status = appointmentListViewModel.Status;
             appointment        = patientBusinessLayer.UpdateAppointment(appointment);
         }
         else if (Role == 3)
         {
             appointment.Status = (appointmentListViewModel.isCancelled) ? AppointmentStatus.Cancelled : AppointmentStatus.Pending;
             appointment        = patientBusinessLayer.UpdateAppointment(appointment);
         }
         return(appointment.DoctorId);
     }catch (Exception e)
     {
         Database.ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
 public AppointmentBusinessLayer()
 {
     patientBusinessLayer = new PatientBusinessLayer();
     doctorBusinessLayer  = new DoctorBusinessLayer();
 }