Example #1
0
        public void Add(EnquiryForm01Dto customer)
        {
            using (var transaction = new TransactionScope())
            {
                customer.Email = customer.Email.ToLower().Trim();
                if (CheckEmailExist(customer.Email, customer.PromotionGroupType))
                {
                    _customerRepository.Insert(customer.MapTo <Customer>());
                    transaction.Complete();
                }

                // send out email
                var emailTemplate =
                    _emailTemplateRepository.GetEmailTemplate(new Guid("BFFF3CBF-D9F5-4699-A593-16DDD016E158"));

                _emailSender.SendEmail(
                    emailTemplate.Subject,
                    emailTemplate.BodyTemplate,
                    emailTemplate.IsBodyHtml,
                    MailPriority.Normal,
                    Encoding.UTF8,
                    emailTemplate.From,
                    customer.Email,
                    emailTemplate.ReplyTo,
                    emailTemplate.Bcc,
                    GetTokenValues(customer)
                    );
            }
        }
Example #2
0
        private IDictionary <string, string> GetTokenValues(EnquiryForm01Dto customer)
        {
            var tokens = new Dictionary <string, string>();

            tokens.Add("FirstName", customer.FirstName);
            tokens.Add("LastName", customer.LastName);

            return(tokens);
        }
Example #3
0
 public bool Post(EnquiryForm01Dto customer)
 {
     _enquiryFormService.Add(customer);
     return(true);
 }