///------------------------------------------------------------------------------------------------- /// \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); }
///------------------------------------------------------------------------------------------------- /// \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; } } }