Пример #1
0
        public void InserstGuestGiftReservation(Guest guest, GiftPruchase pruchase)
        {
            var   connection = Database.OpenConnection(_configuration.GiftmeConnectionString);
            Guest savedGuest = connection.Guest.Insert(guest);

            pruchase.GuestId = savedGuest.GuestId;
            connection.GiftPurchase.Insert(pruchase);
        }
Пример #2
0
        public void SendPurchaseConfirmationEmail(Guest guest, GiftPruchase guestPurchase, Gift gift)
        {
            GiftPurchaseConfirmationEmail emailData = new GiftPurchaseConfirmationEmail(guest,guestPurchase,gift);

            try
            {
                var smtpClient = new SmtpClient();
                var mailMessage = new MailMessage(emailData.FromAddress, emailData.ToAddress, emailData.Subject, emailData.GenerateEmailBody());
                mailMessage.IsBodyHtml = true;
                smtpClient.Send(mailMessage);
            }catch(SmtpException exception)
            {
                _logger.LogError("Could not send email",exception);
            }
        }
 public GiftPurchaseConfirmationEmail(Guest guest, GiftPruchase guestPurchase, Gift gift)
 {
     _guest = guest;
     _guestPurchase = guestPurchase;
     _gift = gift;
 }
Пример #4
0
 private ReservationConfirmationPage CompleteReservation(GiftPruchase reservation)
 {
     ReservationConfirmationPage reservationConfirmationPage = new ReservationConfirmationPage();
     reservation.Confirmed = true;
     reservation.ConfirmedOn = DateTime.Now;
     _userRepository.UpdateGiftReservation(reservation);
     Gift gift = _giftRepository.GetGift(reservation.GiftId);
     gift.ConfirmReservation(reservation.Quantity);
     _giftRepository.UpdateGift(gift);
     Guest guest = _userRepository.GetGuestById(reservation.GuestId);
     reservationConfirmationPage.Guest = guest;
     reservationConfirmationPage.GiftPruchase = reservation;
     reservationConfirmationPage.ReservedGift = gift;
     return reservationConfirmationPage;
 }
Пример #5
0
 public void ReserveGift(string guestName, string guestEmail, int giftId, int quantityReserved)
 {
     _loggingService.LogInformation(string.Format("Guest {0}({1}) is reserving {2} of gift {3}", guestName,guestEmail,giftId,quantityReserved));
     Guest guest = new Guest{Email = guestEmail, Name = guestName,CreatedDate = DateTime.Now};
     var giftPurchase = new GiftPruchase(giftId,quantityReserved);
     _userRepository.InserstGuestGiftReservation(guest, giftPurchase);
     Gift gift = _giftRepository.GetGift(giftId);
     gift.PendingReservation = true;
     _giftRepository.UpdateGift(gift);
     _mailService.SendPurchaseConfirmationEmail(guest, giftPurchase, gift);
 }
Пример #6
0
 public void InserstGuestGiftReservation(Guest guest, GiftPruchase pruchase)
 {
     var connection = Database.OpenConnection(_configuration.GiftmeConnectionString);
     Guest savedGuest = connection.Guest.Insert(guest);
     pruchase.GuestId = savedGuest.GuestId;
     connection.GiftPurchase.Insert(pruchase);
 }
Пример #7
0
 public void UpdateGiftReservation(GiftPruchase reservation)
 {
     var connection = Database.OpenConnection(_configuration.GiftmeConnectionString);
     connection.GiftPurchase.Update(reservation);
 }
Пример #8
0
        public void UpdateGiftReservation(GiftPruchase reservation)
        {
            var connection = Database.OpenConnection(_configuration.GiftmeConnectionString);

            connection.GiftPurchase.Update(reservation);
        }