示例#1
0
        public OfferStateEmailSender(IEmailService emailService, IMessageBodyProvider bodyProvider)
        {
            this.emailService = emailService;
            this.bodyProvider = bodyProvider;


            stateTypeDict = new Dictionary <OfferStateChange, string>();
            stateTypeDict.Add(OfferStateChange.UserRemoved, "RequestStateChanged");
            stateTypeDict.Add(OfferStateChange.RequestAccepted, "RequestStateChanged");
            stateTypeDict.Add(OfferStateChange.Deleted, "OfferStateChanged");
        }
示例#2
0
 /// <summary>
 /// Base implenmentation of EmailConfirmator
 /// </summary>
 /// <param name="emailService">Service used for sending emails</param>
 /// <param name="messageBody">Basse message body exluding link replacement</param>
 /// <param name="userRepository">Repository of users</param>
 /// <param name="tokenProvider">Token provider for confirmation</param>
 /// <param name="messageType">Name of message template used in email sender</param>
 public EmailConfirmatorSender(IEmailService emailService,
                               IMessageBodyProvider messageBodyProvider,
                               IApplicationUserRepository userRepository,
                               IConfirmationTokenProvider tokenProvider,
                               string messageType)
 {
     this.emailService        = emailService;
     this.messageBodyProvider = messageBodyProvider;
     this.userRepository      = userRepository;
     this.tokenProvider       = tokenProvider;
     this.messageType         = messageType;
 }
示例#3
0
        /// <summary>
        /// Construct StandardEmailConfirmatorFactory.
        /// </summary>
        /// <param name="serviceProvider">Standard serivce provider from startup scope. Can by passed directly from DIC</param>
        /// <param name="confirmatorType">Type of confirmator, used in select implemetation of <code>IConfirmationProvider</code>,<code>IConfirmationTokenProvider</code> and <code>IMessageBodyProvider</code> setup in Startup.cs</param>
        /// <param name="messageTemplate">Message template name see templates.json file"/></param>
        public StandardEmailConfirmatorFactory(
            IServiceProvider serviceProvider,
            ConfirmatorType confirmatorType,
            string messageTemplate)
        {
            this.serviceProvider = serviceProvider;
            this.messageTemplate = messageTemplate;

            confirmationProvider = serviceProvider.GetService <Func <ConfirmatorType, IConfirmationProvider> >()
                                   .Invoke(confirmatorType);

            confirmationTokenProvider = serviceProvider.GetService <Func <ConfirmatorType, IConfirmationTokenProvider> >()
                                        .Invoke(confirmatorType);

            messageBodyProvider = serviceProvider.GetService <Func <ConfirmatorType, IMessageBodyProvider> >()
                                  .Invoke(confirmatorType);
        }