Esempio n. 1
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public TabScheduling()
        ///
        /// \brief  Prepares all event handlers and appearances for the scheduling screen
        ///
        /// \author Bailey
        /// \date   2019-04-10
        ///-------------------------------------------------------------------------------------------------
        public TabScheduling()
        {
            InitializeComponent();
            tabScheduling = this;

            MouseWheel += MouseWheelHandler;

            selectedDate = DateTime.Today;
            currentMonth = DateTime.Today;
            LoadCalendar(currentMonth);

            // - Set up Patients Holders -
            // Main Patients / HoH
            patient1 = new SelectedPatientDetails(SelectedPatientDetails.PATIENT_PRIMARY);
            Grid.SetColumn(patient1, 0);
            grdPatientSelection.Children.Add(patient1);
            // Secondary Patients (child)
            patient2 = new SelectedPatientDetails(SelectedPatientDetails.PATIENT_SECONDARY);
            Grid.SetColumn(patient2, 1);
            grdPatientSelection.Children.Add(patient2);

            // Set theme settings
            this.Background             = backgroundColour;
            scrollRightPanel.Background = backgroundColour;

            // Refresh Timer
            System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
            dispatcherTimer.Tick    += RefreshTimer_Tick;
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
        }
Esempio n. 2
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn private void Change_Click(object sender, RoutedEventArgs e)
        ///
        /// \brief  Updates the UI to prepare for a date change request for the object's appointment
        ///
        /// \author Bailey
        /// \date   2019-04-18
        ///
        /// \param  object sender
        /// \param  RoutedEventArgs e
        ///-------------------------------------------------------------------------------------------------
        private void Change_Click(object sender, RoutedEventArgs e)
        {
            TabScheduling tab = TabScheduling.tabScheduling;

            tab.SetInformation("Choose a new date for the appointment");
            tab.AwaitDateSelection(this, TabScheduling.MODE_CHANGE);
        }
Esempio n. 3
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn private void Recall_Book_Click(object sender, RoutedEventArgs e)
        ///
        /// \brief  Handles the click event for the book request for a recall appointment
        ///
        /// \author Bailey
        /// \date   2019-04-18
        ///
        /// \param  object sender
        /// \param  RoutedEventArgs e
        ///-------------------------------------------------------------------------------------------------
        private void Recall_Book_Click(object sender, RoutedEventArgs e)
        {
            TabScheduling tab = TabScheduling.tabScheduling;

            // Cancel booking if already booking
            if (TabScheduling.currentMode == TabScheduling.MODE_RECALL)
            {
                // Remove the highlight around the target date
                TabScheduling.currentMode          = TabScheduling.MODE_NORMAL;
                TabScheduling.awaitingSelectedDate = null;
                tab.highlightOnLoad = false;

                // Clear instructions
                tab.ClearInformation();

                // Refresh Calendar
                tab.LoadCalendar(tab.currentMonth);
            }
            // Determine date to book
            else
            {
                DateTime recallDate = tab.selectedDate;
                recallDate = recallDate.AddDays(7 * appointment.RecallFlag);

                tab.highlightDay    = recallDate;
                tab.highlightOnLoad = true;
                tab.LoadCalendar(recallDate);

                tab.AwaitDateSelection(this, TabScheduling.MODE_RECALL);
            }
        }
Esempio n. 4
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public void RequestBookFromFlag(DateTime requestedDate)
        ///
        /// \brief  Handles the event when the CalendarDay is clicked during a recall choice stage.
        ///
        /// \author Bailey
        /// \date   2019-04-18
        ///
        /// \param  DateTime requestedDate
        ///-------------------------------------------------------------------------------------------------
        public void RequestBookFromFlag(DateTime requestedDate)
        {
            TabScheduling tab = TabScheduling.tabScheduling;

            tab.highlightOnLoad = false;

            if (SchedulingSupport.GetAppointmentsForDay(requestedDate).Count < SchedulingSupport.MaxAppointmentsForDay(requestedDate))
            {
                SchedulingSupport.BookAppointment(patients[0], patients[1], requestedDate);
                appointment.RecallFlag = 0;
                appointment.Update();
            }

            // Clear instructions
            tab.ClearInformation();

            // Refresh Calendar
            tab.LoadCalendar(tab.selectedDate);
        }
