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); }
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); }
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); }
public virtual void Delete(IDeleteAttributeSet c) { IAttributeSetStateDeleted e = Map(c); Apply(e); }
public void AddAttributeSetEvent(IAttributeSetStateDeleted e) { _innerStateEvents.Add((AttributeSetStateDeletedDto)e); }
void IAttributeSetState.When(IAttributeSetStateDeleted e) { throw new NotSupportedException(); }