コード例 #1
0
        public IList <Booking> ListBookings(BookingFilter filter)
        {
            IList <Booking> bookings         = List();
            IList <Booking> selectedBookings = ListBookings(bookings, filter);

            return(selectedBookings);
        }
コード例 #2
0
        public string ListBookingsForCancellation(IUserProfile userProfile)
        {
            DateTime dateUtc = DateTime.UtcNow;

            BookingFilter filter = new BookingFilter();

            filter.BookedFromUtc = dateUtc;
            filter.BookedToUtc   = filter.BookedFromUtc.AddDays(180);
            filter.BookedBy      = userProfile.UserName;

            IList <Booking> bookings = _bookingRepository.ListBookings(filter);
            AliceBookingCancellationSuggestionsParser parser = new AliceBookingCancellationSuggestionsParser();
            string response = parser.Parse(bookings, userProfile);

            return(response);
        }
コード例 #3
0
        private IList <Booking> ListBookings(IList <Booking> bookings, BookingFilter filter)
        {
            IList <Booking> bookingsForSlot = new List <Booking>();

            foreach (Booking booking in bookings)
            {
                if (filter.Filter(booking))
                {
                    if (!bookingsForSlot.Contains(booking))
                    {
                        bookingsForSlot.Add(booking);
                    }
                }
            }

            return(bookingsForSlot);
        }
コード例 #4
0
        private string ListBookings(DateTime date, string userName, IUserProfile userProfile)
        {
            DateTime localTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(date, userProfile.TimeZoneInfo.Id);
            DateTime dateUtc   = localTime.Date.ToUniversalTime();

            BookingFilter filter = new BookingFilter();

            filter.BookedFromUtc = dateUtc;
            filter.BookedToUtc   = filter.BookedFromUtc.AddHours(24);
            filter.BookedBy      = userName;

            IList <Booking> bookings = _bookingRepository.ListBookings(filter);

            AliceBookingListParser parser = new AliceBookingListParser();
            string response = parser.Parse(bookings, userProfile);

            return(response);
        }