Beispiel #1
0
        public virtual void When(IAttributeValueStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.AttributeValueName == null)
            {
                if (e.IsPropertyAttributeValueNameRemoved)
                {
                    this.AttributeValueName = default(string);
                }
            }
            else
            {
                this.AttributeValueName = e.AttributeValueName;
            }

            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.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;
        }
Beispiel #2
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IAttributeValueStateMergePatched MapMergePatch(IMergePatchAttributeValue c, IAttributeCommand outerCommand, long version, IAttributeState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new AttributeValueStateEventId(c.AttributeId, c.Value, version);
            IAttributeValueStateMergePatched e = NewAttributeValueStateMergePatched(stateEventId);
            var s = outerState.AttributeValues.Get(c.Value);

            e.Name                         = c.Name;
            e.Description                  = c.Description;
            e.ReferenceId                  = c.ReferenceId;
            e.Active                       = c.Active;
            e.IsPropertyNameRemoved        = c.IsPropertyNameRemoved;
            e.IsPropertyDescriptionRemoved = c.IsPropertyDescriptionRemoved;
            e.IsPropertyReferenceIdRemoved = c.IsPropertyReferenceIdRemoved;
            e.IsPropertyActiveRemoved      = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = DateTime.Now;
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Beispiel #3
0
 void IAttributeValueState.When(IAttributeValueStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Beispiel #4
0
        public virtual AttributeValueStateMergePatchedDto ToAttributeValueStateMergePatchedDto(IAttributeValueStateMergePatched e)
        {
            var dto = new AttributeValueStateMergePatchedDto();

            dto.AttributeValueEventId = e.AttributeValueEventId;
            dto.CreatedAt             = e.CreatedAt;
            dto.CreatedBy             = e.CreatedBy;
            dto.Version            = e.Version;
            dto.CommandId          = e.CommandId;
            dto.AttributeValueName = e.AttributeValueName;
            dto.Description        = e.Description;
            dto.ReferenceId        = e.ReferenceId;
            dto.Active             = e.Active;
            dto.IsPropertyAttributeValueNameRemoved = e.IsPropertyAttributeValueNameRemoved;
            dto.IsPropertyDescriptionRemoved        = e.IsPropertyDescriptionRemoved;
            dto.IsPropertyReferenceIdRemoved        = e.IsPropertyReferenceIdRemoved;
            dto.IsPropertyActiveRemoved             = e.IsPropertyActiveRemoved;

            return(dto);
        }