예제 #1
0
        public virtual void Initialize(IShipmentItemMvoStateCreated stateCreated)
        {
            var aggregateId = stateCreated.ShipmentItemMvoEventId.ShipmentItemId;
            var state       = new ShipmentItemMvoState();

            state.ShipmentItemId = aggregateId;
            var aggregate = (ShipmentItemMvoAggregate)GetShipmentItemMvoAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
예제 #2
0
        protected virtual IShipmentItemMvoStateCreated Map(ICreateShipmentItemMvo c)
        {
            var stateEventId = new ShipmentItemMvoEventId(c.ShipmentItemId, c.ShipmentVersion);
            IShipmentItemMvoStateCreated e = NewShipmentItemMvoStateCreated(stateEventId);

            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.Quantity = c.Quantity;
            e.ShipmentContentDescription = c.ShipmentContentDescription;
            e.Version = c.Version;
            e.Active  = c.Active;
            e.ShipmentShipmentTypeId             = c.ShipmentShipmentTypeId;
            e.ShipmentStatusId                   = c.ShipmentStatusId;
            e.ShipmentPrimaryOrderId             = c.ShipmentPrimaryOrderId;
            e.ShipmentPrimaryReturnId            = c.ShipmentPrimaryReturnId;
            e.ShipmentPrimaryShipGroupSeqId      = c.ShipmentPrimaryShipGroupSeqId;
            e.ShipmentPicklistBinId              = c.ShipmentPicklistBinId;
            e.ShipmentEstimatedReadyDate         = c.ShipmentEstimatedReadyDate;
            e.ShipmentEstimatedShipDate          = c.ShipmentEstimatedShipDate;
            e.ShipmentEstimatedShipWorkEffId     = c.ShipmentEstimatedShipWorkEffId;
            e.ShipmentEstimatedArrivalDate       = c.ShipmentEstimatedArrivalDate;
            e.ShipmentEstimatedArrivalWorkEffId  = c.ShipmentEstimatedArrivalWorkEffId;
            e.ShipmentLatestCancelDate           = c.ShipmentLatestCancelDate;
            e.ShipmentEstimatedShipCost          = c.ShipmentEstimatedShipCost;
            e.ShipmentCurrencyUomId              = c.ShipmentCurrencyUomId;
            e.ShipmentHandlingInstructions       = c.ShipmentHandlingInstructions;
            e.ShipmentOriginFacilityId           = c.ShipmentOriginFacilityId;
            e.ShipmentDestinationFacilityId      = c.ShipmentDestinationFacilityId;
            e.ShipmentOriginContactMechId        = c.ShipmentOriginContactMechId;
            e.ShipmentOriginTelecomNumberId      = c.ShipmentOriginTelecomNumberId;
            e.ShipmentDestinationContactMechId   = c.ShipmentDestinationContactMechId;
            e.ShipmentDestinationTelecomNumberId = c.ShipmentDestinationTelecomNumberId;
            e.ShipmentPartyIdTo                  = c.ShipmentPartyIdTo;
            e.ShipmentPartyIdFrom                = c.ShipmentPartyIdFrom;
            e.ShipmentAdditionalShippingCharge   = c.ShipmentAdditionalShippingCharge;
            e.ShipmentAddtlShippingChargeDesc    = c.ShipmentAddtlShippingChargeDesc;
            e.ShipmentCreatedBy                  = c.ShipmentCreatedBy;
            e.ShipmentCreatedAt                  = c.ShipmentCreatedAt;
            e.ShipmentUpdatedBy                  = c.ShipmentUpdatedBy;
            e.ShipmentUpdatedAt                  = c.ShipmentUpdatedAt;
            e.ShipmentActive = c.ShipmentActive;
            e.CommandId      = c.CommandId;


            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            var shipmentVersion = c.ShipmentVersion;


            return(e);
        }
예제 #3
0
 void IShipmentItemMvoState.When(IShipmentItemMvoStateCreated e)
 {
     throw new NotSupportedException();
 }
예제 #4
0
        public virtual void When(IShipmentItemMvoStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.ProductId = e.ProductId;

            this.AttributeSetInstanceId = e.AttributeSetInstanceId;

            this.Quantity = e.Quantity;

            this.ShipmentContentDescription = e.ShipmentContentDescription;

            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.ShipmentShipmentTypeId = e.ShipmentShipmentTypeId;

            this.ShipmentStatusId = e.ShipmentStatusId;

            this.ShipmentPrimaryOrderId = e.ShipmentPrimaryOrderId;

            this.ShipmentPrimaryReturnId = e.ShipmentPrimaryReturnId;

            this.ShipmentPrimaryShipGroupSeqId = e.ShipmentPrimaryShipGroupSeqId;

            this.ShipmentPicklistBinId = e.ShipmentPicklistBinId;

            this.ShipmentEstimatedReadyDate = e.ShipmentEstimatedReadyDate;

            this.ShipmentEstimatedShipDate = e.ShipmentEstimatedShipDate;

            this.ShipmentEstimatedShipWorkEffId = e.ShipmentEstimatedShipWorkEffId;

            this.ShipmentEstimatedArrivalDate = e.ShipmentEstimatedArrivalDate;

            this.ShipmentEstimatedArrivalWorkEffId = e.ShipmentEstimatedArrivalWorkEffId;

            this.ShipmentLatestCancelDate = e.ShipmentLatestCancelDate;

            this.ShipmentEstimatedShipCost = e.ShipmentEstimatedShipCost;

            this.ShipmentCurrencyUomId = e.ShipmentCurrencyUomId;

            this.ShipmentHandlingInstructions = e.ShipmentHandlingInstructions;

            this.ShipmentOriginFacilityId = e.ShipmentOriginFacilityId;

            this.ShipmentDestinationFacilityId = e.ShipmentDestinationFacilityId;

            this.ShipmentOriginContactMechId = e.ShipmentOriginContactMechId;

            this.ShipmentOriginTelecomNumberId = e.ShipmentOriginTelecomNumberId;

            this.ShipmentDestinationContactMechId = e.ShipmentDestinationContactMechId;

            this.ShipmentDestinationTelecomNumberId = e.ShipmentDestinationTelecomNumberId;

            this.ShipmentPartyIdTo = e.ShipmentPartyIdTo;

            this.ShipmentPartyIdFrom = e.ShipmentPartyIdFrom;

            this.ShipmentAdditionalShippingCharge = e.ShipmentAdditionalShippingCharge;

            this.ShipmentAddtlShippingChargeDesc = e.ShipmentAddtlShippingChargeDesc;

            this.ShipmentCreatedBy = e.ShipmentCreatedBy;

            this.ShipmentCreatedAt = (e.ShipmentCreatedAt != null && e.ShipmentCreatedAt.HasValue) ? e.ShipmentCreatedAt.Value : default(DateTime);

            this.ShipmentUpdatedBy = e.ShipmentUpdatedBy;

            this.ShipmentUpdatedAt = (e.ShipmentUpdatedAt != null && e.ShipmentUpdatedAt.HasValue) ? e.ShipmentUpdatedAt.Value : default(DateTime);

            this.ShipmentActive = (e.ShipmentActive != null && e.ShipmentActive.HasValue) ? e.ShipmentActive.Value : default(bool);

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;
        }
예제 #5
0
        public virtual void Create(ICreateShipmentItemMvo c)
        {
            IShipmentItemMvoStateCreated e = Map(c);

            Apply(e);
        }
        public virtual ShipmentItemMvoStateCreatedDto ToShipmentItemMvoStateCreatedDto(IShipmentItemMvoStateCreated e)
        {
            var dto = new ShipmentItemMvoStateCreatedDto();

            dto.ShipmentItemMvoEventId = e.ShipmentItemMvoEventId;
            dto.CreatedAt = e.CreatedAt;
            dto.CreatedBy = e.CreatedBy;
            dto.CommandId = e.CommandId;
            dto.ProductId = e.ProductId;
            dto.AttributeSetInstanceId = e.AttributeSetInstanceId;
            dto.Quantity = e.Quantity;
            dto.ShipmentContentDescription = e.ShipmentContentDescription;
            dto.Version = e.Version;
            dto.Active  = e.Active;
            dto.ShipmentShipmentTypeId             = e.ShipmentShipmentTypeId;
            dto.ShipmentStatusId                   = e.ShipmentStatusId;
            dto.ShipmentPrimaryOrderId             = e.ShipmentPrimaryOrderId;
            dto.ShipmentPrimaryReturnId            = e.ShipmentPrimaryReturnId;
            dto.ShipmentPrimaryShipGroupSeqId      = e.ShipmentPrimaryShipGroupSeqId;
            dto.ShipmentPicklistBinId              = e.ShipmentPicklistBinId;
            dto.ShipmentEstimatedReadyDate         = e.ShipmentEstimatedReadyDate;
            dto.ShipmentEstimatedShipDate          = e.ShipmentEstimatedShipDate;
            dto.ShipmentEstimatedShipWorkEffId     = e.ShipmentEstimatedShipWorkEffId;
            dto.ShipmentEstimatedArrivalDate       = e.ShipmentEstimatedArrivalDate;
            dto.ShipmentEstimatedArrivalWorkEffId  = e.ShipmentEstimatedArrivalWorkEffId;
            dto.ShipmentLatestCancelDate           = e.ShipmentLatestCancelDate;
            dto.ShipmentEstimatedShipCost          = e.ShipmentEstimatedShipCost;
            dto.ShipmentCurrencyUomId              = e.ShipmentCurrencyUomId;
            dto.ShipmentHandlingInstructions       = e.ShipmentHandlingInstructions;
            dto.ShipmentOriginFacilityId           = e.ShipmentOriginFacilityId;
            dto.ShipmentDestinationFacilityId      = e.ShipmentDestinationFacilityId;
            dto.ShipmentOriginContactMechId        = e.ShipmentOriginContactMechId;
            dto.ShipmentOriginTelecomNumberId      = e.ShipmentOriginTelecomNumberId;
            dto.ShipmentDestinationContactMechId   = e.ShipmentDestinationContactMechId;
            dto.ShipmentDestinationTelecomNumberId = e.ShipmentDestinationTelecomNumberId;
            dto.ShipmentPartyIdTo                  = e.ShipmentPartyIdTo;
            dto.ShipmentPartyIdFrom                = e.ShipmentPartyIdFrom;
            dto.ShipmentAdditionalShippingCharge   = e.ShipmentAdditionalShippingCharge;
            dto.ShipmentAddtlShippingChargeDesc    = e.ShipmentAddtlShippingChargeDesc;
            dto.ShipmentCreatedBy                  = e.ShipmentCreatedBy;
            dto.ShipmentCreatedAt                  = e.ShipmentCreatedAt;
            dto.ShipmentUpdatedBy                  = e.ShipmentUpdatedBy;
            dto.ShipmentUpdatedAt                  = e.ShipmentUpdatedAt;
            dto.ShipmentActive = e.ShipmentActive;
            return(dto);
        }