Example #1
0
        public PatientView(Demographics d, DialogHost dh, Scheduling s)
        {
            Logging.Log("Initiated PatientView page");
            demographics = d;
            dialogHost   = dh;
            scheduling   = s;
            InitializeComponent();
            tbNumPatients.Text     = demographics.dPatientRoster.Count.ToString();
            lvPatients.ItemsSource = patientRoster;
            foreach (Patient p in demographics.dPatientRoster.Values)
            {
                patientRoster.Add(p);
            }

            foreach (Appointment a in scheduling.GetFlaggedAppointments())
            {
                cbFlaggedForRecall.Items.Add(a);
            }
        }
        /**
         * \brief <b>Brief Description</b> - Execute <b><i>class method</i></b> - An overload of the entry point into the scheduling of a recall menu
         * \details <b>Details</b>
         *
         * This takes in the existing patient information, if it should return a patient and the demographics library
         *
         * \return <b>void</b>
         */
        public void Execute(Scheduling scheduling, Demographics demographics, Billing billing)
        {
            // get a list of all appointments that are flagged for recall
            List <Appointment>            appointments = scheduling.GetFlaggedAppointments();
            List <Pair <string, string> > content      = new List <Pair <string, string> >();

            // if there are any appointments flagged
            if (appointments.Count > 0)
            {
                // give menu to browse through those records and select an appointment
                Appointment selectedAppt = BrowseRecords(appointments, MenuCodes.SCHEDULING, "Scheduling", 1);

                // check if the user didnt cancel during record browse
                if (selectedAppt != null)
                {
                    // get the date of when the recall is allowed to start being scheduled
                    DateTime date = scheduling.GetDateByAppointmentID(selectedAppt.AppointmentID).AddDays(selectedAppt.RecallFlag * 7);

                    // display the content
                    Container.DisplayContent(content, 1, 1, MenuCodes.SCHEDULING, "Scheduling", Description);

                    // get a new selected appointment for the recall
                    Pair <Day, int> selectedRecallDate = SelectAppointmentSlot.Get(scheduling, demographics, date, 1, MenuCodes.SCHEDULING, Description);
                    Day             selectedDay        = selectedRecallDate.First;
                    int             slot = selectedRecallDate.Second;

                    // check if the user didnt cancel during recall appointment scheduling
                    if (selectedDay != null)
                    {
                        // get the appointment slot based on the selected day
                        Appointment SelectedAppointment = selectedDay.GetAppointments()[slot];
                        DateTime    selectedDate        = scheduling.GetDateFromDay(selectedDay);

                        // check if appointment is not already taken
                        if (SelectedAppointment.AppointmentID == -1)
                        {
                            // get the patient from the selected appointment
                            Patient searchResult = demographics.GetPatientByID(selectedAppt.PatientID);

                            // check if patient was found
                            if (searchResult != null)
                            {
                                // schedule appointment and check if successful
                                if (scheduling.ScheduleAppointment(new Appointment(searchResult.PatientID, -1, 0), selectedDate, slot))
                                {
                                    // update the appointment information
                                    scheduling.UpdateAppointmentInfo(selectedAppt.AppointmentID, 0);

                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("Appointment scheduled successfully!", "") }
                                    },
                                                             1, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }
                                else
                                {
                                    Container.DisplayContent(new List <Pair <string, string> >()
                                    {
                                        { new Pair <string, string>("An error was encountered while scheduling appointment.", "") }
                                    },
                                                             1, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
                                }
                            }
                        }
                        // the appointment is already taken
                        else
                        {
                            Container.DisplayContent(new List <Pair <string, string> >()
                            {
                                { new Pair <string, string>("Appointment slot is already taken.", "") }
                            },
                                                     1, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
                        }
                    }
                }
            }
            else
            {
                Container.DisplayContent(new List <Pair <string, string> >()
                {
                    { new Pair <string, string>("No appointments flagged for recall.", "") }
                },
                                         1, 0, MenuCodes.SCHEDULING, "Scheduling", Description);
            }
            Console.ReadKey();
        }
Example #3
0
 public void Functional_GetFlaggedAppointments()
 {
     try { s.GetFlaggedAppointments(); }
     catch (Exception e) { Assert.Fail(e.Message); }
 }