public virtual void When(IDocumentTypeStateMergePatched e) { ThrowOnWrongEvent(e); if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } if (e.ParentDocumentTypeId == null) { if (e.IsPropertyParentDocumentTypeIdRemoved) { this.ParentDocumentTypeId = default(string); } } else { this.ParentDocumentTypeId = e.ParentDocumentTypeId; } 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; }
protected virtual IDocumentTypeStateMergePatched Map(IMergePatchDocumentType c) { var stateEventId = new DocumentTypeEventId(c.DocumentTypeId, c.Version); IDocumentTypeStateMergePatched e = NewDocumentTypeStateMergePatched(stateEventId); e.Description = c.Description; e.ParentDocumentTypeId = c.ParentDocumentTypeId; e.Active = c.Active; e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved; e.IsPropertyParentDocumentTypeIdRemoved = c.IsPropertyParentDocumentTypeIdRemoved; 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 DocumentTypeStateMergePatchedDto ToDocumentTypeStateMergePatchedDto(IDocumentTypeStateMergePatched e) { var dto = new DocumentTypeStateMergePatchedDto(); dto.DocumentTypeEventId = e.DocumentTypeEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Description = e.Description; dto.ParentDocumentTypeId = e.ParentDocumentTypeId; dto.Active = e.Active; dto.IsPropertyDescriptionRemoved = e.IsPropertyDescriptionRemoved; dto.IsPropertyParentDocumentTypeIdRemoved = e.IsPropertyParentDocumentTypeIdRemoved; dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved; return(dto); }
public virtual void MergePatch(IMergePatchDocumentType c) { IDocumentTypeStateMergePatched e = Map(c); Apply(e); }
void IDocumentTypeState.When(IDocumentTypeStateMergePatched e) { throw new NotSupportedException(); }