Esempio n. 1
0
        protected virtual IAttributeStateCreated Map(ICreateAttribute c)
        {
            var stateEventId         = new AttributeStateEventId(c.AttributeId, c.Version);
            IAttributeStateCreated e = NewAttributeStateCreated(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;
            ReflectUtils.CopyPropertyValue("CommandId", c, e);


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

            foreach (ICreateAttributeValue innerCommand in c.AttributeValues)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IAttributeValueStateCreated innerEvent = MapCreate(innerCommand, c, version, _state);
                e.AddAttributeValueEvent(innerEvent);
            }


            return(e);
        }
Esempio n. 2
0
        protected AttributeStateDeleted NewAttributeStateDeleted(string commandId, string requesterId)
        {
            var stateEventId = new AttributeStateEventId(_state.AttributeId, ((IAttributeStateProperties)_state).Version);
            var e            = NewAttributeStateDeleted(stateEventId);

            e.CommandId = commandId;

            e.CreatedBy = (string)requesterId;
            e.CreatedAt = DateTime.Now;

            return(e);
        }
Esempio n. 3
0
        protected virtual IAttributeStateDeleted Map(IDeleteAttribute c)
        {
            var stateEventId         = new AttributeStateEventId(c.AttributeId, c.Version);
            IAttributeStateDeleted e = NewAttributeStateDeleted(stateEventId);

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


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


            return(e);
        }
Esempio n. 4
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            AttributeStateEventId other = obj as AttributeStateEventId;

            if (other == null)
            {
                return(false);
            }

            return(true &&
                   Object.Equals(this.AttributeId, other.AttributeId) &&
                   Object.Equals(this.Version, other.Version)
                   );
        }
Esempio n. 5
0
 public AttributeStateDeleted(AttributeStateEventId stateEventId) : base(stateEventId)
 {
 }
Esempio n. 6
0
 public AttributeStateMergePatched(AttributeStateEventId stateEventId) : base(stateEventId)
 {
 }
Esempio n. 7
0
 public AttributeStateCreated(AttributeStateEventId stateEventId) : base(stateEventId)
 {
 }
Esempio n. 8
0
 protected AttributeStateEventBase(AttributeStateEventId stateEventId)
 {
     this.StateEventId = stateEventId;
 }
 public AttributeStateEventIdFlattenedDto(AttributeStateEventId val)
 {
     this._value = val;
 }
Esempio n. 10
0
 private AttributeStateDeleted NewAttributeStateDeleted(AttributeStateEventId stateEventId)
 {
     return(new AttributeStateDeleted(stateEventId));
 }
Esempio n. 11
0
 private AttributeStateMergePatched NewAttributeStateMergePatched(AttributeStateEventId stateEventId)
 {
     return(new AttributeStateMergePatched(stateEventId));
 }