示例#1
0
        protected virtual IRolePermissionStateMergePatched Map(IMergePatchRolePermission c)
        {
            var stateEventId = new RolePermissionStateEventId(c.Id, c.Version);
            IRolePermissionStateMergePatched e = NewRolePermissionStateMergePatched(stateEventId);

            e.Active = c.Active;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;

            var version = c.Version;


            return(e);
        }
示例#2
0
        protected virtual IRolePermissionStateMergePatched Map(IMergePatchRolePermission c)
        {
            var stateEventId = new RolePermissionEventId(c.Id, c.Version);
            IRolePermissionStateMergePatched e = NewRolePermissionStateMergePatched(stateEventId);

            e.Active = c.Active;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


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

            var version = c.Version;


            return(e);
        }
示例#3
0
        public virtual void When(IRolePermissionStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            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);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;
        }
 void IRolePermissionState.When(IRolePermissionStateMergePatched e)
 {
     throw new NotSupportedException();
 }
示例#5
0
        public virtual void MergePatch(IMergePatchRolePermission c)
        {
            IRolePermissionStateMergePatched e = Map(c);

            Apply(e);
        }
        public virtual RolePermissionStateMergePatchedDto ToRolePermissionStateMergePatchedDto(IRolePermissionStateMergePatched e)
        {
            var dto = new RolePermissionStateMergePatchedDto();

            dto.StateEventId            = new RolePermissionStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt               = e.CreatedAt;
            dto.CreatedBy               = e.CreatedBy;
            dto.CommandId               = e.CommandId;
            dto.Active                  = e.Active;
            dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved;

            return(dto);
        }