示例#1
0
 public void SendUserCreatedNotification(ConfirmNotification notification, UserCreatedCommand command)
 {
     using (var session = usersSessionFactory.CreateContext())
     {
         SendConfirmEmailNotification(notification,
                                      session.Users.Where(u => u.ObjectId == command.UserId)
                                      .Select(u => u.UserEmails.Select(e => e.Email).FirstOrDefault()).SingleOrDefault());
     }
 }
示例#2
0
        private void ModifyPersona_Click(object sender, RoutedEventArgs e)
        {
            var notification = ConfirmNotification.CreateNotificaion();

            //DynamicMojo.SwapMethodBodies(
            //    typeof(ConfirmNotification).GetMethod(nameof(notification.DoWhenFinished)),
            //    typeof(FichaPersona).GetMethod(nameof(ModifyContent))
            //);
            notification.WhenDone += ModifyContent;
        }
示例#3
0
 private void SendConfirmEmailNotification(ConfirmNotification notification, string email)
 {
     using (var session = usersSessionFactory.CreateContext(true))
     {
         var user = session.UserEmails.Single(u => u.Email == email);
         if (!user.IsEmailConfirmed)
         {
             notification.To               = user.Email;
             notification.Email            = user.Email;
             notification.ConfirmationCode = new PasswordGenerator().GeneratePassword(10, true, true, false);
             user.EmailConfirmationCode    = notification.ConfirmationCode;
             var not = session.Notifications.Single(n => n.Id == (int)NotificationTypes.ConfirmEmail);
             notification.MessageTemplate = not.Message;
             notification.Subject         = not.Subject;
             notification.Execute();
         }
     }
 }
示例#4
0
 public EmailChangedCommandHandler(ConfirmNotification notification)
 {
     this.notification = notification;
 }
示例#5
0
 public UserCreatedCommandHandler(NotificationService notificationService, ConfirmNotification notification)
 {
     this.notificationService = notificationService;
     this.notification        = notification;
 }
示例#6
0
 public void SendEmailChangedNotification(ConfirmNotification notification, EmailChangedCommand command)
 {
     SendConfirmEmailNotification(notification, command.Email);
 }