Esempio n. 1
0
 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;
     }
 }
Esempio n. 2
0
 public void DeleteInvoice(int InvoiceId)
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         patientDataLayer.DeleteInvoice(InvoiceId);
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 3
0
 public Patient GetPatientById(int id)
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         return(patientDataLayer.GetPatienById(id));
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 4
0
 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;
     }
 }
Esempio n. 5
0
 public List <Appointment> GetAppointments()
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         return(patientDataLayer.GetAppointments());
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 6
0
 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;
     }
 }
Esempio n. 7
0
 public int GetTotalBill(int AppointmentId)
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         return(patientDataLayer.GetTotalBill(AppointmentId));
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 8
0
 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;
     }
 }
Esempio n. 9
0
 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;
     }
 }
Esempio n. 10
0
 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;
     }
 }
Esempio n. 11
0
 public void SaveData(List <MedicinesQuantity> medicine)
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         patientDataLayer.SaveData(medicine);
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 12
0
 public Invoice GetInvoiceByInvoiceId(int InvoiceId)
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         return(patientDataLayer.GetInvoiceByInvoiceId(InvoiceId));
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 13
0
 public int GetNumberOfInvoices()
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         return(patientDataLayer.GetNumberOfInvoices());
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 14
0
 public Appointment UpdateAppointment(Appointment appointment)
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         return(patientDataLayer.UpdateAppointment(appointment));
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 15
0
 public void Dispose()
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         patientDataLayer.Dispose();
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 16
0
 public void RemovePatient(Patient patient)
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         patientDataLayer.RemovePatient(patient);
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 17
0
 public void UpdatePatientDetials(Patient patient)
 {
     try
     {
         patientDataLayer = new PatientDataLayer();
         patientDataLayer.UpdatePatientDetails(patient);
     }
     catch (Exception e)
     {
         ExceptionHandler.PrintException(e, new StackTrace(true));
         throw e;
     }
 }
Esempio n. 18
0
 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;
            }
        }
Esempio n. 20
0
        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;
            }
        }
Esempio n. 21
0
 public PatientBusinessLayer()
 {
     patientDataLayer = new PatientDataLayer();
 }