protected virtual Tokenizer GetTokenizer(UserAccountEvent evt)
 {
     Type type = evt.GetType();
     if (type == typeof(EmailChangeRequestedEvent)) return new EmailChangeRequestedTokenizer();
     if (type == typeof(EmailChangedEvent)) return new EmailChangedTokenizer();
     return new Tokenizer();
 }
예제 #2
0
        protected virtual Tokenizer GetTokenizer(UserAccountEvent evt)
        {
            Type type = evt.GetType();

            if (type == typeof(EmailChangeRequestedEvent))
            {
                return(new EmailChangeRequestedTokenizer());
            }
            if (type == typeof(EmailChangedEvent))
            {
                return(new EmailChangedTokenizer());
            }
            if (type == typeof(CertificateAddedEvent))
            {
                return(new CertificateAddedTokenizer());
            }
            if (type == typeof(CertificateRemovedEvent))
            {
                return(new CertificateRemovedTokenizer());
            }
            if (type == typeof(LinkedAccountAddedEvent))
            {
                return(new LinkedAccountAddedTokenizer());
            }
            if (type == typeof(LinkedAccountRemovedEvent))
            {
                return(new LinkedAccountRemovedTokenizer());
            }
            return(new Tokenizer());
        }
예제 #3
0
        public virtual void Process(UserAccountEvent <TAccount> evt, object extra = null)
        {
            Tracing.Information("[{0}] Processing Event: {1}", this.GetType(), evt.GetType());

            var data = new Dictionary <string, string>();

            if (extra != null)
            {
                foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(extra))
                {
                    object obj2 = descriptor.GetValue(extra);
                    if (obj2 != null)
                    {
                        data.Add(descriptor.Name, obj2.ToString());
                    }
                }
            }

            var msg = CreateMessage(evt, data);

            if (msg != null)
            {
                SendSms(msg);
            }
        }
        protected virtual Tokenizer GetTokenizer(UserAccountEvent evt)
        {
            Type type = evt.GetType();

            if (type == typeof(EmailChangeRequestedEvent))
            {
                return(new EmailChangeRequestedTokenizer());
            }
            if (type == typeof(EmailChangedEvent))
            {
                return(new EmailChangedTokenizer());
            }
            return(new Tokenizer());
        }
        public virtual void Process(UserAccountEvent <TAccount> evt, object extra = null)
        {
            Tracing.Information("[{0}] Processing Event: {1}", this.GetType(), evt.GetType());

            var data = new Dictionary <string, string>();

            if (extra != null)
            {
                foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(extra))
                {
                    object obj2 = descriptor.GetValue(extra);
                    if (obj2 != null)
                    {
                        data.Add(descriptor.Name, obj2.ToString());
                    }
                }
            }

            var msg = this.messageFormatter.Format(evt, data);

            if (msg != null)
            {
                if (data.ContainsKey("NewEmail"))
                {
                    msg.To = data["NewEmail"];
                }
                else
                {
                    msg.To = evt.Account.Email;
                }

                msg = CustomizeEmail(msg, evt, data);

                if (msg != null && !String.IsNullOrWhiteSpace(msg.To))
                {
                    this.messageDelivery.Send(msg);
                }
            }
        }
 protected virtual string LoadBodyTemplate(UserAccountEvent <TAccount> evt)
 {
     return(LoadTemplate(CleanGenericName(evt.GetType()) + "_Body"));
 }
 protected virtual string LoadBodyTemplate(UserAccountEvent evt)
 {
     return LoadTemplate(evt.GetType().Name + "_Body");
 }
 protected virtual string LoadSubjectTemplate(UserAccountEvent evt)
 {
     return LoadTemplate(evt.GetType().Name + "_Subject");
 }
 protected virtual Tokenizer GetTokenizer(UserAccountEvent evt)
 {
     Type type = evt.GetType();
     if (type == typeof(EmailChangeRequestedEvent)) return new EmailChangeRequestedTokenizer();
     if (type == typeof(EmailChangedEvent)) return new EmailChangedTokenizer();
     if (type == typeof(CertificateAddedEvent)) return new CertificateAddedTokenizer();
     if (type == typeof(CertificateRemovedEvent)) return new CertificateRemovedTokenizer();
     if (type == typeof(LinkedAccountAddedEvent)) return new LinkedAccountAddedTokenizer();
     if (type == typeof(LinkedAccountRemovedEvent)) return new LinkedAccountRemovedTokenizer();
     return new Tokenizer();
 }
 protected virtual string LoadBodyTemplate(UserAccountEvent evt)
 {
     return(LoadTemplate(evt.GetType().Name + "_Body"));
 }
 protected virtual string LoadSubjectTemplate(UserAccountEvent evt)
 {
     return(LoadTemplate(evt.GetType().Name + "_Subject"));
 }