Exemplo n.º 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);
        }
Exemplo n.º 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++;
            }
        }
Exemplo n.º 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);
        }