Esempio n. 5
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public void UpdateSelectedPatient(Demographics.Patient selectedPatient)
        ///
        /// \brief  Called with the patient chosen from the search so that the patient holders can be loaded
        ///
        /// \author Bailey
        /// \date   2019-04-18
        ///
        /// \param Patient selectedPatient
        ///-------------------------------------------------------------------------------------------------
        public void UpdateSelectedPatient(Demographics.Patient selectedPatient)
        {
            TabScheduling tab = TabScheduling.tabScheduling;

            patient = selectedPatient;

            if (searchScreen != null)
            {
                TabScheduling.tabScheduling.searchPatientParent.Children.Remove(searchScreen);
            }

            // Clearing old details
            // Updating primary should remove secondary
            if (patientType == PATIENT_PRIMARY)
            {
                // Try to load HoH details
                if (patient != null && patient is Demographics.Patient_Dependant)
                {
                    // Update details if they are found
                    var family = Database.HoH_Report(patient.HCN);
                    if (family != null && family.Count > 0)
                    {
                        Demographics.Patient hoh = family[0];
                        tab.patient2.UpdateSelectedPatient(hoh);
                    }
                }
                else
                {
                    tab.patient2.ResetDetails();
                }
            }

            // Update Details
            UpdateDetails(patient);
            if (selectedPatient == null)
            {
                ResetDetails();
            }
        }
Esempio n. 6
0
        private void SelectDay()
        {
            TabScheduling tab = TabScheduling.tabScheduling;

            // Changing the selected date (as normal)
            if (TabScheduling.currentMode == TabScheduling.MODE_NORMAL)
            {
                tab.selectedDate = date;

                // Remove the old selection
                if (tab.selectedTile != null)
                {
                    tab.selectedTile.Deselect(tab.selectedDate);
                }

                // Make it look like it's been selected
                Select();

                // Update the appointment list
                TabScheduling.tabScheduling.UpdateAppointmentList(date);
            }
            // Request a date change
            else if (TabScheduling.currentMode == TabScheduling.MODE_CHANGE)
            {
                TabScheduling.awaitingSelectedDate.RequestDateChange(date);
            }
            // Request a recall booking
            else if (TabScheduling.currentMode == TabScheduling.MODE_RECALL)
            {
                TabScheduling.awaitingSelectedDate.RequestBookFromFlag(date);
            }

            TabScheduling.awaitingSelectedDate = null;
            TabScheduling.tabScheduling.ClearInformation();
            TabScheduling.currentMode = TabScheduling.MODE_NORMAL;

            DeselectOutline();
        }
Esempio n. 7
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn private void GrdAppointmentDetails_Click(object sender, MouseButtonEventArgs e)
        ///
        /// \brief  Handles all possible cases for when the object is clicked
        ///
        /// \author Bailey
        /// \date   2019-04-18
        ///
        /// \param  object sender
        /// \param  MouseButtonEventArgs e
        ///-------------------------------------------------------------------------------------------------
        private void GrdAppointmentDetails_Click(object sender, MouseButtonEventArgs e)
        {
            if (clickable)
            {
                // Booking an appointment
                if (bookable)
                {
                    TabScheduling        tab     = TabScheduling.tabScheduling;
                    Demographics.Patient patient = tab.patient1.patient;
                    Demographics.Patient hoh     = tab.patient2.patient;

                    // Book appointment
                    if (patient != null)
                    {
                        // Only allow booking on and after today
                        if (tab.selectedDate >= DateTime.Today)
                        {
                            SchedulingSupport.BookAppointment(patient, hoh, tab.selectedDate);

                            // Clear instructions
                            tab.ClearInformation();

                            // Refresh Calendar
                            tab.LoadCalendar(tab.currentMonth);
                        }
                        else
                        {
                            TabScheduling.tabScheduling.SetInformation("You cannot book an appointment for a date that has already past");
                        }
                    }
                    // No patient(s) given
                    else
                    {
                        tab.SetInformation("You must first select the patient that the appointment is for.");
                    }
                }
                // Inspecting actions for a tile
                else
                {
                    // Enable all items
                    itemRecallBook.IsEnabled  = false;
                    itemRecallClear.IsEnabled = true;
                    itemRecall1.IsEnabled     = true;
                    itemRecall2.IsEnabled     = true;
                    itemRecall3.IsEnabled     = true;

                    // Update Context Menu
                    int recallFlag = appointment.RecallFlag;
                    if (recallFlag == 0)
                    {
                        itemRecallClear.IsEnabled = false;
                    }
                    else if (recallFlag > 0)
                    {
                        itemRecallBook.IsEnabled = true;

                        if (TabScheduling.currentMode == TabScheduling.MODE_RECALL)
                        {
                            itemRecall1.IsEnabled     = false;
                            itemRecall2.IsEnabled     = false;
                            itemRecall3.IsEnabled     = false;
                            itemRecallClear.IsEnabled = false;
                            itemRecallBook.Header     = "Cancel";
                        }
                        else
                        {
                            itemRecallBook.Header = "Book";
                            if (recallFlag == 1)
                            {
                                itemRecall1.IsEnabled = false;
                            }
                            else if (recallFlag == 2)
                            {
                                itemRecall2.IsEnabled = false;
                            }
                            else if (recallFlag == 3)
                            {
                                itemRecall3.IsEnabled = false;
                            }
                        }
                    }

                    // Display Context Menu
                    cm.PlacementTarget = sender as Button;
                    cm.IsOpen          = true;
                }
            }
        }