public static void SendReservationCancelarEmail(string clientAddress, UserReservationFullData userReservation) { string messageSubject = $"Potwierdzenie anulowania rezerwacji nr {userReservation.ID_USER_RESERVATION} w hotelu {userReservation.HOTEL_NAME}"; string messageBody = $"Witaj {new AccountSqlExecutor().GetUserById(userReservation.ID_USER).Name}! \n" + $"Potwierdzamy anulowanie rezerwacji.\nJest nam przykro, lecz mamy nadzieję, że jesteś zadowolony z naszych usług!\n" + $"Pozdrawiamy, zespół GIS"; SendEmail(clientAddress, messageSubject, messageBody); }
public UserReservationFullData GetReservationById(int idReseration) { var sqlQuery = $"SELECT USER_RESERVATIONS.*, OFFERS.ID_HOTEL, OFFERS.NAME, OFFERS.DESCRIPTION, OFFERS.DATE_START," + $"OFFERS.DATE_END, OFFERS.PRICE, OFFERS.PEOPLE_FROM, OFFERS.PEOPLE_TO, HOTELS.NAME AS HOTEL_NAME " + $"FROM USER_RESERVATIONS INNER JOIN OFFERS ON USER_RESERVATIONS.ID_OFFER = OFFERS.ID_OFFER " + $"INNER JOIN HOTELS ON OFFERS.ID_HOTEL = HOTELS.ID_HOTEL WHERE ID_USER_RESERVATION = '{idReseration}'"; UserReservationFullData reservation = db.Query <UserReservationFullData>(sqlQuery).SingleOrDefault(); return(reservation); }
public static void SendReservationEmail(string clientAddress, UserReservationFullData userReservation) { string messageSubject = $"Potwierdzenie rezerwacji nr {userReservation.ID_USER_RESERVATION} w hotelu {userReservation.HOTEL_NAME}"; string messageBody = $"Witaj {new AccountSqlExecutor().GetUserById(userReservation.ID_USER).Name}! \n" + $"Potwierdzamy złożoną rezerwację oraz przedstawiamy jej szczegóły:\n" + $"Nazwa hotelu: {userReservation.HOTEL_NAME}\n" + $"Wybrana oferta: {userReservation.NAME}, {userReservation.DESCRIPTION}\n" + $"Szczegóły rezerwacji:\nZameldowanie: {userReservation.DATE_START}, Wymeldowanie: {userReservation.DATE_END}\nCena: {userReservation.PRICE}zł\n" + $"Liczba gości: {userReservation.GUESTS}\n" + $"Pozdrawiamy, zespół GIS"; SendEmail(clientAddress, messageSubject, messageBody); }
public ActionResult Create(UserReservationEdit model) { List <Guest> selectedGuests = model.Guests.Where(g => g.FIRST_NAME != null).ToList(); UserReservation reservation = new UserReservation { ID_OFFER = model.Offer.ID_OFFER, ID_USER = model.IdUser, RESERVATION_DATE = DateTime.Now, GUESTS = selectedGuests.Count }; int idReservation = _reservationsSqlExecutor.AddReservation(reservation); foreach (Guest guest in selectedGuests) { _reservationsSqlExecutor.AddGuestToReservation(idReservation, guest); } UserReservationFullData reservationFullData = _reservationsSqlExecutor.GetReservationById(idReservation); User user = _accountSqlExecutor.GetUserById(model.IdUser); EmailService.SendReservationEmail(user.Email, reservationFullData); return(RedirectToAction("Index")); }