Пример #1
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public CalendarDay(DateTime day, int targetMonth, DateTime selectedDate)
        ///
        /// \brief  Constructs all necessary components of the calendar day to display all appointment
        ///			and calendar day information
        ///
        /// \author Bailey
        /// \date   2019-04-16
        ///
        /// \param DateTime day
        /// \param int targetMonth
        /// \param DateTime selectedDate
        ///-------------------------------------------------------------------------------------------------
        public CalendarDay(DateTime day, int targetMonth, DateTime selectedDate)
        {
            InitializeComponent();
            this.date        = day;
            this.targetMonth = targetMonth;

            // Set the day of the month (number)
            number.Content = day.Day.ToString();

            // Make the day appear less focused (darker) when it is the previous / next month
            if (day.Month != targetMonth)
            {
                filter.Opacity = FILTER_DARKEN;
            }

            // Darken on weekends
            if (SchedulingSupport.MaxAppointmentsForDay(day) == SchedulingSupport.MAX_APPOINTMENTS_WEEKEND)
            {
                weekendFilter.Opacity = FILTER_WEEKEND;
            }

            maxAppointments = SchedulingSupport.MaxAppointmentsForDay(day);

            AddAppointmentsFromList(SchedulingSupport.GetAppointmentsForDay(date));

            // Highlight if Today
            if (day == DateTime.Today)
            {
                todayFilter.Opacity = 0.15f;
                number.FontWeight   = FontWeights.Bold;
            }

            // Highlight the currently selected date
            if (day == selectedDate)
            {
                Select();
            }
            else
            {
                Deselect(selectedDate);
            }

            // Setup context menu for right click
            cm = new ContextMenu();
            MenuItem itemCheckedIn = new MenuItem();

            itemCheckedIn.Header = "View Checked-In";
            itemCheckedIn.Click += CheckedIn_Click;
            cm.Items.Add(itemCheckedIn);
        }
Пример #2
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public void UpdateAppointmentList(DateTime date)
        ///
        /// \brief  Updates the list of appointments on the right side of the calendar to be what they should
        ///			be for the given day
        ///
        /// \author Bailey
        /// \date   2019-04-10
        ///
        /// \param DateTime date
        ///-------------------------------------------------------------------------------------------------
        public void UpdateAppointmentList(DateTime date)
        {
            // Get all appointment detail lines from the appointment details parent
            IEnumerable <AppointmentDetailLine> detailLines = appointmentDetails.grdAppointments.Children.OfType <AppointmentDetailLine>();

            // Get appointments for day
            List <Appointment> appointments = SchedulingSupport.GetAppointmentsForDay(date);


            // Update the items accordingly
            int i = 0;

            foreach (AppointmentDetailLine line in detailLines)
            {
                line.ClearDetails();

                if (i == appointments.Count)
                {
                    if (appointments.Count < SchedulingSupport.MaxAppointmentsForDay(date))
                    {
                        line.UpdateAddButton(true);
                        line.UpdateClickability(true);
                    }
                    else
                    {
                        line.UpdateAddButton(false);
                        line.UpdateClickability(false);
                    }
                }
                else
                {
                    line.UpdateAddButton(false);

                    if (i < appointments.Count)
                    {
                        Appointment curr = appointments[i];
                        line.UpdateAppointmentDetails(Database.GetPatientsByAppointmentID(curr.AppointmentID), curr);
                        line.UpdateClickability(true);
                    }
                    else
                    {
                        line.UpdateClickability(false);
                    }
                }

                i++;
            }
        }
Пример #3
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);
        }
Пример #4
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn private void UpdateMobileRequests()
        ///
        /// \brief  Updates the UI to say how many mobile booking requests there are
        ///
        /// \author Bailey
        /// \date   2019-04-10
        ///-------------------------------------------------------------------------------------------------
        private void UpdateMobileRequests()
        {
            mobileRequestCount = SchedulingSupport.GetMobileRequestCount();

            // Format for "There are 3" vs "There is 1" grammar
            string output = "There ";
            bool   plural = false;

            if (mobileRequestCount == 1)
            {
                output += "is ";
            }
            else
            {
                output += "are ";
                plural  = true;
            }
            output += String.Format("{0} mobile request", mobileRequestCount);

            // "mobile request(s)"
            if (plural)
            {
                output += "s";
            }

            // Indicate that appointments should be booked
            if (mobileRequestCount > 0)
            {
                grdMobileRequests.Background = Brushes.IndianRed;
                lblMobileRequests.Foreground = Brushes.White;
                lblMobileRequests.FontWeight = FontWeights.Bold;
            }
            else
            {
                grdMobileRequests.Background = Brushes.White;
                lblMobileRequests.Foreground = Brushes.Black;
                lblMobileRequests.FontWeight = FontWeights.Normal;
            }

            // Update label with new string
            lblMobileRequests.Text = output;
        }
Пример #5
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;
                }
            }
        }