protected virtual IPermissionStateMergePatched Map(IMergePatchPermission c) { var stateEventId = new PermissionStateEventId(c.PermissionId, c.Version); IPermissionStateMergePatched e = NewPermissionStateMergePatched(stateEventId); e.Name = c.Name; e.ParentPermissionId = c.ParentPermissionId; e.Description = c.Description; e.Active = c.Active; e.IsPropertyNameRemoved = c.IsPropertyNameRemoved; e.IsPropertyParentPermissionIdRemoved = c.IsPropertyParentPermissionIdRemoved; e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; ReflectUtils.CopyPropertyValue("CommandId", c, e); e.CreatedBy = (string)c.RequesterId; e.CreatedAt = DateTime.Now; var version = c.Version; return(e); }
protected virtual IPermissionStateMergePatched Map(IMergePatchPermission c) { var stateEventId = new PermissionEventId(c.PermissionId, c.Version); IPermissionStateMergePatched e = NewPermissionStateMergePatched(stateEventId); e.Name = c.Name; e.ParentPermissionId = c.ParentPermissionId; e.Description = c.Description; e.Active = c.Active; e.IsPropertyNameRemoved = c.IsPropertyNameRemoved; e.IsPropertyParentPermissionIdRemoved = c.IsPropertyParentPermissionIdRemoved; e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved; 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); }
public virtual void When(IPermissionStateMergePatched e) { ThrowOnWrongEvent(e); if (e.Name == null) { if (e.IsPropertyNameRemoved) { this.Name = default(string); } } else { this.Name = e.Name; } if (e.ParentPermissionId == null) { if (e.IsPropertyParentPermissionIdRemoved) { this.ParentPermissionId = default(string); } } else { this.ParentPermissionId = e.ParentPermissionId; } if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } 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; }
public virtual void MergePatch(IMergePatchPermission c) { IPermissionStateMergePatched e = Map(c); Apply(e); }
void IPermissionState.When(IPermissionStateMergePatched e) { throw new NotSupportedException(); }
public virtual PermissionStateMergePatchedDto ToPermissionStateMergePatchedDto(IPermissionStateMergePatched e) { var dto = new PermissionStateMergePatchedDto(); dto.PermissionEventId = e.PermissionEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Name = e.Name; dto.ParentPermissionId = e.ParentPermissionId; dto.Description = e.Description; dto.Active = e.Active; dto.IsPropertyNameRemoved = e.IsPropertyNameRemoved; dto.IsPropertyParentPermissionIdRemoved = e.IsPropertyParentPermissionIdRemoved; dto.IsPropertyDescriptionRemoved = e.IsPropertyDescriptionRemoved; dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved; return(dto); }