Пример #1
0
 public DoctorsController()
 {
     userBusinessLayer    = new UserBusinessLayer();
     appointmentViewModel = new AppointmentViewModel();
     doctorBusinessLayer  = new DoctorBusinessLayer();
     patientBusinessLayer = new PatientBusinessLayer();
 }
        public void TestDelete()
        {
            PatientBusinessLayer businessLayer = new PatientBusinessLayer();
            Patient testPatient = businessLayer.GetPatientByEmail("*****@*****.**");

            businessLayer.RemovePatient(testPatient);
            Assert.IsTrue(businessLayer.GetPatientByEmail("*****@*****.**") == null);
        }
Пример #3
0
 public AppointmentController()
 {
     appointment = new Appointment();
     appointmentListViewModel = new AppointmentListViewModel();
     appointmentBusinessLayer = new AppointmentBusinessLayer();
     patientBusinessLayer     = new PatientBusinessLayer();
     doctorBusinessLayer      = new DoctorBusinessLayer();
 }
        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);
        }
Пример #5
0
        public ActionResult Create([Bind(Include = "Id,Name,Gender,BloodGroup,Contact,Password")] CreatePatientViewModel createPatientViewModel)
        {
            if (ModelState.IsValid)
            {
                PatientBusinessLayer createPatient = new PatientBusinessLayer();
                createPatient.CreatePatient(createPatientViewModel);
                return(RedirectToAction("Index"));
            }

            return(View(createPatientViewModel));
        }
        public ActionResult Create(Patient patient)
        {
            if (!ModelState.IsValid)
            {
                return(View(patient));
            }
            PatientBusinessLayer patientUser = new PatientBusinessLayer();

            if (!UserDataLayer.CheckEmail(patient.PatientUser.Email))
            {
                ModelState.AddModelError("PatientUser.Email", "Email already exists");
                Logging.loggError($"{patient.PatientUser.Email} is already exist as email");
                return(View(patient));
            }
            patient.PatientUser.Role = Models.Enum.Role.Patient;
            patientUser.AddPatient(patient);

            Logging.loggInfo($"Patient addedd with id = {patient.PatientUser.Id}");
            return(Redirect("/Login/Index"));
        }
        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));
        }
Пример #8
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;
            }
        }