/*
         *
         *
         * Loads booking slots based on the datetime dynamically by calliing database
         *
         *
         */
        private void checkUpDateTXT_ValueChanged(object sender, EventArgs e)
        {
            NoteTXT.Text = "";
            bookingSlotTXT.Items.Clear();
            bookingSlotTXT.Text = "";
            List <string> bookingSlots = AppointmentHelper.getCheckupSlots(checkUpDateTXT.Value);
            List <string> bookedSlots  = new List <string>();

            if (bookingSlots.Count != 0)
            {
                bookedSlots = AppointmentHelper.
                              bookedCheckupSlots(new DateTime(bookingDate.Year, bookingDate.Month, bookingDate.Day));
            }

            List <string> availableSlots = bookingSlots.Except(bookedSlots).ToList();

            if (availableSlots.Count == 0)
            {
                NoteTXT.Text = "Note: Slots not available for this day. Please select next day";
            }

            if (availableSlots.Count == 0 && checkUpDateTXT.Value.CompareTo(DateTime.Now.AddDays(7)) <= 0)
            {
                DayOfWeek dayOfWeek = DateTime.Now.AddDays(8).DayOfWeek;
                if (dayOfWeek == DayOfWeek.Saturday)
                {
                    dayOfWeek = DateTime.Now.AddDays(10).DayOfWeek;
                }
                else if (dayOfWeek == DayOfWeek.Sunday)
                {
                    dayOfWeek = DateTime.Now.AddDays(9).DayOfWeek;
                }
                NoteTXT.Text = "Note: You can not book slots this week. Try to select from " + dayOfWeek.ToString() + " of next week";
            }

            bookingSlotTXT.Items.AddRange(availableSlots.ToArray());
        }
Exemplo n.º 2
0
        /*
         *
         * Loads the booking slots based on the availability
         *
         *
         */
        private void bookingDateTXT_ValueChanged(object sender, EventArgs e)
        {
            bookingSlotTXT.Items.Clear();
            bookingSlotTXT.Text = "";
            List <string> bookingSlots = AppointmentHelper.getEmergencySlots(bookingDateTXT.Value);
            List <string> bookedSlots  = new List <string>();

            if (bookingSlots.Count != 0)
            {
                bookedSlots = AppointmentHelper.
                              bookedCheckupSlots(new DateTime(bookingDate.Year, bookingDate.Month, bookingDate.Day));
            }

            List <string> availableSlots = bookingSlots.Except(bookedSlots).ToList();

            if (availableSlots.Count == 0)
            {
                NoteTXT.Text = "Note: Slots not available for this day. Please select next day";
            }



            bookingSlotTXT.Items.AddRange(availableSlots.ToArray());
        }