示例#1
0
        public void TestDoctorAppointments()
        {
            DoctorBusinessLayer businessLayer = new DoctorBusinessLayer();
            Doctor doctor = businessLayer.GetDoctorByEmail("*****@*****.**");

            Assert.IsFalse(businessLayer.GetDoctorAppointments(doctor.Id).Count != 0);
        }
示例#2
0
 public DoctorsController()
 {
     userBusinessLayer    = new UserBusinessLayer();
     appointmentViewModel = new AppointmentViewModel();
     doctorBusinessLayer  = new DoctorBusinessLayer();
     patientBusinessLayer = new PatientBusinessLayer();
 }
示例#3
0
        public void TestGetDoctorDetials()
        {
            DoctorBusinessLayer businessLayer = new DoctorBusinessLayer();
            Doctor doctor = businessLayer.GetDoctorByEmail("*****@*****.**");

            Assert.AreEqual(600, businessLayer.GetDoctorDetials(doctor.Id).Doctor.Fees);
        }
示例#4
0
        public void TestAvailableTimeSlots()
        {
            DoctorBusinessLayer businessLayer = new DoctorBusinessLayer();
            Doctor doctor = businessLayer.GetDoctorByEmail("*****@*****.**");

            Assert.AreEqual(1, businessLayer.GetDoctorAvailableTimeSlots(doctor.Id.ToString(), DateTime.Today.ToString()).Count);
        }
示例#5
0
        public void TestDelete()
        {
            DoctorBusinessLayer businessLayer = new DoctorBusinessLayer();
            Doctor testDoctor = businessLayer.GetDoctorByEmail("*****@*****.**");

            businessLayer.DeleteDoctor(testDoctor.Id);
            Assert.IsTrue(businessLayer.GetDoctorById(testDoctor.Id) == null);
        }
示例#6
0
 public AppointmentController()
 {
     appointment = new Appointment();
     appointmentListViewModel = new AppointmentListViewModel();
     appointmentBusinessLayer = new AppointmentBusinessLayer();
     patientBusinessLayer     = new PatientBusinessLayer();
     doctorBusinessLayer      = new DoctorBusinessLayer();
 }
示例#7
0
        public void TestEditDetails()
        {
            DoctorBusinessLayer businessLayer = new DoctorBusinessLayer();
            Doctor doctor = businessLayer.GetDoctorByEmail("*****@*****.**");

            doctor.DoctorUser.Name = "TestEdit";
            businessLayer.EditDoctorDetails(doctor);
            Assert.AreEqual("TestEdit", businessLayer.GetDoctorNameById(doctor.Id));
        }
示例#8
0
        public void TestDoctorAppointmentList()
        {
            DoctorBusinessLayer businessLayer = new DoctorBusinessLayer();
            Doctor doctor = businessLayer.GetDoctorByEmail("*****@*****.**");

            Assert.IsTrue(businessLayer.GetDoctorsAllAppointments(doctor.Id).Count == 0);
            Assert.IsTrue(businessLayer.AppointmentList(doctor.Id).Count == 0);
            Assert.IsTrue(businessLayer.GetDoctorsUpcomingAppointments(doctor.Id).Count == 0);
        }
示例#9
0
 public ActionResult GetDoctorAppointments(int docId, int appointments)
 {
     doctorBusinessLayer = new DoctorBusinessLayer();
     if (appointments == 0)
     {
         List <DoctorAppointment> doctorAppointments = doctorBusinessLayer.GetDoctorsUpcomingAppointments(docId);
         return(Json(doctorAppointments, JsonRequestBehavior.AllowGet));
     }
     else
     {
         List <DoctorAppointment> doctorAppointments = doctorBusinessLayer.GetDoctorsAllAppointments(docId);
         return(Json(doctorAppointments, JsonRequestBehavior.AllowGet));
     }
 }
示例#10
0
        public ActionResult Create(DoctorDetailsViewModel doctorDetailsViewModel)
        {
            doctorBusinessLayer = new DoctorBusinessLayer();
            userBusinessLayer   = new UserBusinessLayer();
            var user = userBusinessLayer.GetUserByEmail(doctorDetailsViewModel.Doctor.DoctorUser.Email);

            if (user != null)
            {
                ModelState.AddModelError("DoctorUser.Email", "Email already exists");
                return(View(doctorDetailsViewModel));
            }
            Doctor doctor = new Doctor();

            doctor.ShiftTime = new List <DoctorTime>();
            doctor           = doctorDetailsViewModel.Doctor;
            doctorBusinessLayer.AddDoctor(doctor, doctorDetailsViewModel.Timings);

            Logging.loggInfo($"Doctor addedd with Userid = {doctor.DoctorUser.Id} and Name = {doctor.DoctorUser.Name} ");
            return(RedirectToAction("Index"));
        }
示例#11
0
        public void TestAddDoctor()
        {
            Doctor doctor = new Doctor();

            doctor.DoctorUser            = new User();
            doctor.DoctorUser.Name       = "Test";
            doctor.DoctorUser.Password   = doctor.DoctorUser.ConfirmPassword = "******";
            doctor.DoctorUser.Email      = "*****@*****.**";
            doctor.DoctorUser.BloodGroup = Models.Enum.BloodGroup.AB;
            doctor.DoctorUser.Gender     = Models.Enum.Gender.Female;
            doctor.Speciality            = Models.Enum.Speciality.ENT;
            doctor.Fees = 600;
            doctor.DoctorUser.Contact = "7232392398";
            List <SelectListItem> timings = new List <SelectListItem>()
            {
                new SelectListItem {
                    Value = "1", Selected = true
                }
            };
            DoctorBusinessLayer businessLayer = new DoctorBusinessLayer();

            businessLayer.AddDoctor(doctor, timings);
            Assert.AreEqual("Test", businessLayer.GetDoctorNameById(doctor.Id));
        }
示例#12
0
        public void TestGetDoctorBySpeciality()
        {
            DoctorBusinessLayer businessLayer = new DoctorBusinessLayer();

            Assert.IsNotNull(businessLayer.GetDoctorsBySpeciality("ENT"));
        }
示例#13
0
        public void TestGetAllDoctors()
        {
            DoctorBusinessLayer businessLayer = new DoctorBusinessLayer();

            Assert.IsTrue(businessLayer.GetAllDoctors().Count > 0);
        }
示例#14
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;
            }
        }