예제 #1
0
        protected virtual IAttributeAliasMvoStateMergePatched Map(IMergePatchAttributeAliasMvo c)
        {
            var stateEventId = new AttributeAliasMvoEventId(c.AttributeAliasId, c.AttributeVersion);
            IAttributeAliasMvoStateMergePatched e = NewAttributeAliasMvoStateMergePatched(stateEventId);

            e.Name    = c.Name;
            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.IsPropertyNameRemoved    = c.IsPropertyNameRemoved;
            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);
        }
예제 #2
0
        public virtual AttributeAliasMvoStateMergePatchedDto ToAttributeAliasMvoStateMergePatchedDto(IAttributeAliasMvoStateMergePatched e)
        {
            var dto = new AttributeAliasMvoStateMergePatchedDto();

            dto.AttributeAliasMvoEventId = e.AttributeAliasMvoEventId;
            dto.CreatedAt = e.CreatedAt;
            dto.CreatedBy = e.CreatedBy;
            dto.CommandId = e.CommandId;
            dto.Name      = e.Name;
            dto.Version   = e.Version;
            dto.Active    = e.Active;
            dto.AttributeAttributeName        = e.AttributeAttributeName;
            dto.AttributeOrganizationId       = e.AttributeOrganizationId;
            dto.AttributeDescription          = e.AttributeDescription;
            dto.AttributeIsMandatory          = e.AttributeIsMandatory;
            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.IsPropertyVersionRemoved = e.IsPropertyVersionRemoved;
            dto.IsPropertyActiveRemoved  = e.IsPropertyActiveRemoved;
            dto.IsPropertyAttributeAttributeNameRemoved        = e.IsPropertyAttributeAttributeNameRemoved;
            dto.IsPropertyAttributeOrganizationIdRemoved       = e.IsPropertyAttributeOrganizationIdRemoved;
            dto.IsPropertyAttributeDescriptionRemoved          = e.IsPropertyAttributeDescriptionRemoved;
            dto.IsPropertyAttributeIsMandatoryRemoved          = e.IsPropertyAttributeIsMandatoryRemoved;
            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);
        }
예제 #3
0
        public virtual void When(IAttributeAliasMvoStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.Name == null)
            {
                if (e.IsPropertyNameRemoved)
                {
                    this.Name = default(string);
                }
            }
            else
            {
                this.Name = e.Name;
            }

            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.AttributeAttributeName == null)
            {
                if (e.IsPropertyAttributeAttributeNameRemoved)
                {
                    this.AttributeAttributeName = default(string);
                }
            }
            else
            {
                this.AttributeAttributeName = e.AttributeAttributeName;
            }

            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.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 IAttributeAliasMvoState.When(IAttributeAliasMvoStateMergePatched e)
 {
     throw new NotSupportedException();
 }
예제 #5
0
        public virtual void MergePatch(IMergePatchAttributeAliasMvo c)
        {
            IAttributeAliasMvoStateMergePatched e = Map(c);

            Apply(e);
        }