Example #1
0
        protected virtual IAttributeUseMvoStateMergePatched Map(IMergePatchAttributeUseMvo c)
        {
            var stateEventId = new AttributeUseMvoStateEventId(c.AttributeSetAttributeUseId, c.AttributeSetVersion);
            IAttributeUseMvoStateMergePatched e = NewAttributeUseMvoStateMergePatched(stateEventId);

            e.SequenceNumber                                       = c.SequenceNumber;
            e.Version                                              = c.Version;
            e.Active                                               = c.Active;
            e.AttributeSetName                                     = c.AttributeSetName;
            e.AttributeSetOrganizationId                           = c.AttributeSetOrganizationId;
            e.AttributeSetDescription                              = c.AttributeSetDescription;
            e.AttributeSetSerialNumberAttributeId                  = c.AttributeSetSerialNumberAttributeId;
            e.AttributeSetLotAttributeId                           = c.AttributeSetLotAttributeId;
            e.AttributeSetReferenceId                              = c.AttributeSetReferenceId;
            e.AttributeSetCreatedBy                                = c.AttributeSetCreatedBy;
            e.AttributeSetCreatedAt                                = c.AttributeSetCreatedAt;
            e.AttributeSetUpdatedBy                                = c.AttributeSetUpdatedBy;
            e.AttributeSetUpdatedAt                                = c.AttributeSetUpdatedAt;
            e.AttributeSetActive                                   = c.AttributeSetActive;
            e.AttributeSetDeleted                                  = c.AttributeSetDeleted;
            e.IsPropertySequenceNumberRemoved                      = c.IsPropertySequenceNumberRemoved;
            e.IsPropertyVersionRemoved                             = c.IsPropertyVersionRemoved;
            e.IsPropertyActiveRemoved                              = c.IsPropertyActiveRemoved;
            e.IsPropertyAttributeSetNameRemoved                    = c.IsPropertyAttributeSetNameRemoved;
            e.IsPropertyAttributeSetOrganizationIdRemoved          = c.IsPropertyAttributeSetOrganizationIdRemoved;
            e.IsPropertyAttributeSetDescriptionRemoved             = c.IsPropertyAttributeSetDescriptionRemoved;
            e.IsPropertyAttributeSetSerialNumberAttributeIdRemoved = c.IsPropertyAttributeSetSerialNumberAttributeIdRemoved;
            e.IsPropertyAttributeSetLotAttributeIdRemoved          = c.IsPropertyAttributeSetLotAttributeIdRemoved;
            e.IsPropertyAttributeSetReferenceIdRemoved             = c.IsPropertyAttributeSetReferenceIdRemoved;
            e.IsPropertyAttributeSetCreatedByRemoved               = c.IsPropertyAttributeSetCreatedByRemoved;
            e.IsPropertyAttributeSetCreatedAtRemoved               = c.IsPropertyAttributeSetCreatedAtRemoved;
            e.IsPropertyAttributeSetUpdatedByRemoved               = c.IsPropertyAttributeSetUpdatedByRemoved;
            e.IsPropertyAttributeSetUpdatedAtRemoved               = c.IsPropertyAttributeSetUpdatedAtRemoved;
            e.IsPropertyAttributeSetActiveRemoved                  = c.IsPropertyAttributeSetActiveRemoved;
            e.IsPropertyAttributeSetDeletedRemoved                 = c.IsPropertyAttributeSetDeletedRemoved;

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;

            var attributeSetVersion = c.AttributeSetVersion;


            return(e);
        }
