Esempio n. 1
0
        private EmailAccount(CreateEmailAccount cmd) : base(cmd.Id)
        {
            SiteId             = cmd.SiteId;
            Address            = cmd.Address;
            DisplayName        = cmd.DisplayName;
            Host               = cmd.Host;
            Port               = cmd.Port;
            UserName           = cmd.UserName;
            Password           = cmd.Password;
            DefaultCredentials = cmd.DefaultCredentials;
            Ssl    = cmd.Ssl;
            Status = EmailAccountStatus.Active;

            AddEvent(new EmailAccountCreated
            {
                SiteId             = SiteId,
                AggregateRootId    = Id,
                Address            = Address,
                DisplayName        = DisplayName,
                Host               = Host,
                Port               = Port,
                UserName           = UserName,
                Password           = Password,
                DefaultCredentials = DefaultCredentials,
                Ssl    = Ssl,
                Status = Status
            });
        }
Esempio n. 2
0
 private void Apply(EmailAccountCreated @event)
 {
     Id                 = @event.AggregateRootId;
     SiteId             = @event.SiteId;
     Address            = @event.Address;
     DisplayName        = @event.DisplayName;
     Host               = @event.Host;
     Port               = @event.Port;
     UserName           = @event.UserName;
     Password           = @event.Password;
     DefaultCredentials = @event.DefaultCredentials;
     Ssl                = @event.Ssl;
     Status             = EmailAccountStatus.Active;
 }
Esempio n. 3
0
        public void Delete(DeleteEmailAccount cmd, IValidator <DeleteEmailAccount> validator)
        {
            validator.ValidateCommand(cmd);

            if (Status == EmailAccountStatus.Deleted)
            {
                throw new Exception("Email account already deleted.");
            }

            Status = EmailAccountStatus.Deleted;

            AddEvent(new EmailAccountDeleted
            {
                SiteId          = SiteId,
                AggregateRootId = Id
            });
        }
Esempio n. 4
0
 private void Apply(EmailAccountDeleted @event)
 {
     Status = EmailAccountStatus.Deleted;
 }