public virtual void When(ISupplierProductStateCreated e) { ThrowOnWrongEvent(e); this.AvailableThruDate = e.AvailableThruDate; this.SupplierPrefOrderId = e.SupplierPrefOrderId; this.SupplierRatingTypeId = e.SupplierRatingTypeId; this.StandardLeadTimeDays = e.StandardLeadTimeDays; this.ManufacturingLeadTimeDays = e.ManufacturingLeadTimeDays; this.DeliveryLeadTimeDays = e.DeliveryLeadTimeDays; this.QuantityUomId = e.QuantityUomId; this.LastPrice = e.LastPrice; this.ShippingPrice = e.ShippingPrice; this.ExternalProductName = e.ExternalProductName; this.ExternalProductId = e.ExternalProductId; this.CanDropShip = (e.CanDropShip != null && e.CanDropShip.HasValue) ? e.CanDropShip.Value : default(bool); this.Comments = e.Comments; this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool); this.CreatedBy = e.CreatedBy; this.CreatedAt = e.CreatedAt; }
protected virtual ISupplierProductStateCreated Map(ICreateSupplierProduct c) { var stateEventId = new SupplierProductEventId(c.SupplierProductId, c.Version); ISupplierProductStateCreated e = NewSupplierProductStateCreated(stateEventId); e.AvailableThruDate = c.AvailableThruDate; e.SupplierPrefOrderId = c.SupplierPrefOrderId; e.SupplierRatingTypeId = c.SupplierRatingTypeId; e.StandardLeadTimeDays = c.StandardLeadTimeDays; e.ManufacturingLeadTimeDays = c.ManufacturingLeadTimeDays; e.DeliveryLeadTimeDays = c.DeliveryLeadTimeDays; e.QuantityUomId = c.QuantityUomId; e.LastPrice = c.LastPrice; e.ShippingPrice = c.ShippingPrice; e.ExternalProductName = c.ExternalProductName; e.ExternalProductId = c.ExternalProductId; e.CanDropShip = c.CanDropShip; e.Comments = c.Comments; e.Active = c.Active; e.CommandId = c.CommandId; e.CreatedBy = (string)c.RequesterId; e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>(); var version = c.Version; return(e); }
public virtual void Initialize(ISupplierProductStateCreated stateCreated) { var aggregateId = stateCreated.SupplierProductEventId.SupplierProductId; var state = new SupplierProductState(); state.SupplierProductId = aggregateId; var aggregate = (SupplierProductAggregate)GetSupplierProductAggregate(state); var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId); aggregate.Apply(stateCreated); Persist(eventStoreAggregateId, aggregate, state); }
void ISupplierProductState.When(ISupplierProductStateCreated e) { throw new NotSupportedException(); }
public virtual SupplierProductStateCreatedDto ToSupplierProductStateCreatedDto(ISupplierProductStateCreated e) { var dto = new SupplierProductStateCreatedDto(); dto.SupplierProductEventId = e.SupplierProductEventId; dto.CreatedAt = e.CreatedAt; dto.CreatedBy = e.CreatedBy; dto.CommandId = e.CommandId; dto.AvailableThruDate = e.AvailableThruDate; dto.SupplierPrefOrderId = e.SupplierPrefOrderId; dto.SupplierRatingTypeId = e.SupplierRatingTypeId; dto.StandardLeadTimeDays = e.StandardLeadTimeDays; dto.ManufacturingLeadTimeDays = e.ManufacturingLeadTimeDays; dto.DeliveryLeadTimeDays = e.DeliveryLeadTimeDays; dto.QuantityUomId = e.QuantityUomId; dto.LastPrice = e.LastPrice; dto.ShippingPrice = e.ShippingPrice; dto.ExternalProductName = e.ExternalProductName; dto.ExternalProductId = e.ExternalProductId; dto.CanDropShip = e.CanDropShip; dto.Comments = e.Comments; dto.Active = e.Active; return(dto); }
public virtual void Create(ICreateSupplierProduct c) { ISupplierProductStateCreated e = Map(c); Apply(e); }