public static List <HotelRoom> GetAviableRooms(List <string> dates) { List <long> reservationIds = ServicesHotelRoomReservedDate.GetReservationIds(dates); List <long> reservedHotelRoomId = ServicesReservation.GetReservedHotelRoomIds(reservationIds); return(ServicesHotelRoom.GetAviableHotelRooms(reservedHotelRoomId)); }
internal static async Task <Reservation> AddReservationAsync(long chatId, long hotelRoomTypeId, Reservation _r) { List <string> dates = GetIntermediateDates(_r.DateOfArrival, _r.DateOfDeparture); long hotelRoomId = GetHotelRoom(hotelRoomTypeId, dates).Id; _r.HotelRoomId = hotelRoomId; Reservation r = await ServicesReservation.AddReservationAsync(_r); await ServicesHotelRoomReservedDate.AddHotelRoomReservedDatesAsync(r.Id, dates); return(r); }
public static List <Reservation> GetValidReservation(long chatId, DateTime lastDate) { List <Reservation> reservation = ServicesReservation.GetReservationByChatId(chatId); // Returns actual bookings for (int i = reservation.Count - 1; i > -1; i--) { if (IsAviableDate(reservation[i].DateOfDeparture, lastDate)) { reservation.RemoveAt(i); } } return(reservation); }
public override async void ReceiveMessageAsync(EventArgs e) { string userInput = (e as CallbackQueryEventArgs).CallbackQuery.Data; Chat chat = (e as CallbackQueryEventArgs).CallbackQuery.Message.Chat; Reservation r = ServicesReservation.GetReservationById(int.Parse(userInput)); if (r == null) { await ServicesMessageController.SendMessageAsync(chat, "Виберіть бронювання із списку", Keyboards.MainKeyboard); } await ServicesMessageController.SendMessageAsync(chat, "Знаття бронювання..."); await DbServices.DeleteHotelRoomReservedDateByRoomIdAsync(r.Id); await ServicesReservation.DeleteReservationByIdAsync(r.Id); await ServicesMessageController.SendMessageAsync(chat, "Бронювання знято", Keyboards.ReturnMainMenu); responder.SetState(new MainMenu()); }