Exemplo n.º 1
0
        protected virtual IUserPermissionMvoStateMergePatched Map(IMergePatchUserPermissionMvo c)
        {
            var stateEventId = new UserPermissionMvoEventId(c.UserPermissionId, c.UserVersion);
            IUserPermissionMvoStateMergePatched e = NewUserPermissionMvoStateMergePatched(stateEventId);

            e.Version                                   = c.Version;
            e.Active                                    = c.Active;
            e.UserUserName                              = c.UserUserName;
            e.UserAccessFailedCount                     = c.UserAccessFailedCount;
            e.UserEmail                                 = c.UserEmail;
            e.UserEmailConfirmed                        = c.UserEmailConfirmed;
            e.UserLockoutEnabled                        = c.UserLockoutEnabled;
            e.UserLockoutEndDateUtc                     = c.UserLockoutEndDateUtc;
            e.UserPasswordHash                          = c.UserPasswordHash;
            e.UserPhoneNumber                           = c.UserPhoneNumber;
            e.UserPhoneNumberConfirmed                  = c.UserPhoneNumberConfirmed;
            e.UserTwoFactorEnabled                      = c.UserTwoFactorEnabled;
            e.UserSecurityStamp                         = c.UserSecurityStamp;
            e.UserCreatedBy                             = c.UserCreatedBy;
            e.UserCreatedAt                             = c.UserCreatedAt;
            e.UserUpdatedBy                             = c.UserUpdatedBy;
            e.UserUpdatedAt                             = c.UserUpdatedAt;
            e.UserActive                                = c.UserActive;
            e.UserDeleted                               = c.UserDeleted;
            e.IsPropertyVersionRemoved                  = c.IsPropertyVersionRemoved;
            e.IsPropertyActiveRemoved                   = c.IsPropertyActiveRemoved;
            e.IsPropertyUserUserNameRemoved             = c.IsPropertyUserUserNameRemoved;
            e.IsPropertyUserAccessFailedCountRemoved    = c.IsPropertyUserAccessFailedCountRemoved;
            e.IsPropertyUserEmailRemoved                = c.IsPropertyUserEmailRemoved;
            e.IsPropertyUserEmailConfirmedRemoved       = c.IsPropertyUserEmailConfirmedRemoved;
            e.IsPropertyUserLockoutEnabledRemoved       = c.IsPropertyUserLockoutEnabledRemoved;
            e.IsPropertyUserLockoutEndDateUtcRemoved    = c.IsPropertyUserLockoutEndDateUtcRemoved;
            e.IsPropertyUserPasswordHashRemoved         = c.IsPropertyUserPasswordHashRemoved;
            e.IsPropertyUserPhoneNumberRemoved          = c.IsPropertyUserPhoneNumberRemoved;
            e.IsPropertyUserPhoneNumberConfirmedRemoved = c.IsPropertyUserPhoneNumberConfirmedRemoved;
            e.IsPropertyUserTwoFactorEnabledRemoved     = c.IsPropertyUserTwoFactorEnabledRemoved;
            e.IsPropertyUserSecurityStampRemoved        = c.IsPropertyUserSecurityStampRemoved;
            e.IsPropertyUserCreatedByRemoved            = c.IsPropertyUserCreatedByRemoved;
            e.IsPropertyUserCreatedAtRemoved            = c.IsPropertyUserCreatedAtRemoved;
            e.IsPropertyUserUpdatedByRemoved            = c.IsPropertyUserUpdatedByRemoved;
            e.IsPropertyUserUpdatedAtRemoved            = c.IsPropertyUserUpdatedAtRemoved;
            e.IsPropertyUserActiveRemoved               = c.IsPropertyUserActiveRemoved;
            e.IsPropertyUserDeletedRemoved              = c.IsPropertyUserDeletedRemoved;

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();

            var userVersion = c.UserVersion;


            return(e);
        }
 void IUserPermissionMvoState.When(IUserPermissionMvoStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Exemplo n.º 3
0
        public virtual void When(IUserPermissionMvoStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.Version == null)
            {
                if (e.IsPropertyVersionRemoved)
                {
                    this.Version = default(long);
                }
            }
            else
            {
                this.Version = (e.Version != null && e.Version.HasValue) ? e.Version.Value : default(long);
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }

            if (e.UserUserName == null)
            {
                if (e.IsPropertyUserUserNameRemoved)
                {
                    this.UserUserName = default(string);
                }
            }
            else
            {
                this.UserUserName = e.UserUserName;
            }

            if (e.UserAccessFailedCount == null)
            {
                if (e.IsPropertyUserAccessFailedCountRemoved)
                {
                    this.UserAccessFailedCount = default(int);
                }
            }
            else
            {
                this.UserAccessFailedCount = (e.UserAccessFailedCount != null && e.UserAccessFailedCount.HasValue) ? e.UserAccessFailedCount.Value : default(int);
            }

            if (e.UserEmail == null)
            {
                if (e.IsPropertyUserEmailRemoved)
                {
                    this.UserEmail = default(string);
                }
            }
            else
            {
                this.UserEmail = e.UserEmail;
            }

            if (e.UserEmailConfirmed == null)
            {
                if (e.IsPropertyUserEmailConfirmedRemoved)
                {
                    this.UserEmailConfirmed = default(bool);
                }
            }
            else
            {
                this.UserEmailConfirmed = (e.UserEmailConfirmed != null && e.UserEmailConfirmed.HasValue) ? e.UserEmailConfirmed.Value : default(bool);
            }

            if (e.UserLockoutEnabled == null)
            {
                if (e.IsPropertyUserLockoutEnabledRemoved)
                {
                    this.UserLockoutEnabled = default(bool);
                }
            }
            else
            {
                this.UserLockoutEnabled = (e.UserLockoutEnabled != null && e.UserLockoutEnabled.HasValue) ? e.UserLockoutEnabled.Value : default(bool);
            }

            if (e.UserLockoutEndDateUtc == null)
            {
                if (e.IsPropertyUserLockoutEndDateUtcRemoved)
                {
                    this.UserLockoutEndDateUtc = default(DateTime?);
                }
            }
            else
            {
                this.UserLockoutEndDateUtc = e.UserLockoutEndDateUtc;
            }

            if (e.UserPasswordHash == null)
            {
                if (e.IsPropertyUserPasswordHashRemoved)
                {
                    this.UserPasswordHash = default(string);
                }
            }
            else
            {
                this.UserPasswordHash = e.UserPasswordHash;
            }

            if (e.UserPhoneNumber == null)
            {
                if (e.IsPropertyUserPhoneNumberRemoved)
                {
                    this.UserPhoneNumber = default(string);
                }
            }
            else
            {
                this.UserPhoneNumber = e.UserPhoneNumber;
            }

            if (e.UserPhoneNumberConfirmed == null)
            {
                if (e.IsPropertyUserPhoneNumberConfirmedRemoved)
                {
                    this.UserPhoneNumberConfirmed = default(bool);
                }
            }
            else
            {
                this.UserPhoneNumberConfirmed = (e.UserPhoneNumberConfirmed != null && e.UserPhoneNumberConfirmed.HasValue) ? e.UserPhoneNumberConfirmed.Value : default(bool);
            }

            if (e.UserTwoFactorEnabled == null)
            {
                if (e.IsPropertyUserTwoFactorEnabledRemoved)
                {
                    this.UserTwoFactorEnabled = default(bool);
                }
            }
            else
            {
                this.UserTwoFactorEnabled = (e.UserTwoFactorEnabled != null && e.UserTwoFactorEnabled.HasValue) ? e.UserTwoFactorEnabled.Value : default(bool);
            }

            if (e.UserSecurityStamp == null)
            {
                if (e.IsPropertyUserSecurityStampRemoved)
                {
                    this.UserSecurityStamp = default(string);
                }
            }
            else
            {
                this.UserSecurityStamp = e.UserSecurityStamp;
            }

            if (e.UserCreatedBy == null)
            {
                if (e.IsPropertyUserCreatedByRemoved)
                {
                    this.UserCreatedBy = default(string);
                }
            }
            else
            {
                this.UserCreatedBy = e.UserCreatedBy;
            }

            if (e.UserCreatedAt == null)
            {
                if (e.IsPropertyUserCreatedAtRemoved)
                {
                    this.UserCreatedAt = default(DateTime);
                }
            }
            else
            {
                this.UserCreatedAt = (e.UserCreatedAt != null && e.UserCreatedAt.HasValue) ? e.UserCreatedAt.Value : default(DateTime);
            }

            if (e.UserUpdatedBy == null)
            {
                if (e.IsPropertyUserUpdatedByRemoved)
                {
                    this.UserUpdatedBy = default(string);
                }
            }
            else
            {
                this.UserUpdatedBy = e.UserUpdatedBy;
            }

            if (e.UserUpdatedAt == null)
            {
                if (e.IsPropertyUserUpdatedAtRemoved)
                {
                    this.UserUpdatedAt = default(DateTime);
                }
            }
            else
            {
                this.UserUpdatedAt = (e.UserUpdatedAt != null && e.UserUpdatedAt.HasValue) ? e.UserUpdatedAt.Value : default(DateTime);
            }

            if (e.UserActive == null)
            {
                if (e.IsPropertyUserActiveRemoved)
                {
                    this.UserActive = default(bool);
                }
            }
            else
            {
                this.UserActive = (e.UserActive != null && e.UserActive.HasValue) ? e.UserActive.Value : default(bool);
            }

            if (e.UserDeleted == null)
            {
                if (e.IsPropertyUserDeletedRemoved)
                {
                    this.UserDeleted = default(bool);
                }
            }
            else
            {
                this.UserDeleted = (e.UserDeleted != null && e.UserDeleted.HasValue) ? e.UserDeleted.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;
        }
Exemplo n.º 4
0
        public virtual void MergePatch(IMergePatchUserPermissionMvo c)
        {
            IUserPermissionMvoStateMergePatched e = Map(c);

            Apply(e);
        }
        public virtual UserPermissionMvoStateMergePatchedDto ToUserPermissionMvoStateMergePatchedDto(IUserPermissionMvoStateMergePatched e)
        {
            var dto = new UserPermissionMvoStateMergePatchedDto();

            dto.StateEventId                              = new UserPermissionMvoStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt                                 = e.CreatedAt;
            dto.CreatedBy                                 = e.CreatedBy;
            dto.CommandId                                 = e.CommandId;
            dto.Version                                   = e.Version;
            dto.Active                                    = e.Active;
            dto.UserUserName                              = e.UserUserName;
            dto.UserAccessFailedCount                     = e.UserAccessFailedCount;
            dto.UserEmail                                 = e.UserEmail;
            dto.UserEmailConfirmed                        = e.UserEmailConfirmed;
            dto.UserLockoutEnabled                        = e.UserLockoutEnabled;
            dto.UserLockoutEndDateUtc                     = e.UserLockoutEndDateUtc;
            dto.UserPasswordHash                          = e.UserPasswordHash;
            dto.UserPhoneNumber                           = e.UserPhoneNumber;
            dto.UserPhoneNumberConfirmed                  = e.UserPhoneNumberConfirmed;
            dto.UserTwoFactorEnabled                      = e.UserTwoFactorEnabled;
            dto.UserSecurityStamp                         = e.UserSecurityStamp;
            dto.UserCreatedBy                             = e.UserCreatedBy;
            dto.UserCreatedAt                             = e.UserCreatedAt;
            dto.UserUpdatedBy                             = e.UserUpdatedBy;
            dto.UserUpdatedAt                             = e.UserUpdatedAt;
            dto.UserActive                                = e.UserActive;
            dto.UserDeleted                               = e.UserDeleted;
            dto.IsPropertyVersionRemoved                  = e.IsPropertyVersionRemoved;
            dto.IsPropertyActiveRemoved                   = e.IsPropertyActiveRemoved;
            dto.IsPropertyUserUserNameRemoved             = e.IsPropertyUserUserNameRemoved;
            dto.IsPropertyUserAccessFailedCountRemoved    = e.IsPropertyUserAccessFailedCountRemoved;
            dto.IsPropertyUserEmailRemoved                = e.IsPropertyUserEmailRemoved;
            dto.IsPropertyUserEmailConfirmedRemoved       = e.IsPropertyUserEmailConfirmedRemoved;
            dto.IsPropertyUserLockoutEnabledRemoved       = e.IsPropertyUserLockoutEnabledRemoved;
            dto.IsPropertyUserLockoutEndDateUtcRemoved    = e.IsPropertyUserLockoutEndDateUtcRemoved;
            dto.IsPropertyUserPasswordHashRemoved         = e.IsPropertyUserPasswordHashRemoved;
            dto.IsPropertyUserPhoneNumberRemoved          = e.IsPropertyUserPhoneNumberRemoved;
            dto.IsPropertyUserPhoneNumberConfirmedRemoved = e.IsPropertyUserPhoneNumberConfirmedRemoved;
            dto.IsPropertyUserTwoFactorEnabledRemoved     = e.IsPropertyUserTwoFactorEnabledRemoved;
            dto.IsPropertyUserSecurityStampRemoved        = e.IsPropertyUserSecurityStampRemoved;
            dto.IsPropertyUserCreatedByRemoved            = e.IsPropertyUserCreatedByRemoved;
            dto.IsPropertyUserCreatedAtRemoved            = e.IsPropertyUserCreatedAtRemoved;
            dto.IsPropertyUserUpdatedByRemoved            = e.IsPropertyUserUpdatedByRemoved;
            dto.IsPropertyUserUpdatedAtRemoved            = e.IsPropertyUserUpdatedAtRemoved;
            dto.IsPropertyUserActiveRemoved               = e.IsPropertyUserActiveRemoved;
            dto.IsPropertyUserDeletedRemoved              = e.IsPropertyUserDeletedRemoved;

            return(dto);
        }