protected virtual IAttributeValueMvoStateMergePatched Map(IMergePatchAttributeValueMvo c) { var stateEventId = new AttributeValueMvoStateEventId(c.AttributeValueId, c.AttributeVersion); IAttributeValueMvoStateMergePatched e = NewAttributeValueMvoStateMergePatched(stateEventId); e.Name = c.Name; e.Description = c.Description; e.ReferenceId = c.ReferenceId; e.Version = c.Version; e.Active = c.Active; e.AttributeName = c.AttributeName; e.AttributeOrganizationId = c.AttributeOrganizationId; e.AttributeDescription = c.AttributeDescription; e.AttributeIsMandatory = c.AttributeIsMandatory; e.AttributeIsInstanceAttribute = c.AttributeIsInstanceAttribute; e.AttributeAttributeValueType = c.AttributeAttributeValueType; e.AttributeAttributeValueLength = c.AttributeAttributeValueLength; e.AttributeIsList = c.AttributeIsList; e.AttributeFieldName = c.AttributeFieldName; e.AttributeReferenceId = c.AttributeReferenceId; e.AttributeCreatedBy = c.AttributeCreatedBy; e.AttributeCreatedAt = c.AttributeCreatedAt; e.AttributeUpdatedBy = c.AttributeUpdatedBy; e.AttributeUpdatedAt = c.AttributeUpdatedAt; e.AttributeActive = c.AttributeActive; e.AttributeDeleted = c.AttributeDeleted; e.IsPropertyNameRemoved = c.IsPropertyNameRemoved; e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved; e.IsPropertyReferenceIdRemoved = c.IsPropertyReferenceIdRemoved; e.IsPropertyVersionRemoved = c.IsPropertyVersionRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.IsPropertyAttributeNameRemoved = c.IsPropertyAttributeNameRemoved; e.IsPropertyAttributeOrganizationIdRemoved = c.IsPropertyAttributeOrganizationIdRemoved; e.IsPropertyAttributeDescriptionRemoved = c.IsPropertyAttributeDescriptionRemoved; e.IsPropertyAttributeIsMandatoryRemoved = c.IsPropertyAttributeIsMandatoryRemoved; e.IsPropertyAttributeIsInstanceAttributeRemoved = c.IsPropertyAttributeIsInstanceAttributeRemoved; e.IsPropertyAttributeAttributeValueTypeRemoved = c.IsPropertyAttributeAttributeValueTypeRemoved; e.IsPropertyAttributeAttributeValueLengthRemoved = c.IsPropertyAttributeAttributeValueLengthRemoved; e.IsPropertyAttributeIsListRemoved = c.IsPropertyAttributeIsListRemoved; e.IsPropertyAttributeFieldNameRemoved = c.IsPropertyAttributeFieldNameRemoved; e.IsPropertyAttributeReferenceIdRemoved = c.IsPropertyAttributeReferenceIdRemoved; e.IsPropertyAttributeCreatedByRemoved = c.IsPropertyAttributeCreatedByRemoved; e.IsPropertyAttributeCreatedAtRemoved = c.IsPropertyAttributeCreatedAtRemoved; e.IsPropertyAttributeUpdatedByRemoved = c.IsPropertyAttributeUpdatedByRemoved; e.IsPropertyAttributeUpdatedAtRemoved = c.IsPropertyAttributeUpdatedAtRemoved; e.IsPropertyAttributeActiveRemoved = c.IsPropertyAttributeActiveRemoved; e.IsPropertyAttributeDeletedRemoved = c.IsPropertyAttributeDeletedRemoved; ReflectUtils.CopyPropertyValue("CommandId", c, e); e.CreatedBy = (string)c.RequesterId; e.CreatedAt = DateTime.Now; var attributeVersion = c.AttributeVersion; return(e); }
protected virtual IAttributeValueMvoStateMergePatched Map(IMergePatchAttributeValueMvo c) { var stateEventId = new AttributeValueMvoEventId(c.AttributeValueId, c.AttributeVersion); IAttributeValueMvoStateMergePatched e = NewAttributeValueMvoStateMergePatched(stateEventId); e.AttributeValueName = c.AttributeValueName; e.Description = c.Description; e.ReferenceId = c.ReferenceId; e.Version = c.Version; e.Active = c.Active; e.AttributeAttributeName = c.AttributeAttributeName; e.AttributeOrganizationId = c.AttributeOrganizationId; e.AttributeDescription = c.AttributeDescription; e.AttributeIsMandatory = c.AttributeIsMandatory; e.AttributeAttributeValueType = c.AttributeAttributeValueType; e.AttributeAttributeValueLength = c.AttributeAttributeValueLength; e.AttributeIsList = c.AttributeIsList; e.AttributeFieldName = c.AttributeFieldName; e.AttributeReferenceId = c.AttributeReferenceId; e.AttributeCreatedBy = c.AttributeCreatedBy; e.AttributeCreatedAt = c.AttributeCreatedAt; e.AttributeUpdatedBy = c.AttributeUpdatedBy; e.AttributeUpdatedAt = c.AttributeUpdatedAt; e.AttributeActive = c.AttributeActive; e.AttributeDeleted = c.AttributeDeleted; e.IsPropertyAttributeValueNameRemoved = c.IsPropertyAttributeValueNameRemoved; e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved; e.IsPropertyReferenceIdRemoved = c.IsPropertyReferenceIdRemoved; e.IsPropertyVersionRemoved = c.IsPropertyVersionRemoved; e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved; e.IsPropertyAttributeAttributeNameRemoved = c.IsPropertyAttributeAttributeNameRemoved; e.IsPropertyAttributeOrganizationIdRemoved = c.IsPropertyAttributeOrganizationIdRemoved; e.IsPropertyAttributeDescriptionRemoved = c.IsPropertyAttributeDescriptionRemoved; e.IsPropertyAttributeIsMandatoryRemoved = c.IsPropertyAttributeIsMandatoryRemoved; e.IsPropertyAttributeAttributeValueTypeRemoved = c.IsPropertyAttributeAttributeValueTypeRemoved; e.IsPropertyAttributeAttributeValueLengthRemoved = c.IsPropertyAttributeAttributeValueLengthRemoved; e.IsPropertyAttributeIsListRemoved = c.IsPropertyAttributeIsListRemoved; e.IsPropertyAttributeFieldNameRemoved = c.IsPropertyAttributeFieldNameRemoved; e.IsPropertyAttributeReferenceIdRemoved = c.IsPropertyAttributeReferenceIdRemoved; e.IsPropertyAttributeCreatedByRemoved = c.IsPropertyAttributeCreatedByRemoved; e.IsPropertyAttributeCreatedAtRemoved = c.IsPropertyAttributeCreatedAtRemoved; e.IsPropertyAttributeUpdatedByRemoved = c.IsPropertyAttributeUpdatedByRemoved; e.IsPropertyAttributeUpdatedAtRemoved = c.IsPropertyAttributeUpdatedAtRemoved; e.IsPropertyAttributeActiveRemoved = c.IsPropertyAttributeActiveRemoved; e.IsPropertyAttributeDeletedRemoved = c.IsPropertyAttributeDeletedRemoved; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var attributeVersion = c.AttributeVersion; return(e); }
public virtual void When(IAttributeValueMvoStateMergePatched 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.ReferenceId == null) { if (e.IsPropertyReferenceIdRemoved) { this.ReferenceId = default(string); } } else { this.ReferenceId = e.ReferenceId; } 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.AttributeName == null) { if (e.IsPropertyAttributeNameRemoved) { this.AttributeName = default(string); } } else { this.AttributeName = e.AttributeName; } if (e.AttributeOrganizationId == null) { if (e.IsPropertyAttributeOrganizationIdRemoved) { this.AttributeOrganizationId = default(string); } } else { this.AttributeOrganizationId = e.AttributeOrganizationId; } if (e.AttributeDescription == null) { if (e.IsPropertyAttributeDescriptionRemoved) { this.AttributeDescription = default(string); } } else { this.AttributeDescription = e.AttributeDescription; } if (e.AttributeIsMandatory == null) { if (e.IsPropertyAttributeIsMandatoryRemoved) { this.AttributeIsMandatory = default(bool); } } else { this.AttributeIsMandatory = (e.AttributeIsMandatory != null && e.AttributeIsMandatory.HasValue) ? e.AttributeIsMandatory.Value : default(bool); } if (e.AttributeIsInstanceAttribute == null) { if (e.IsPropertyAttributeIsInstanceAttributeRemoved) { this.AttributeIsInstanceAttribute = default(bool); } } else { this.AttributeIsInstanceAttribute = (e.AttributeIsInstanceAttribute != null && e.AttributeIsInstanceAttribute.HasValue) ? e.AttributeIsInstanceAttribute.Value : default(bool); } if (e.AttributeAttributeValueType == null) { if (e.IsPropertyAttributeAttributeValueTypeRemoved) { this.AttributeAttributeValueType = default(string); } } else { this.AttributeAttributeValueType = e.AttributeAttributeValueType; } if (e.AttributeAttributeValueLength == null) { if (e.IsPropertyAttributeAttributeValueLengthRemoved) { this.AttributeAttributeValueLength = default(int?); } } else { this.AttributeAttributeValueLength = e.AttributeAttributeValueLength; } if (e.AttributeIsList == null) { if (e.IsPropertyAttributeIsListRemoved) { this.AttributeIsList = default(bool); } } else { this.AttributeIsList = (e.AttributeIsList != null && e.AttributeIsList.HasValue) ? e.AttributeIsList.Value : default(bool); } if (e.AttributeFieldName == null) { if (e.IsPropertyAttributeFieldNameRemoved) { this.AttributeFieldName = default(string); } } else { this.AttributeFieldName = e.AttributeFieldName; } if (e.AttributeReferenceId == null) { if (e.IsPropertyAttributeReferenceIdRemoved) { this.AttributeReferenceId = default(string); } } else { this.AttributeReferenceId = e.AttributeReferenceId; } if (e.AttributeCreatedBy == null) { if (e.IsPropertyAttributeCreatedByRemoved) { this.AttributeCreatedBy = default(string); } } else { this.AttributeCreatedBy = e.AttributeCreatedBy; } if (e.AttributeCreatedAt == null) { if (e.IsPropertyAttributeCreatedAtRemoved) { this.AttributeCreatedAt = default(DateTime); } } else { this.AttributeCreatedAt = (e.AttributeCreatedAt != null && e.AttributeCreatedAt.HasValue) ? e.AttributeCreatedAt.Value : default(DateTime); } if (e.AttributeUpdatedBy == null) { if (e.IsPropertyAttributeUpdatedByRemoved) { this.AttributeUpdatedBy = default(string); } } else { this.AttributeUpdatedBy = e.AttributeUpdatedBy; } if (e.AttributeUpdatedAt == null) { if (e.IsPropertyAttributeUpdatedAtRemoved) { this.AttributeUpdatedAt = default(DateTime); } } else { this.AttributeUpdatedAt = (e.AttributeUpdatedAt != null && e.AttributeUpdatedAt.HasValue) ? e.AttributeUpdatedAt.Value : default(DateTime); } if (e.AttributeActive == null) { if (e.IsPropertyAttributeActiveRemoved) { this.AttributeActive = default(bool); } } else { this.AttributeActive = (e.AttributeActive != null && e.AttributeActive.HasValue) ? e.AttributeActive.Value : default(bool); } if (e.AttributeDeleted == null) { if (e.IsPropertyAttributeDeletedRemoved) { this.AttributeDeleted = default(bool); } } else { this.AttributeDeleted = (e.AttributeDeleted != null && e.AttributeDeleted.HasValue) ? e.AttributeDeleted.Value : default(bool); } this.UpdatedBy = e.CreatedBy; this.UpdatedAt = e.CreatedAt; }
void IAttributeValueMvoState.When(IAttributeValueMvoStateMergePatched e) { throw new NotSupportedException(); }
public virtual AttributeValueMvoStateMergePatchedDto ToAttributeValueMvoStateMergePatchedDto(IAttributeValueMvoStateMergePatched e) { var dto = new AttributeValueMvoStateMergePatchedDto(); dto.StateEventId = new AttributeValueMvoStateEventIdDtoWrapper(e.StateEventId); dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Name = e.Name; dto.Description = e.Description; dto.ReferenceId = e.ReferenceId; dto.Version = e.Version; dto.Active = e.Active; dto.AttributeName = e.AttributeName; dto.AttributeOrganizationId = e.AttributeOrganizationId; dto.AttributeDescription = e.AttributeDescription; dto.AttributeIsMandatory = e.AttributeIsMandatory; dto.AttributeIsInstanceAttribute = e.AttributeIsInstanceAttribute; dto.AttributeAttributeValueType = e.AttributeAttributeValueType; dto.AttributeAttributeValueLength = e.AttributeAttributeValueLength; dto.AttributeIsList = e.AttributeIsList; dto.AttributeFieldName = e.AttributeFieldName; dto.AttributeReferenceId = e.AttributeReferenceId; dto.AttributeCreatedBy = e.AttributeCreatedBy; dto.AttributeCreatedAt = e.AttributeCreatedAt; dto.AttributeUpdatedBy = e.AttributeUpdatedBy; dto.AttributeUpdatedAt = e.AttributeUpdatedAt; dto.AttributeActive = e.AttributeActive; dto.AttributeDeleted = e.AttributeDeleted; dto.IsPropertyNameRemoved = e.IsPropertyNameRemoved; dto.IsPropertyDescriptionRemoved = e.IsPropertyDescriptionRemoved; dto.IsPropertyReferenceIdRemoved = e.IsPropertyReferenceIdRemoved; dto.IsPropertyVersionRemoved = e.IsPropertyVersionRemoved; dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved; dto.IsPropertyAttributeNameRemoved = e.IsPropertyAttributeNameRemoved; dto.IsPropertyAttributeOrganizationIdRemoved = e.IsPropertyAttributeOrganizationIdRemoved; dto.IsPropertyAttributeDescriptionRemoved = e.IsPropertyAttributeDescriptionRemoved; dto.IsPropertyAttributeIsMandatoryRemoved = e.IsPropertyAttributeIsMandatoryRemoved; dto.IsPropertyAttributeIsInstanceAttributeRemoved = e.IsPropertyAttributeIsInstanceAttributeRemoved; dto.IsPropertyAttributeAttributeValueTypeRemoved = e.IsPropertyAttributeAttributeValueTypeRemoved; dto.IsPropertyAttributeAttributeValueLengthRemoved = e.IsPropertyAttributeAttributeValueLengthRemoved; dto.IsPropertyAttributeIsListRemoved = e.IsPropertyAttributeIsListRemoved; dto.IsPropertyAttributeFieldNameRemoved = e.IsPropertyAttributeFieldNameRemoved; dto.IsPropertyAttributeReferenceIdRemoved = e.IsPropertyAttributeReferenceIdRemoved; dto.IsPropertyAttributeCreatedByRemoved = e.IsPropertyAttributeCreatedByRemoved; dto.IsPropertyAttributeCreatedAtRemoved = e.IsPropertyAttributeCreatedAtRemoved; dto.IsPropertyAttributeUpdatedByRemoved = e.IsPropertyAttributeUpdatedByRemoved; dto.IsPropertyAttributeUpdatedAtRemoved = e.IsPropertyAttributeUpdatedAtRemoved; dto.IsPropertyAttributeActiveRemoved = e.IsPropertyAttributeActiveRemoved; dto.IsPropertyAttributeDeletedRemoved = e.IsPropertyAttributeDeletedRemoved; return(dto); }
public virtual void MergePatch(IMergePatchAttributeValueMvo c) { IAttributeValueMvoStateMergePatched e = Map(c); Apply(e); }