コード例 #1
0
ファイル: Services.cs プロジェクト: GABAnich/HotelTelegramBot
        public static List <HotelRoom> GetAviableRooms(List <string> dates)
        {
            List <long> reservationIds      = ServicesHotelRoomReservedDate.GetReservationIds(dates);
            List <long> reservedHotelRoomId = ServicesReservation.GetReservedHotelRoomIds(reservationIds);

            return(ServicesHotelRoom.GetAviableHotelRooms(reservedHotelRoomId));
        }
コード例 #2
0
        internal static IReplyMarkup GetReservationsMenu(List <Reservation> listReservation)
        {
            List <List <InlineKeyboardButton> > keyboards = new List <List <InlineKeyboardButton> >();

            foreach (Reservation r in listReservation)
            {
                HotelRoom     room     = ServicesHotelRoom.GetHotelRoomById(r.HotelRoomId);
                HotelRoomType roomType = ServicesHotelRoomType.GetHotelRoomTypeById(room.HotelRoomTypeId);
                keyboards.Add(new List <InlineKeyboardButton>()
                {
                    InlineKeyboardButton.WithCallbackData(
                        $"{roomType.Name}: {r.DateOfArrival}-{r.DateOfDeparture}",
                        $"{r.Id}"
                        )
                });
            }
            return(new InlineKeyboardMarkup(keyboards));
        }
コード例 #3
0
        public override async void OnStateChange(Chat chat)
        {
            await ServicesMessageController.SendMessageAsync(chat, "Очікування бронювання");

            responder.userTempData.TryGetValue("HotelRoomTypeId", out string hotelRoomTypeId);
            responder.userTempData.TryGetValue("DateOfArrival", out string arrival);
            responder.userTempData.TryGetValue("DateOfDeparture", out string departure);
            responder.userTempData.TryGetValue("SecondName", out string secondName);
            responder.userTempData.TryGetValue("FirstName", out string firstName);
            responder.userTempData.TryGetValue("MiddleName", out string middleName);
            responder.userTempData.TryGetValue("Number", out string number);
            responder.userTempData.TryGetValue("Email", out string email);
            responder.userTempData.TryGetValue("NumberOfAdults", out string adults);
            responder.userTempData.TryGetValue("NumberOfChildren", out string children);

            Reservation reservation = new Reservation()
            {
                IdUserChat       = chat.Id,
                SecondName       = secondName,
                FirstName        = firstName,
                MiddleName       = middleName,
                Number           = number,
                Email            = email,
                DateOfArrival    = arrival,
                DateOfDeparture  = departure,
                NumberOfAdults   = int.Parse(adults),
                NumberOfChildren = int.Parse(children)
            };

            Reservation r = await DbServices.AddReservationAsync(chat.Id, int.Parse(hotelRoomTypeId), reservation);

            HotelRoom     room      = ServicesHotelRoom.GetHotelRoomById(r.HotelRoomId);
            HotelRoomType t         = ServicesHotelRoomType.GetHotelRoomTypeById(room.HotelRoomTypeId);
            int           countDays = DbServices.GetIntermediateDates(r.DateOfArrival, r.DateOfArrival).Count;

            string text = ViewReservation.GetTextAboutReservation(r, t, room, countDays);
            await ServicesMessageController.SendMessageAsync(chat, text, Keyboards.ReturnMainMenu);
        }