コード例 #1
0
        /// <summary>
        /// Sends a FillPerfect information reply to a specific person
        /// </summary>
        /// <param name="procParams"></param>
        /// <returns></returns>
        public GeneralSuccessResultViewModel Execute(SendFpReplyParams procParams)
        {
            // Make sure the user is a site administrator
            if (!_adminAuthProc.Execute(new SiteAdminAuthorizationParams {
                UserId = procParams.RequestingUserId
            }).UserAuthorized)
            {
                throw new UserNotAuthorizedForProcessException(procParams.RequestingUserId, typeof(SendFpReplyParams), typeof(GeneralSuccessResultViewModel));
            }

            // Retrieve the response the reply is for
            var response = _context.FillPerfectContactResponses
                           .Where(x => x.Id == procParams.ResponseId)
                           .SingleOrDefault();

            if (response == null)
            {
                throw new MJLEntityNotFoundException(typeof(FillPerfectContactResponse), procParams.RequestingUserId);
            }

            // Sanitize the html content
            procParams.EmailContent = MerchantTribe.Web.HtmlSanitizer.MakeHtmlSafe(procParams.EmailContent);

            response.RepliedDate = DateTime.Now;
            new FillPerfectMailController().SendContactReplyEmail(procParams);
            _context.SaveChanges();

            return(new GeneralSuccessResultViewModel {
                WasSuccessful = true
            });
        }
コード例 #2
0
        public void SendContactReplyEmail(SendFpReplyParams model)
        {
            string body = ParseTemplate("Mail/Templates/FillPerfect/FpContactReplyEmail.cshtml", model);

            new EmailUtils().Send(model.ToAddress, model.Subject, body, true, model.FromAddress);
        }