Beispiel #1
0
        public void GetAppointment_Success()
        {
            // Act
            var result   = controller.GetAppointment(appointmentId);
            var response = result as Response <AppointmentViewModel>;

            // Assert
            Assert.IsTrue(response != null, "Response can't be null");
            Assert.IsTrue(response.DataItems != null, "Data items can't be null");
            Assert.IsTrue(response.DataItems.Count > 0, "Atleast one appointment must exists.");
        }
        public void AddAppointment_ShouldAdd()
        {
            Patient     patient  = new Patient("Foo", "Patient to add");
            Doctor      doctor   = new Doctor("Foo", "Doctor to add", "Numb");
            Appointment expected = new Appointment(doctor, patient);

            _controller.AddAppointment(expected);

            Appointment actual = _controller.GetAppointment(expected.Id);

            Assert.Equal(expected, actual);
        }
        private void VisitInfo_Load(object sender, EventArgs e)
        {
            appt = AppointmentController.GetAppointment(this.apptID);
            txtAppointment.Text = appt.apptDateTime;
            this.loadComboTests();
            this.loadDiagnoses();

            //hide the update button on whether or not they're checking in
            if (flag == false)
            {
                btnUpdate.Visible = false;
            }
            else
            {
                btnUpdate.Visible = true;
            }

            //try
            //{
            //    currentVisit = VisitDAL.GetVisit(this.visitID);
            //    txtAppointment.Text = currentVisit.ApptID;
            //    txtSys.Text = currentVisit.SysBP;
            //    txtDia.Text = currentVisit.DiaBP;
            //    txtTemp.Text = currentVisit.BodyTemp;
            //    txtPulse.Text = currentVisit.Pulse;
            //    txtSymptoms.Text = currentVisit.Symptoms;
            //    txtDiagnosis.Text = VisitDAL.GetDiagnoses(currentVisit.DiagnosesCode);
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.ToString());
            //}
        }
        internal async Task RemoveAppointmentAsync(AppointmentModel appointmentModel)
        {
            Appointment appointment = null;

            using (_controller = new AppointmentController())
            {
                await Task.Run(() => appointment = _controller.GetAppointment(appointmentModel.AppointmentId));

                await Task.Run(() => _controller.RemoveAppointment(appointment));
            }

            await UpdateAppointmentsAsync();
        }
Beispiel #5
0
        private void btnVisits_Click(object sender, EventArgs e)
        {
            Appointment appt = AppointmentController.GetAppointment(Convert.ToInt32(cboAppointments.SelectedValue));

            try
            {
                DateTime apptDate = Convert.ToDateTime(cboAppointments.Text);
                if (cboAppointments.ValueMember == "")
                {
                    MessageBox.Show("No applicable appointment.", "No appointment selected");
                }
                else if (appt.isCheckedIn == "False" && apptDate.Date < DateTime.Now.Date)
                {
                    MessageBox.Show("The patient did not visit, they missed the appointment!");
                }
                else if (apptDate.Date != DateTime.Now.Date)
                {
                    MessageBox.Show("This date is not today, you may not check in!");
                    //String appointmentText = cboAppointments.Text;
                    //int apptID = int.Parse(cboAppointments.SelectedValue.ToString());
                    //ModifyVisitInfo visitInfo = new ModifyVisitInfo(this.info, apptID, appointmentText, this.patientID, false);
                    //visitInfo.MdiParent = this.MdiParent;
                    //visitInfo.FormClosing += new FormClosingEventHandler(this.Visits_FormClosing);
                    //visitInfo.Show();
                }
                else if (appt.isCheckedIn == "True" || appt.isCheckedIn == "1")
                {
                    MessageBox.Show("You have already checked in today!");
                    //String appointmentText = cboAppointments.Text;
                    //int apptID = int.Parse(cboAppointments.SelectedValue.ToString());
                    //ModifyVisitInfo visitInfo = new ModifyVisitInfo(this.info, apptID, this.patientID, false);
                    //visitInfo.MdiParent = this.MdiParent;
                    //visitInfo.FormClosing += new FormClosingEventHandler(this.Visits_FormClosing);
                    //visitInfo.Show();
                }
                else
                {
                    int       apptID    = int.Parse(cboAppointments.SelectedValue.ToString());
                    VisitInfo visitInfo = new VisitInfo(this.info, apptID, this.patientID, false, this);
                    visitInfo.FormClosing += new FormClosingEventHandler(this.Visits_FormClosing);
                    visitInfo.MdiParent    = this.MdiParent;
                    visitInfo.Show();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("An error occured while trying to check in, please try again!");
            }
        }
Beispiel #6
0
        private void Appointment_Load(object sender, EventArgs e)
        {
            try
            {
                this.currentApt = AppointmentController.GetAppointment(this.apptID);
                this.LoadComboBoxes();
                txtPatientName.Text    = PatientController.GetPatient(this.currentApt.PatientID).FName + " " + PatientController.GetPatient(this.currentApt.PatientID).LName;
                dateTimePicker.Value   = Convert.ToDateTime(this.currentApt.apptDateTime);
                dateTimePicker.MinDate = DateTime.Today;
                txtReason.Text         = this.currentApt.Reason;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            dateTimePicker.Format       = DateTimePickerFormat.Custom;
            dateTimePicker.CustomFormat = "MM/dd/yyyy hh:mm";
        }
Beispiel #7
0
        public void GetAppointmentForExistingAppointmentId(int searchedAppointmentId)
        {
            // Arrange
            var patientAuthorizationMock = new Mock <IPatientAuthorization>();
            var pdfGeneratorMock         = new Mock <IPdfGenerator>();
            var converterMock            = new Mock <IConverter>();

            var appointmentBusinessMock = new Mock <IAppointmentBusiness>();

            appointmentBusinessMock.Setup(x => x.GetAppointment(searchedAppointmentId)).Returns(new Appointment {
                AppointmentId = searchedAppointmentId
            });

            var appointmentController = new AppointmentController(appointmentBusinessMock.Object, patientAuthorizationMock.Object, pdfGeneratorMock.Object, converterMock.Object);

            // Act
            var appointmentResponse = appointmentController.GetAppointment(searchedAppointmentId);

            // Assert
            Assert.IsType <OkObjectResult>(appointmentResponse);
            Assert.IsType <Appointment>(((OkObjectResult)appointmentResponse).Value);
            Assert.Equal(((Appointment)((OkObjectResult)appointmentResponse).Value).AppointmentId, searchedAppointmentId);
        }