public virtual void Initialize(IShipmentReceiptMvoStateCreated stateCreated)
        {
            var aggregateId = stateCreated.ShipmentReceiptMvoEventId.ShipmentReceiptId;
            var state       = new ShipmentReceiptMvoState();

            state.ShipmentReceiptId = aggregateId;
            var aggregate = (ShipmentReceiptMvoAggregate)GetShipmentReceiptMvoAggregate(state);

            var eventStoreAggregateId = ToEventStoreAggregateId(aggregateId);

            aggregate.Apply(stateCreated);
            Persist(eventStoreAggregateId, aggregate, state);
        }
 void IShipmentReceiptMvoState.When(IShipmentReceiptMvoStateCreated e)
 {
     throw new NotSupportedException();
 }
        public virtual ShipmentReceiptMvoStateCreatedDto ToShipmentReceiptMvoStateCreatedDto(IShipmentReceiptMvoStateCreated e)
        {
            var dto = new ShipmentReceiptMvoStateCreatedDto();

            dto.ShipmentReceiptMvoEventId = e.ShipmentReceiptMvoEventId;
            dto.CreatedAt = e.CreatedAt;
            dto.CreatedBy = e.CreatedBy;
            dto.CommandId = e.CommandId;
            dto.ProductId = e.ProductId;
            dto.AttributeSetInstanceId = e.AttributeSetInstanceId;
            dto.LocatorId            = e.LocatorId;
            dto.ShipmentItemSeqId    = e.ShipmentItemSeqId;
            dto.ShipmentPackageSeqId = e.ShipmentPackageSeqId;
            dto.OrderId                            = e.OrderId;
            dto.OrderItemSeqId                     = e.OrderItemSeqId;
            dto.ReturnId                           = e.ReturnId;
            dto.ReturnItemSeqId                    = e.ReturnItemSeqId;
            dto.RejectionReasonId                  = e.RejectionReasonId;
            dto.DamageStatusId                     = e.DamageStatusId;
            dto.DamageReasonId                     = e.DamageReasonId;
            dto.ReceivedBy                         = e.ReceivedBy;
            dto.DatetimeReceived                   = e.DatetimeReceived;
            dto.ItemDescription                    = e.ItemDescription;
            dto.AcceptedQuantity                   = e.AcceptedQuantity;
            dto.RejectedQuantity                   = e.RejectedQuantity;
            dto.DamagedQuantity                    = e.DamagedQuantity;
            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);
        }
示例#4
0
        public virtual void When(IShipmentReceiptMvoStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.ProductId = e.ProductId;

            this.AttributeSetInstanceId = e.AttributeSetInstanceId;

            this.LocatorId = e.LocatorId;

            this.ShipmentItemSeqId = e.ShipmentItemSeqId;

            this.ShipmentPackageSeqId = e.ShipmentPackageSeqId;

            this.OrderId = e.OrderId;

            this.OrderItemSeqId = e.OrderItemSeqId;

            this.ReturnId = e.ReturnId;

            this.ReturnItemSeqId = e.ReturnItemSeqId;

            this.RejectionReasonId = e.RejectionReasonId;

            this.DamageStatusId = e.DamageStatusId;

            this.DamageReasonId = e.DamageReasonId;

            this.ReceivedBy = e.ReceivedBy;

            this.DatetimeReceived = e.DatetimeReceived;

            this.ItemDescription = e.ItemDescription;

            this.AcceptedQuantity = e.AcceptedQuantity;

            this.RejectedQuantity = e.RejectedQuantity;

            this.DamagedQuantity = e.DamagedQuantity;

            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;
        }
        protected virtual IShipmentReceiptMvoStateCreated Map(ICreateShipmentReceiptMvo c)
        {
			var stateEventId = new ShipmentReceiptMvoEventId(c.ShipmentReceiptId, c.ShipmentVersion);
            IShipmentReceiptMvoStateCreated e = NewShipmentReceiptMvoStateCreated(stateEventId);
		
            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.LocatorId = c.LocatorId;
            e.ShipmentItemSeqId = c.ShipmentItemSeqId;
            e.ShipmentPackageSeqId = c.ShipmentPackageSeqId;
            e.OrderId = c.OrderId;
            e.OrderItemSeqId = c.OrderItemSeqId;
            e.ReturnId = c.ReturnId;
            e.ReturnItemSeqId = c.ReturnItemSeqId;
            e.RejectionReasonId = c.RejectionReasonId;
            e.DamageStatusId = c.DamageStatusId;
            e.DamageReasonId = c.DamageReasonId;
            e.ReceivedBy = c.ReceivedBy;
            e.DatetimeReceived = c.DatetimeReceived;
            e.ItemDescription = c.ItemDescription;
            e.AcceptedQuantity = c.AcceptedQuantity;
            e.RejectedQuantity = c.RejectedQuantity;
            e.DamagedQuantity = c.DamagedQuantity;
            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;
        }
 public virtual void Create(ICreateShipmentReceiptMvo c)
 {
     IShipmentReceiptMvoStateCreated e = Map(c);
     Apply(e);
 }