Пример #1
0
        public async Task <Guid> SendAuthenticationEmail(AuthenticationInput input)
        {
            EmailDTO messageDTO = new EmailDTO();
            var      transactId = Guid.NewGuid();

            if (input.AuthenticationMode == Constants.AuthneticationMode.WebBasedAuthentication)
            {
                messageDTO.MailMessage = await MailTextAsync(input.AuthenticationMode, transactId, input.VerificationLink);
            }
            else
            {
                messageDTO.MailMessage = await MailTextAsync(input.AuthenticationMode, transactId);
            }

            messageDTO.MailSubject             = input.Subject;
            messageDTO.MailTo                  = input.Receiver;
            messageDTO.EncryptedNetworkKeyPath = input.EncryptedNetworkKeyPath;
            SendCommunications comms = new SendCommunications();
            await comms.SendEmail(messageDTO);

            return(transactId);
        }
Пример #2
0
        //TODO : update email text
        public async Task SendBookingConfirmation(string userEmail, int cartId)
        {
            var cartDetails = await _dbContext.ActivityCart.AsNoTracking().Where(x => x.Id == cartId).FirstOrDefaultAsync();

            List <ActivityCartDTO> activities      = JsonConvert.DeserializeObject <List <ActivityCartDTO> >(cartDetails.ItemDetails);
            List <Bookings>        bookings        = new List <Bookings>();
            List <Activities>      activityEntites = _dbContext.Activities.AsNoTracking().Join(activities, x => x.activity_id, y => y.ActivityID, (x, y) => x).ToList();

            foreach (var item in activities)
            {
                var tempBooking = new Bookings
                {
                    activity_id  = item.ActivityID,
                    booking_date = DateTime.Now,
                    user_name    = userEmail
                };
                bookings.Add(tempBooking);
            }

            activityEntites.ForEach(x => x.activity_slots = (x.activity_slots - 1));
            _dbContext.Activities.UpdateRange(activityEntites);
            _dbContext.ActivityCart.Remove(cartDetails);
            await _dbContext.Bookings.AddRangeAsync(bookings);

            await _dbContext.SaveChangesAsync();


            SendCommunications comms    = new SendCommunications();
            string             mailText = "Hi, Your booking has been confirmed. If you are not a registered user, use the same email id to register.";
            EmailDTO           dto      = new EmailDTO()
            {
                MailMessage             = mailText,
                MailSubject             = "Booking Confirmation Email",
                MailTo                  = userEmail,
                EncryptedNetworkKeyPath = await _connectService.GetConnectionAsync()
            };
            await comms.SendEmail(dto);
        }