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);
        }
Ejemplo n.º 2
0
        public virtual ISupplierProductState ToSupplierProductState()
        {
            var state = new SupplierProductState(true);

            state.SupplierProductId         = this.SupplierProductId;
            state.AvailableThruDate         = this.AvailableThruDate;
            state.SupplierPrefOrderId       = this.SupplierPrefOrderId;
            state.SupplierRatingTypeId      = this.SupplierRatingTypeId;
            state.StandardLeadTimeDays      = this.StandardLeadTimeDays;
            state.ManufacturingLeadTimeDays = this.ManufacturingLeadTimeDays;
            state.DeliveryLeadTimeDays      = this.DeliveryLeadTimeDays;
            state.QuantityUomId             = this.QuantityUomId;
            state.LastPrice           = this.LastPrice;
            state.ShippingPrice       = this.ShippingPrice;
            state.ExternalProductName = this.ExternalProductName;
            state.ExternalProductId   = this.ExternalProductId;
            if (this.CanDropShip != null && this.CanDropShip.HasValue)
            {
                state.CanDropShip = this.CanDropShip.Value;
            }
            state.Comments = this.Comments;
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
Ejemplo n.º 3
0
 public static CreateSupplierProduct ToCreateSupplierProduct(this SupplierProductState state)
 {
     return(state.ToCreateSupplierProduct <CreateSupplierProduct>());
 }
Ejemplo n.º 4
0
 public static MergePatchSupplierProduct ToMergePatchSupplierProduct(this SupplierProductState state)
 {
     return(state.ToMergePatchSupplierProduct <MergePatchSupplierProduct>());
 }
Ejemplo n.º 5
0
 public static DeleteSupplierProduct ToDeleteSupplierProduct(this SupplierProductState state)
 {
     return(state.ToDeleteSupplierProduct <DeleteSupplierProduct>());
 }
Ejemplo n.º 6
0
 public static ISupplierProductCommand ToCreateOrMergePatchSupplierProduct(this SupplierProductState state)
 {
     return(state.ToCreateOrMergePatchSupplierProduct <CreateSupplierProduct, MergePatchSupplierProduct>());
 }