Example #1
0
        protected virtual IAttributeStateMergePatched Map(IMergePatchAttribute c)
        {
            var stateEventId = new AttributeEventId(c.AttributeId, c.Version);
            IAttributeStateMergePatched e = NewAttributeStateMergePatched(stateEventId);

            e.AttributeName        = c.AttributeName;
            e.OrganizationId       = c.OrganizationId;
            e.Description          = c.Description;
            e.IsMandatory          = c.IsMandatory;
            e.AttributeValueType   = c.AttributeValueType;
            e.AttributeValueLength = c.AttributeValueLength;
            e.IsList      = c.IsList;
            e.FieldName   = c.FieldName;
            e.ReferenceId = c.ReferenceId;
            e.Active      = c.Active;
            e.IsPropertyAttributeNameRemoved        = c.IsPropertyAttributeNameRemoved;
            e.IsPropertyOrganizationIdRemoved       = c.IsPropertyOrganizationIdRemoved;
            e.IsPropertyDescriptionRemoved          = c.IsPropertyDescriptionRemoved;
            e.IsPropertyIsMandatoryRemoved          = c.IsPropertyIsMandatoryRemoved;
            e.IsPropertyAttributeValueTypeRemoved   = c.IsPropertyAttributeValueTypeRemoved;
            e.IsPropertyAttributeValueLengthRemoved = c.IsPropertyAttributeValueLengthRemoved;
            e.IsPropertyIsListRemoved      = c.IsPropertyIsListRemoved;
            e.IsPropertyFieldNameRemoved   = c.IsPropertyFieldNameRemoved;
            e.IsPropertyReferenceIdRemoved = c.IsPropertyReferenceIdRemoved;
            e.IsPropertyActiveRemoved      = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


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

            var version = c.Version;

            foreach (IAttributeValueCommand innerCommand in c.AttributeValueCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IAttributeValueEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddAttributeValueEvent(innerEvent);
            }

            foreach (IAttributeAliasCommand innerCommand in c.AttributeAliasCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IAttributeAliasEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddAttributeAliasEvent(innerEvent);
            }


            return(e);
        }
Example #2
0
        protected virtual IAttributeStateMergePatched Map(IMergePatchAttribute c)
        {
            var stateEventId = new AttributeStateEventId(c.AttributeId, c.Version);
            IAttributeStateMergePatched e = NewAttributeStateMergePatched(stateEventId);

            e.Name                                  = c.Name;
            e.OrganizationId                        = c.OrganizationId;
            e.Description                           = c.Description;
            e.IsMandatory                           = c.IsMandatory;
            e.IsInstanceAttribute                   = c.IsInstanceAttribute;
            e.AttributeValueType                    = c.AttributeValueType;
            e.AttributeValueLength                  = c.AttributeValueLength;
            e.IsList                                = c.IsList;
            e.FieldName                             = c.FieldName;
            e.ReferenceId                           = c.ReferenceId;
            e.Active                                = c.Active;
            e.IsPropertyNameRemoved                 = c.IsPropertyNameRemoved;
            e.IsPropertyOrganizationIdRemoved       = c.IsPropertyOrganizationIdRemoved;
            e.IsPropertyDescriptionRemoved          = c.IsPropertyDescriptionRemoved;
            e.IsPropertyIsMandatoryRemoved          = c.IsPropertyIsMandatoryRemoved;
            e.IsPropertyIsInstanceAttributeRemoved  = c.IsPropertyIsInstanceAttributeRemoved;
            e.IsPropertyAttributeValueTypeRemoved   = c.IsPropertyAttributeValueTypeRemoved;
            e.IsPropertyAttributeValueLengthRemoved = c.IsPropertyAttributeValueLengthRemoved;
            e.IsPropertyIsListRemoved               = c.IsPropertyIsListRemoved;
            e.IsPropertyFieldNameRemoved            = c.IsPropertyFieldNameRemoved;
            e.IsPropertyReferenceIdRemoved          = c.IsPropertyReferenceIdRemoved;
            e.IsPropertyActiveRemoved               = c.IsPropertyActiveRemoved;

            ReflectUtils.CopyPropertyValue("CommandId", c, e);


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

            var version = c.Version;

            foreach (IAttributeValueCommand innerCommand in c.AttributeValueCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IAttributeValueStateEvent innerEvent = Map(innerCommand, c, version, _state);
                e.AddAttributeValueEvent(innerEvent);
            }


            return(e);
        }
Example #3
0
 public virtual void When(IMergePatchAttribute c)
 {
     Update(c, ar => ar.MergePatch(c));
 }
Example #4
0
 void IAttributeApplicationService.When(IMergePatchAttribute c)
 {
     this.When((MergePatchAttributeDto)c);
 }
Example #5
0
        public virtual void MergePatch(IMergePatchAttribute c)
        {
            IAttributeStateMergePatched e = Map(c);

            Apply(e);
        }