Ejemplo n.º 1
0
        protected virtual IAttributeSetStateDeleted Map(IDeleteAttributeSet c)
        {
            var stateEventId            = new AttributeSetStateEventId(c.AttributeSetId, c.Version);
            IAttributeSetStateDeleted e = NewAttributeSetStateDeleted(stateEventId);

            e.CommandId = c.CommandId;


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


            return(e);
        }
Ejemplo n.º 2
0
        protected virtual IAttributeSetStateDeleted Map(IDeleteAttributeSet c)
        {
            var stateEventId            = new AttributeSetEventId(c.AttributeSetId, c.Version);
            IAttributeSetStateDeleted e = NewAttributeSetStateDeleted(stateEventId);

            e.CommandId = c.CommandId;


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


            return(e);
        }
Ejemplo n.º 3
0
        public virtual void When(IAttributeSetStateDeleted e)
        {
            ThrowOnWrongEvent(e);

            this.Deleted   = true;
            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;

            foreach (var innerState in this.AttributeUses)
            {
                this.AttributeUses.Remove(innerState);

                var innerE = e.NewAttributeUseStateRemoved(innerState.AttributeId);
                ((AttributeUseEventBase)innerE).CreatedAt = e.CreatedAt;
                ((AttributeUseEventBase)innerE).CreatedBy = e.CreatedBy;
                innerState.When(innerE);
                //e.AddAttributeUseEvent(innerE);
            }
        }
        public virtual AttributeSetStateDeletedDto ToAttributeSetStateDeletedDto(IAttributeSetStateDeleted e)
        {
            var dto = new AttributeSetStateDeletedDto();

            dto.StateEventId = new AttributeSetStateEventIdDtoWrapper(e.StateEventId);
            dto.CreatedAt    = e.CreatedAt;
            dto.CreatedBy    = e.CreatedBy;
            dto.CommandId    = e.CommandId;
            var attributeUseEvents = new List <AttributeUseStateRemovedDto>();

            foreach (var ee in e.AttributeUseEvents)
            {
                AttributeUseStateRemovedDto eeDto = AttributeUseStateEventDtoConverter.ToAttributeUseStateRemovedDto(ee);
                attributeUseEvents.Add(eeDto);
            }
            dto.AttributeUseEvents = attributeUseEvents.ToArray();


            return(dto);
        }
Ejemplo n.º 5
0
        public virtual void Delete(IDeleteAttributeSet c)
        {
            IAttributeSetStateDeleted e = Map(c);

            Apply(e);
        }
Ejemplo n.º 6
0
 public void AddAttributeSetEvent(IAttributeSetStateDeleted e)
 {
     _innerStateEvents.Add((AttributeSetStateDeletedDto)e);
 }
Ejemplo n.º 7
0
 void IAttributeSetState.When(IAttributeSetStateDeleted e)
 {
     throw new NotSupportedException();
 }