protected virtual IOrganizationStateMergePatched Map(IMergePatchOrganization c) { var stateEventId = new OrganizationStateEventId(c.OrganizationId, c.Version); IOrganizationStateMergePatched e = NewOrganizationStateMergePatched(stateEventId); e.Name = c.Name; e.Description = c.Description; e.Type = c.Type; e.IsSummary = c.IsSummary; e.Active = c.Active; e.IsPropertyNameRemoved = c.IsPropertyNameRemoved; e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved; e.IsPropertyTypeRemoved = c.IsPropertyTypeRemoved; e.IsPropertyIsSummaryRemoved = c.IsPropertyIsSummaryRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = DateTime.Now; var version = c.Version; return(e); }
public virtual void When(IOrganizationStateMergePatched e) { ThrowOnWrongEvent(e); if (e.Name == null) { if (e.IsPropertyNameRemoved) { this.Name = default(string); } } else { this.Name = e.Name; } if (e.Description == null) { if (e.IsPropertyDescriptionRemoved) { this.Description = default(string); } } else { this.Description = e.Description; } if (e.Type == null) { if (e.IsPropertyTypeRemoved) { this.Type = default(string); } } else { this.Type = e.Type; } if (e.IsSummary == null) { if (e.IsPropertyIsSummaryRemoved) { this.IsSummary = default(bool); } } else { this.IsSummary = (e.IsSummary != null && e.IsSummary.HasValue) ? e.IsSummary.Value : default(bool); } 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 OrganizationStateMergePatchedDto ToOrganizationStateMergePatchedDto(IOrganizationStateMergePatched e) { var dto = new OrganizationStateMergePatchedDto(); dto.StateEventId = new OrganizationStateEventIdDtoWrapper(e.StateEventId); dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Name = e.Name; dto.Description = e.Description; dto.Type = e.Type; dto.IsSummary = e.IsSummary; dto.Active = e.Active; dto.IsPropertyNameRemoved = e.IsPropertyNameRemoved; dto.IsPropertyDescriptionRemoved = e.IsPropertyDescriptionRemoved; dto.IsPropertyTypeRemoved = e.IsPropertyTypeRemoved; dto.IsPropertyIsSummaryRemoved = e.IsPropertyIsSummaryRemoved; dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved; return(dto); }
void IOrganizationState.When(IOrganizationStateMergePatched e) { throw new NotSupportedException(); }
public virtual void MergePatch(IMergePatchOrganization c) { IOrganizationStateMergePatched e = Map(c); Apply(e); }