public void TestEditDetails() { PatientBusinessLayer businessLayer = new PatientBusinessLayer(); Patient patient = businessLayer.GetPatientByEmail("*****@*****.**"); patient.PatientUser.Name = "TestEdit"; patient.EmergengyContactName = "TestMother"; businessLayer.UpdatePatientDetials(patient); Assert.AreEqual("TestEdit", businessLayer.GetPatientNameById(patient.Id)); Assert.AreEqual("TestMother", businessLayer.GetPatientById(patient.Id).EmergengyContactName); }
public ActionResult Edit(int id) { appointment = appointmentBusinessLayer.GetAppointmentById(id); appointmentListViewModel.Id = appointment.Id; appointmentListViewModel.PatientName = patientBusinessLayer.GetPatientNameById(appointment.PatientId); appointmentListViewModel.DoctorName = doctorBusinessLayer.GetDoctorNameById(appointment.DoctorId); appointmentListViewModel.Date = appointment.Date.ToString().Split(' ')[0]; appointmentListViewModel.Time = TimeSlots.Timings[appointment.Time]; appointmentListViewModel.Status = appointment.Status; return(View(appointmentListViewModel)); }
public void TestAddPatient() { Patient patient = new Patient(); patient.PatientUser = new User(); patient.PatientUser.Name = "Test"; patient.PatientUser.Password = patient.PatientUser.ConfirmPassword = "******"; patient.PatientUser.Email = "*****@*****.**"; patient.PatientUser.BloodGroup = Models.Enum.BloodGroup.B; patient.PatientUser.Gender = Models.Enum.Gender.Male; patient.PatientUser.Contact = "7232392398"; patient.Height = 6; patient.Weight = 73; patient.Address = "#123 Panchkula"; patient.EmergencyContactNumber = "8124393000"; patient.EmergengyContactName = "TestFather"; PatientBusinessLayer businessLayer = new PatientBusinessLayer(); businessLayer.AddPatient(patient); Assert.AreEqual("Test", businessLayer.GetPatientNameById(patient.Id)); }
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; } }