protected virtual IPicklistRoleMvoStateCreated Map(ICreatePicklistRoleMvo c) { var stateEventId = new PicklistRoleMvoEventId(c.PicklistRoleId, c.PicklistVersion); IPicklistRoleMvoStateCreated e = NewPicklistRoleMvoStateCreated(stateEventId); e.Version = c.Version; e.Active = c.Active; e.PicklistDescription = c.PicklistDescription; e.PicklistFacilityId = c.PicklistFacilityId; e.PicklistShipmentMethodTypeId = c.PicklistShipmentMethodTypeId; e.PicklistStatusId = c.PicklistStatusId; e.PicklistPicklistDate = c.PicklistPicklistDate; e.PicklistPickwaveId = c.PicklistPickwaveId; e.PicklistCreatedBy = c.PicklistCreatedBy; e.PicklistCreatedAt = c.PicklistCreatedAt; e.PicklistUpdatedBy = c.PicklistUpdatedBy; e.PicklistUpdatedAt = c.PicklistUpdatedAt; e.PicklistActive = c.PicklistActive; e.PicklistDeleted = c.PicklistDeleted; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var picklistVersion = c.PicklistVersion; return(e); }
public virtual void Initialize(IPicklistRoleMvoStateCreated stateCreated) { var aggregateId = stateCreated.PicklistRoleMvoEventId.PicklistRoleId; var state = new PicklistRoleMvoState(); state.PicklistRoleId = aggregateId; var aggregate = (PicklistRoleMvoAggregate)GetPicklistRoleMvoAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual void When(IPicklistRoleMvoStateCreated e) { ThrowOnWrongEvent(e); this.Version = (e.Version != null && e.Version.HasValue) ? e.Version.Value : default(long); this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.PicklistDescription = e.PicklistDescription; this.PicklistFacilityId = e.PicklistFacilityId; this.PicklistShipmentMethodTypeId = e.PicklistShipmentMethodTypeId; this.PicklistStatusId = e.PicklistStatusId; this.PicklistPicklistDate = e.PicklistPicklistDate; this.PicklistPickwaveId = e.PicklistPickwaveId; this.PicklistCreatedBy = e.PicklistCreatedBy; this.PicklistCreatedAt = (e.PicklistCreatedAt != null && e.PicklistCreatedAt.HasValue) ? e.PicklistCreatedAt.Value : default(DateTime); this.PicklistUpdatedBy = e.PicklistUpdatedBy; this.PicklistUpdatedAt = (e.PicklistUpdatedAt != null && e.PicklistUpdatedAt.HasValue) ? e.PicklistUpdatedAt.Value : default(DateTime); this.PicklistActive = (e.PicklistActive != null && e.PicklistActive.HasValue) ? e.PicklistActive.Value : default(bool); this.PicklistDeleted = (e.PicklistDeleted != null && e.PicklistDeleted.HasValue) ? e.PicklistDeleted.Value : default(bool); this.Deleted = false; this.CreatedByUserLogin = e.CreatedBy; this.CreatedAt = e.CreatedAt; }
void IPicklistRoleMvoState.When(IPicklistRoleMvoStateCreated e) { throw new NotSupportedException(); }
public virtual void Create(ICreatePicklistRoleMvo c) { IPicklistRoleMvoStateCreated e = Map(c); Apply(e); }
public virtual PicklistRoleMvoStateCreatedDto ToPicklistRoleMvoStateCreatedDto(IPicklistRoleMvoStateCreated e) { var dto = new PicklistRoleMvoStateCreatedDto(); dto.PicklistRoleMvoEventId = e.PicklistRoleMvoEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedByUserLogin = e.CreatedBy; dto.CommandId = e.CommandId; dto.Version = e.Version; dto.Active = e.Active; dto.PicklistDescription = e.PicklistDescription; dto.PicklistFacilityId = e.PicklistFacilityId; dto.PicklistShipmentMethodTypeId = e.PicklistShipmentMethodTypeId; dto.PicklistStatusId = e.PicklistStatusId; dto.PicklistPicklistDate = e.PicklistPicklistDate; dto.PicklistPickwaveId = e.PicklistPickwaveId; dto.PicklistCreatedBy = e.PicklistCreatedBy; dto.PicklistCreatedAt = e.PicklistCreatedAt; dto.PicklistUpdatedBy = e.PicklistUpdatedBy; dto.PicklistUpdatedAt = e.PicklistUpdatedAt; dto.PicklistActive = e.PicklistActive; dto.PicklistDeleted = e.PicklistDeleted; return(dto); }