示例#1
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn private void BtnBook_Click(object sender, RoutedEventArgs e)
        ///
        /// \brief  Book button clicked. Only possible if there is atleast one appointment slot available.
        ///			Mobile client is informed when this happens with a notification
        ///
        /// \author Bailey
        /// \date   2019-04-18
        ///-------------------------------------------------------------------------------------------------
        private void BtnBook_Click(object sender, RoutedEventArgs e)
        {
            int i = lstRequests.SelectedIndex;

            if (i >= 0)
            {
                // Get HoH (unless they are the hoh)
                Patient hoh    = null;
                string  hohHCN = patients[i].GetHoH();
                if (hohHCN != patients[i].HCN)
                {
                    hoh = Database.Patients[hohHCN];
                }

                bool booked = SchedulingSupport.BookAppointment(patients[i], hoh, requests[i].Date);

                if (!booked)
                {
                    Cancel();
                }

                SubmitResponse(patients[i].HCN, booked ? BuildResponseBook(requests[i].Date) : BuildResponseReject(requests[i].Date));
                LoadRequests();
            }
        }
示例#2
0
        public CalendarDay(DateTime day, int targetMonth)
        {
            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;
            }

            maxAppointments = SchedulingSupport.MaxAppointmentsForDay(day);

            AddAppointmentsFromList(SchedulingSupport.GetAppointmentsForDay(date));
        }
示例#3
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn public CheckedInList(DateTime date)
        ///
        /// \brief  Loads all appointments and their check-in status on construction of the window
        ///
        /// \author Bailey
        /// \date   2019-04-16
        ///-------------------------------------------------------------------------------------------------
        public CheckedInList(DateTime date)
        {
            InitializeComponent();

            // Update the database to reflect any mobile changes
            Database.UpdateMobileFlagsForDate(date);

            // Load interface with appointments for day
            appointments = SchedulingSupport.GetAppointmentsForDay(date);
            foreach (Appointment appointment in appointments)
            {
                string content = "---";
                var    people  = Database.GetPatientsByAppointmentID(appointment.AppointmentID);

                if (people.Count > 0)
                {
                    content = people[0].FirstName + " " + people[0].LastName;
                    if (people.Count == 2)
                    {
                        content += ", " + people[1].FirstName + " " + people[1].LastName;
                    }
                }

                bool cleared = false;
                if (!cleared)
                {
                    Label l = new Label();
                    l.Width   = 240;
                    l.Content = content;

                    if (appointment.MobileFlag == APPT_CHECKED_IN)
                    {
                        l.Background = COLOUR_CHECKED_IN;
                    }
                    else if (appointment.MobileFlag == APPT_CLEARED)
                    {
                        l.Background = COLOUR_CLEARED;
                    }

                    lstAppointments.Items.Add(l);
                }
            }
        }
示例#4
0
        ///-------------------------------------------------------------------------------------------------
        /// \fn private void LstRequests_SelectionChanged(object sender, SelectionChangedEventArgs e)
        ///
        /// \brief  Whenever a new item is selected, update the buttons based on what they can do
        ///				o cannot book if the date is already full of appointments
        ///				o cancel (always available)
        ///
        /// \author Bailey
        /// \date   2019-04-18
        ///-------------------------------------------------------------------------------------------------
        private void LstRequests_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int i = lstRequests.SelectedIndex;

            if (i >= 0)
            {
                btnCancel.IsEnabled = true;

                // Only allow booking if there are enough slots
                if (SchedulingSupport.GetAppointmentCountForDay(requests[i].Date) < SchedulingSupport.MaxAppointmentsForDay(requests[i].Date))
                {
                    btnBook.IsEnabled = true;
                }
                else
                {
                    btnBook.IsEnabled = false;
                }
            }
            else
            {
                btnBook.IsEnabled   = false;
                btnCancel.IsEnabled = false;
            }
        }