Example #2
0
        protected virtual IAttributeUseMvoStateMergePatched Map(IMergePatchAttributeUseMvo c)
        {
            var stateEventId = new AttributeUseMvoEventId(c.AttributeSetAttributeUseId, c.AttributeSetVersion);
            IAttributeUseMvoStateMergePatched e = NewAttributeUseMvoStateMergePatched(stateEventId);

            e.SequenceNumber = c.SequenceNumber;
            e.Version        = c.Version;
            e.Active         = c.Active;
            e.AttributeSetAttributeSetName       = c.AttributeSetAttributeSetName;
            e.AttributeSetOrganizationId         = c.AttributeSetOrganizationId;
            e.AttributeSetDescription            = c.AttributeSetDescription;
            e.AttributeSetReferenceId            = c.AttributeSetReferenceId;
            e.AttributeSetIsInstanceAttributeSet = c.AttributeSetIsInstanceAttributeSet;
            e.AttributeSetIsMandatory            = c.AttributeSetIsMandatory;
            e.AttributeSetCreatedBy           = c.AttributeSetCreatedBy;
            e.AttributeSetCreatedAt           = c.AttributeSetCreatedAt;
            e.AttributeSetUpdatedBy           = c.AttributeSetUpdatedBy;
            e.AttributeSetUpdatedAt           = c.AttributeSetUpdatedAt;
            e.AttributeSetActive              = c.AttributeSetActive;
            e.AttributeSetDeleted             = c.AttributeSetDeleted;
            e.IsPropertySequenceNumberRemoved = c.IsPropertySequenceNumberRemoved;
            e.IsPropertyVersionRemoved        = c.IsPropertyVersionRemoved;
            e.IsPropertyActiveRemoved         = c.IsPropertyActiveRemoved;
            e.IsPropertyAttributeSetAttributeSetNameRemoved       = c.IsPropertyAttributeSetAttributeSetNameRemoved;
            e.IsPropertyAttributeSetOrganizationIdRemoved         = c.IsPropertyAttributeSetOrganizationIdRemoved;
            e.IsPropertyAttributeSetDescriptionRemoved            = c.IsPropertyAttributeSetDescriptionRemoved;
            e.IsPropertyAttributeSetReferenceIdRemoved            = c.IsPropertyAttributeSetReferenceIdRemoved;
            e.IsPropertyAttributeSetIsInstanceAttributeSetRemoved = c.IsPropertyAttributeSetIsInstanceAttributeSetRemoved;
            e.IsPropertyAttributeSetIsMandatoryRemoved            = c.IsPropertyAttributeSetIsMandatoryRemoved;
            e.IsPropertyAttributeSetCreatedByRemoved = c.IsPropertyAttributeSetCreatedByRemoved;
            e.IsPropertyAttributeSetCreatedAtRemoved = c.IsPropertyAttributeSetCreatedAtRemoved;
            e.IsPropertyAttributeSetUpdatedByRemoved = c.IsPropertyAttributeSetUpdatedByRemoved;
            e.IsPropertyAttributeSetUpdatedAtRemoved = c.IsPropertyAttributeSetUpdatedAtRemoved;
            e.IsPropertyAttributeSetActiveRemoved    = c.IsPropertyAttributeSetActiveRemoved;
            e.IsPropertyAttributeSetDeletedRemoved   = c.IsPropertyAttributeSetDeletedRemoved;

            e.CommandId = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();

            var attributeSetVersion = c.AttributeSetVersion;


            return(e);
        }
Example #3
0
        public virtual void When(IAttributeUseMvoStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.SequenceNumber == null)
            {
                if (e.IsPropertySequenceNumberRemoved)
                {
                    this.SequenceNumber = default(int);
                }
            }
            else
            {
                this.SequenceNumber = (e.SequenceNumber != null && e.SequenceNumber.HasValue) ? e.SequenceNumber.Value : default(int);
            }

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

            if (e.AttributeSetOrganizationId == null)
            {
                if (e.IsPropertyAttributeSetOrganizationIdRemoved)
                {
                    this.AttributeSetOrganizationId = default(string);
                }
            }
            else
            {
                this.AttributeSetOrganizationId = e.AttributeSetOrganizationId;
            }

            if (e.AttributeSetDescription == null)
            {
                if (e.IsPropertyAttributeSetDescriptionRemoved)
                {
                    this.AttributeSetDescription = default(string);
                }
            }
            else
            {
                this.AttributeSetDescription = e.AttributeSetDescription;
            }

            if (e.AttributeSetSerialNumberAttributeId == null)
            {
                if (e.IsPropertyAttributeSetSerialNumberAttributeIdRemoved)
                {
                    this.AttributeSetSerialNumberAttributeId = default(string);
                }
            }
            else
            {
                this.AttributeSetSerialNumberAttributeId = e.AttributeSetSerialNumberAttributeId;
            }

            if (e.AttributeSetLotAttributeId == null)
            {
                if (e.IsPropertyAttributeSetLotAttributeIdRemoved)
                {
                    this.AttributeSetLotAttributeId = default(string);
                }
            }
            else
            {
                this.AttributeSetLotAttributeId = e.AttributeSetLotAttributeId;
            }

            if (e.AttributeSetReferenceId == null)
            {
                if (e.IsPropertyAttributeSetReferenceIdRemoved)
                {
                    this.AttributeSetReferenceId = default(string);
                }
            }
            else
            {
                this.AttributeSetReferenceId = e.AttributeSetReferenceId;
            }

            if (e.AttributeSetCreatedBy == null)
            {
                if (e.IsPropertyAttributeSetCreatedByRemoved)
                {
                    this.AttributeSetCreatedBy = default(string);
                }
            }
            else
            {
                this.AttributeSetCreatedBy = e.AttributeSetCreatedBy;
            }

            if (e.AttributeSetCreatedAt == null)
            {
                if (e.IsPropertyAttributeSetCreatedAtRemoved)
                {
                    this.AttributeSetCreatedAt = default(DateTime);
                }
            }
            else
            {
                this.AttributeSetCreatedAt = (e.AttributeSetCreatedAt != null && e.AttributeSetCreatedAt.HasValue) ? e.AttributeSetCreatedAt.Value : default(DateTime);
            }

            if (e.AttributeSetUpdatedBy == null)
            {
                if (e.IsPropertyAttributeSetUpdatedByRemoved)
                {
                    this.AttributeSetUpdatedBy = default(string);
                }
            }
            else
            {
                this.AttributeSetUpdatedBy = e.AttributeSetUpdatedBy;
            }

            if (e.AttributeSetUpdatedAt == null)
            {
                if (e.IsPropertyAttributeSetUpdatedAtRemoved)
                {
                    this.AttributeSetUpdatedAt = default(DateTime);
                }
            }
            else
            {
                this.AttributeSetUpdatedAt = (e.AttributeSetUpdatedAt != null && e.AttributeSetUpdatedAt.HasValue) ? e.AttributeSetUpdatedAt.Value : default(DateTime);
            }

            if (e.AttributeSetActive == null)
            {
                if (e.IsPropertyAttributeSetActiveRemoved)
                {
                    this.AttributeSetActive = default(bool);
                }
            }
            else
            {
                this.AttributeSetActive = (e.AttributeSetActive != null && e.AttributeSetActive.HasValue) ? e.AttributeSetActive.Value : default(bool);
            }

            if (e.AttributeSetDeleted == null)
            {
                if (e.IsPropertyAttributeSetDeletedRemoved)
                {
                    this.AttributeSetDeleted = default(bool);
                }
            }
            else
            {
                this.AttributeSetDeleted = (e.AttributeSetDeleted != null && e.AttributeSetDeleted.HasValue) ? e.AttributeSetDeleted.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;
        }
