public virtual void When(IAttributeAliasStateCreated e) { ThrowOnWrongEvent(e); this.Name = e.Name; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; }
public virtual AttributeAliasStateCreatedDto ToAttributeAliasStateCreatedDto(IAttributeAliasStateCreated e) { var dto = new AttributeAliasStateCreatedDto(); dto.AttributeAliasEventId = e.AttributeAliasEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.Version = e.Version; dto.CommandId = e.CommandId; dto.Name = e.Name; dto.Active = e.Active; return(dto); }
protected virtual IAttributeAliasStateCreated MapCreate(ICreateAttributeAlias c, IAttributeCommand outerCommand, long version, IAttributeState outerState) { c.RequesterId = outerCommand.RequesterId; var stateEventId = new AttributeAliasEventId(c.AttributeId, c.Code, version); IAttributeAliasStateCreated e = NewAttributeAliasStateCreated(stateEventId); var s = outerState.Aliases.Get(c.Code, true); e.Name = c.Name; e.Active = c.Active; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); return(e); }// END Map(ICreate... ////////////////////////////
protected virtual IAttributeStateCreated Map(ICreateAttribute c) { var stateEventId = new AttributeEventId(c.AttributeId, c.Version); IAttributeStateCreated e = NewAttributeStateCreated(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.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; foreach (ICreateAttributeValue innerCommand in c.AttributeValues) { ThrowOnInconsistentCommands(c, innerCommand); IAttributeValueStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddAttributeValueEvent(innerEvent); } foreach (ICreateAttributeAlias innerCommand in c.Aliases) { ThrowOnInconsistentCommands(c, innerCommand); IAttributeAliasStateCreated innerEvent = MapCreate(innerCommand, c, version, _state); e.AddAttributeAliasEvent(innerEvent); } return(e); }
void IAttributeAliasState.When(IAttributeAliasStateCreated e) { throw new NotSupportedException(); }
public virtual void AddAttributeAliasEvent(IAttributeAliasStateCreated e) { ThrowOnInconsistentEventIds(e); this._attributeAliasEvents[e.AttributeAliasEventId] = e; }
void IAttributeStateCreated.AddAttributeAliasEvent(IAttributeAliasStateCreated e) { this._attributeAliasEvents.AddAttributeAliasEvent(e); }