protected virtual IShipmentPackageContentMvoStateCreated Map(ICreateShipmentPackageContentMvo c) { var stateEventId = new ShipmentPackageContentMvoEventId(c.ShipmentPackageContentId, c.ShipmentPackageVersion); IShipmentPackageContentMvoStateCreated e = NewShipmentPackageContentMvoStateCreated(stateEventId); e.Quantity = c.Quantity; e.SubProductId = c.SubProductId; e.SubProductQuantity = c.SubProductQuantity; e.Version = c.Version; e.Active = c.Active; e.ShipmentPackageShipmentBoxTypeId = c.ShipmentPackageShipmentBoxTypeId; e.ShipmentPackageDateCreated = c.ShipmentPackageDateCreated; e.ShipmentPackageBoxLength = c.ShipmentPackageBoxLength; e.ShipmentPackageBoxHeight = c.ShipmentPackageBoxHeight; e.ShipmentPackageBoxWidth = c.ShipmentPackageBoxWidth; e.ShipmentPackageDimensionUomId = c.ShipmentPackageDimensionUomId; e.ShipmentPackageWeight = c.ShipmentPackageWeight; e.ShipmentPackageWeightUomId = c.ShipmentPackageWeightUomId; e.ShipmentPackageInsuredValue = c.ShipmentPackageInsuredValue; e.ShipmentPackageCreatedBy = c.ShipmentPackageCreatedBy; e.ShipmentPackageCreatedAt = c.ShipmentPackageCreatedAt; e.ShipmentPackageUpdatedBy = c.ShipmentPackageUpdatedBy; e.ShipmentPackageUpdatedAt = c.ShipmentPackageUpdatedAt; e.ShipmentPackageActive = c.ShipmentPackageActive; e.ShipmentPackageDeleted = c.ShipmentPackageDeleted; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var shipmentPackageVersion = c.ShipmentPackageVersion; return(e); }
public virtual void Initialize(IShipmentPackageContentMvoStateCreated stateCreated) { var aggregateId = stateCreated.ShipmentPackageContentMvoEventId.ShipmentPackageContentId; var state = new ShipmentPackageContentMvoState(); state.ShipmentPackageContentId = aggregateId; var aggregate = (ShipmentPackageContentMvoAggregate)GetShipmentPackageContentMvoAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
public virtual void When(IShipmentPackageContentMvoStateCreated e) { ThrowOnWrongEvent(e); this.Quantity = e.Quantity; this.SubProductId = e.SubProductId; this.SubProductQuantity = e.SubProductQuantity; 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.ShipmentPackageShipmentBoxTypeId = e.ShipmentPackageShipmentBoxTypeId; this.ShipmentPackageDateCreated = e.ShipmentPackageDateCreated; this.ShipmentPackageBoxLength = e.ShipmentPackageBoxLength; this.ShipmentPackageBoxHeight = e.ShipmentPackageBoxHeight; this.ShipmentPackageBoxWidth = e.ShipmentPackageBoxWidth; this.ShipmentPackageDimensionUomId = e.ShipmentPackageDimensionUomId; this.ShipmentPackageWeight = e.ShipmentPackageWeight; this.ShipmentPackageWeightUomId = e.ShipmentPackageWeightUomId; this.ShipmentPackageInsuredValue = e.ShipmentPackageInsuredValue; this.ShipmentPackageCreatedBy = e.ShipmentPackageCreatedBy; this.ShipmentPackageCreatedAt = (e.ShipmentPackageCreatedAt != null && e.ShipmentPackageCreatedAt.HasValue) ? e.ShipmentPackageCreatedAt.Value : default(DateTime); this.ShipmentPackageUpdatedBy = e.ShipmentPackageUpdatedBy; this.ShipmentPackageUpdatedAt = (e.ShipmentPackageUpdatedAt != null && e.ShipmentPackageUpdatedAt.HasValue) ? e.ShipmentPackageUpdatedAt.Value : default(DateTime); this.ShipmentPackageActive = (e.ShipmentPackageActive != null && e.ShipmentPackageActive.HasValue) ? e.ShipmentPackageActive.Value : default(bool); this.ShipmentPackageDeleted = (e.ShipmentPackageDeleted != null && e.ShipmentPackageDeleted.HasValue) ? e.ShipmentPackageDeleted.Value : default(bool); this.Deleted = false; this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; }
void IShipmentPackageContentMvoState.When(IShipmentPackageContentMvoStateCreated e) { throw new NotSupportedException(); }
public virtual ShipmentPackageContentMvoStateCreatedDto ToShipmentPackageContentMvoStateCreatedDto(IShipmentPackageContentMvoStateCreated e) { var dto = new ShipmentPackageContentMvoStateCreatedDto(); dto.ShipmentPackageContentMvoEventId = e.ShipmentPackageContentMvoEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.Quantity = e.Quantity; dto.SubProductId = e.SubProductId; dto.SubProductQuantity = e.SubProductQuantity; dto.Version = e.Version; dto.Active = e.Active; dto.ShipmentPackageShipmentBoxTypeId = e.ShipmentPackageShipmentBoxTypeId; dto.ShipmentPackageDateCreated = e.ShipmentPackageDateCreated; dto.ShipmentPackageBoxLength = e.ShipmentPackageBoxLength; dto.ShipmentPackageBoxHeight = e.ShipmentPackageBoxHeight; dto.ShipmentPackageBoxWidth = e.ShipmentPackageBoxWidth; dto.ShipmentPackageDimensionUomId = e.ShipmentPackageDimensionUomId; dto.ShipmentPackageWeight = e.ShipmentPackageWeight; dto.ShipmentPackageWeightUomId = e.ShipmentPackageWeightUomId; dto.ShipmentPackageInsuredValue = e.ShipmentPackageInsuredValue; dto.ShipmentPackageCreatedBy = e.ShipmentPackageCreatedBy; dto.ShipmentPackageCreatedAt = e.ShipmentPackageCreatedAt; dto.ShipmentPackageUpdatedBy = e.ShipmentPackageUpdatedBy; dto.ShipmentPackageUpdatedAt = e.ShipmentPackageUpdatedAt; dto.ShipmentPackageActive = e.ShipmentPackageActive; dto.ShipmentPackageDeleted = e.ShipmentPackageDeleted; return(dto); }
public virtual void Create(ICreateShipmentPackageContentMvo c) { IShipmentPackageContentMvoStateCreated e = Map(c); Apply(e); }