Example #4
0
        public virtual void MergePatch(IMergePatchAttributeUseMvo c)
        {
            IAttributeUseMvoStateMergePatched e = Map(c);

            Apply(e);
        }
Example #5
0
 void IAttributeUseMvoState.When(IAttributeUseMvoStateMergePatched e)
 {
     throw new NotSupportedException();
 }
        public virtual AttributeUseMvoStateMergePatchedDto ToAttributeUseMvoStateMergePatchedDto(IAttributeUseMvoStateMergePatched e)
        {
            var dto = new AttributeUseMvoStateMergePatchedDto();

            dto.AttributeUseMvoEventId = e.AttributeUseMvoEventId;
            dto.CreatedAt      = e.CreatedAt;
            dto.CreatedBy      = e.CreatedBy;
            dto.CommandId      = e.CommandId;
            dto.SequenceNumber = e.SequenceNumber;
            dto.Version        = e.Version;
            dto.Active         = e.Active;
            dto.AttributeSetAttributeSetName       = e.AttributeSetAttributeSetName;
            dto.AttributeSetOrganizationId         = e.AttributeSetOrganizationId;
            dto.AttributeSetDescription            = e.AttributeSetDescription;
            dto.AttributeSetReferenceId            = e.AttributeSetReferenceId;
            dto.AttributeSetIsInstanceAttributeSet = e.AttributeSetIsInstanceAttributeSet;
            dto.AttributeSetIsMandatory            = e.AttributeSetIsMandatory;
            dto.AttributeSetCreatedBy           = e.AttributeSetCreatedBy;
            dto.AttributeSetCreatedAt           = e.AttributeSetCreatedAt;
            dto.AttributeSetUpdatedBy           = e.AttributeSetUpdatedBy;
            dto.AttributeSetUpdatedAt           = e.AttributeSetUpdatedAt;
            dto.AttributeSetActive              = e.AttributeSetActive;
            dto.AttributeSetDeleted             = e.AttributeSetDeleted;
            dto.IsPropertySequenceNumberRemoved = e.IsPropertySequenceNumberRemoved;
            dto.IsPropertyVersionRemoved        = e.IsPropertyVersionRemoved;
            dto.IsPropertyActiveRemoved         = e.IsPropertyActiveRemoved;
            dto.IsPropertyAttributeSetAttributeSetNameRemoved       = e.IsPropertyAttributeSetAttributeSetNameRemoved;
            dto.IsPropertyAttributeSetOrganizationIdRemoved         = e.IsPropertyAttributeSetOrganizationIdRemoved;
            dto.IsPropertyAttributeSetDescriptionRemoved            = e.IsPropertyAttributeSetDescriptionRemoved;
            dto.IsPropertyAttributeSetReferenceIdRemoved            = e.IsPropertyAttributeSetReferenceIdRemoved;
            dto.IsPropertyAttributeSetIsInstanceAttributeSetRemoved = e.IsPropertyAttributeSetIsInstanceAttributeSetRemoved;
            dto.IsPropertyAttributeSetIsMandatoryRemoved            = e.IsPropertyAttributeSetIsMandatoryRemoved;
            dto.IsPropertyAttributeSetCreatedByRemoved = e.IsPropertyAttributeSetCreatedByRemoved;
            dto.IsPropertyAttributeSetCreatedAtRemoved = e.IsPropertyAttributeSetCreatedAtRemoved;
            dto.IsPropertyAttributeSetUpdatedByRemoved = e.IsPropertyAttributeSetUpdatedByRemoved;
            dto.IsPropertyAttributeSetUpdatedAtRemoved = e.IsPropertyAttributeSetUpdatedAtRemoved;
            dto.IsPropertyAttributeSetActiveRemoved    = e.IsPropertyAttributeSetActiveRemoved;
            dto.IsPropertyAttributeSetDeletedRemoved   = e.IsPropertyAttributeSetDeletedRemoved;

            return(dto);
        }