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 void DeleteInvoice(int InvoiceId) { try { patientDataLayer = new PatientDataLayer(); patientDataLayer.DeleteInvoice(InvoiceId); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public Patient GetPatientById(int id) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetPatienById(id)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public List <MedicinesQuantity> GetPatientMedicines(int AppointmentId) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetPatientMedicines(AppointmentId)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public List <Appointment> GetAppointments() { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetAppointments()); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public int GetMedicineCost(int Medicine_Id) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetMedicineCost(Medicine_Id)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public int GetTotalBill(int AppointmentId) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetTotalBill(AppointmentId)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public MedicinesQuantity CheckIdInList(int Appointment_Id) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.CheckIdInList(Appointment_Id)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public List <Patient> GetAllPatients(string role, int id) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetAllPatients(role, id)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public string GetAppointmentDate(int Appointment_Id) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetAppointmentDate(Appointment_Id)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public void SaveData(List <MedicinesQuantity> medicine) { try { patientDataLayer = new PatientDataLayer(); patientDataLayer.SaveData(medicine); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public Invoice GetInvoiceByInvoiceId(int InvoiceId) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetInvoiceByInvoiceId(InvoiceId)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public int GetNumberOfInvoices() { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.GetNumberOfInvoices()); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public Appointment UpdateAppointment(Appointment appointment) { try { patientDataLayer = new PatientDataLayer(); return(patientDataLayer.UpdateAppointment(appointment)); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public void Dispose() { try { patientDataLayer = new PatientDataLayer(); patientDataLayer.Dispose(); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public void RemovePatient(Patient patient) { try { patientDataLayer = new PatientDataLayer(); patientDataLayer.RemovePatient(patient); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public void UpdatePatientDetials(Patient patient) { try { patientDataLayer = new PatientDataLayer(); patientDataLayer.UpdatePatientDetails(patient); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public void AddPatient(Patient patient) { try { patientDataLayer = new PatientDataLayer(); patient.PatientUser.Password = patient.PatientUser.ConfirmPassword = Encryption.Encrypt(patient.PatientUser.Password); patientDataLayer.AddPatient(patient); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
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 List <MedicalHistoryViewModel> GetMedicalHistory(int?id) { try { medicalHistoryViewModelList = new List <MedicalHistoryViewModel>(); patientBusinessLayer = new PatientBusinessLayer(); doctorBusinessLayer = new DoctorBusinessLayer(); List <MedicalHistory> medicalHistories; if (id == null) { medicalHistories = historyDataLayer.GetAllMedicalHistory(); } else { patientDataLayer = new PatientDataLayer(); medicalHistories = patientDataLayer.GetPatientMedicalHistory((int)id); } foreach (var medicalHistory in medicalHistories) { appointmentList = new List <Appointment>(); appointmentDataLayer = new AppointmentDataLayer(); appointmentList = appointmentDataLayer.GetAppointmentsById(medicalHistory.PatientId, medicalHistory.AppointmentId); if (medicalHistory.AppointmentId != 0) { foreach (var appointment in appointmentList) { medicalHistoryViewModel = new MedicalHistoryViewModel { AppointmentId = medicalHistory.AppointmentId, PatientName = patientBusinessLayer.GetPatientNameById(appointment.PatientId), DoctorName = doctorBusinessLayer.GetDoctorNameById(appointment.DoctorId), Date = appointment.Date.ToShortDateString(), Dignosis = medicalHistory.Dignosis, Medicine = medicalHistory.Medicine, ClinicRemark = medicalHistory.ClinicRemark }; medicalHistoryViewModelList.Add(medicalHistoryViewModel); } } else { medicalHistoryViewModel = new MedicalHistoryViewModel { AppointmentId = -1, PatientName = patientBusinessLayer.GetPatientNameById(medicalHistory.PatientId), DoctorName = "-", Dignosis = medicalHistory.Dignosis, Medicine = medicalHistory.Medicine, ClinicRemark = medicalHistory.ClinicRemark }; medicalHistoryViewModelList.Add(medicalHistoryViewModel); } } return(medicalHistoryViewModelList); } catch (Exception e) { ExceptionHandler.PrintException(e, new StackTrace(true)); throw e; } }
public PatientBusinessLayer() { patientDataLayer = new PatientDataLayer(); }