예제 #1
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IShipmentReceiptStateMergePatched MapMergePatch(IMergePatchShipmentReceipt c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentReceiptEventId(c.ShipmentId, c.ReceiptSeqId, version);
            IShipmentReceiptStateMergePatched e = NewShipmentReceiptStateMergePatched(stateEventId);
            var s = outerState.ShipmentReceipts.Get(c.ReceiptSeqId);

            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.DamageStatusIds            = c.DamageStatusIds;
            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.Active                     = c.Active;
            e.IsPropertyProductIdRemoved = c.IsPropertyProductIdRemoved;
            e.IsPropertyAttributeSetInstanceIdRemoved = c.IsPropertyAttributeSetInstanceIdRemoved;
            e.IsPropertyLocatorIdRemoved            = c.IsPropertyLocatorIdRemoved;
            e.IsPropertyShipmentItemSeqIdRemoved    = c.IsPropertyShipmentItemSeqIdRemoved;
            e.IsPropertyShipmentPackageSeqIdRemoved = c.IsPropertyShipmentPackageSeqIdRemoved;
            e.IsPropertyOrderIdRemoved           = c.IsPropertyOrderIdRemoved;
            e.IsPropertyOrderItemSeqIdRemoved    = c.IsPropertyOrderItemSeqIdRemoved;
            e.IsPropertyReturnIdRemoved          = c.IsPropertyReturnIdRemoved;
            e.IsPropertyReturnItemSeqIdRemoved   = c.IsPropertyReturnItemSeqIdRemoved;
            e.IsPropertyRejectionReasonIdRemoved = c.IsPropertyRejectionReasonIdRemoved;
            e.IsPropertyDamageStatusIdsRemoved   = c.IsPropertyDamageStatusIdsRemoved;
            e.IsPropertyDamageReasonIdRemoved    = c.IsPropertyDamageReasonIdRemoved;
            e.IsPropertyReceivedByRemoved        = c.IsPropertyReceivedByRemoved;
            e.IsPropertyDatetimeReceivedRemoved  = c.IsPropertyDatetimeReceivedRemoved;
            e.IsPropertyItemDescriptionRemoved   = c.IsPropertyItemDescriptionRemoved;
            e.IsPropertyAcceptedQuantityRemoved  = c.IsPropertyAcceptedQuantityRemoved;
            e.IsPropertyRejectedQuantityRemoved  = c.IsPropertyRejectedQuantityRemoved;
            e.IsPropertyDamagedQuantityRemoved   = c.IsPropertyDamagedQuantityRemoved;
            e.IsPropertyActiveRemoved            = c.IsPropertyActiveRemoved;

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

            foreach (IShipmentReceiptImageCommand innerCommand in c.ShipmentReceiptImageCommands)
            {
                ThrowOnInconsistentCommands(c, innerCommand);

                IShipmentReceiptImageEvent innerEvent = Map(innerCommand, c, version, s);
                e.AddShipmentReceiptImageEvent(innerEvent);
            }

            return(e);
        }// END Map(IMergePatch... ////////////////////////////
예제 #2
0
 void IShipmentReceiptState.When(IShipmentReceiptStateMergePatched e)
 {
     throw new NotSupportedException();
 }
예제 #3
0
        public virtual void When(IShipmentReceiptStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.ProductId == null)
            {
                if (e.IsPropertyProductIdRemoved)
                {
                    this.ProductId = default(string);
                }
            }
            else
            {
                this.ProductId = e.ProductId;
            }

            if (e.AttributeSetInstanceId == null)
            {
                if (e.IsPropertyAttributeSetInstanceIdRemoved)
                {
                    this.AttributeSetInstanceId = default(string);
                }
            }
            else
            {
                this.AttributeSetInstanceId = e.AttributeSetInstanceId;
            }

            if (e.LocatorId == null)
            {
                if (e.IsPropertyLocatorIdRemoved)
                {
                    this.LocatorId = default(string);
                }
            }
            else
            {
                this.LocatorId = e.LocatorId;
            }

            if (e.ShipmentItemSeqId == null)
            {
                if (e.IsPropertyShipmentItemSeqIdRemoved)
                {
                    this.ShipmentItemSeqId = default(string);
                }
            }
            else
            {
                this.ShipmentItemSeqId = e.ShipmentItemSeqId;
            }

            if (e.ShipmentPackageSeqId == null)
            {
                if (e.IsPropertyShipmentPackageSeqIdRemoved)
                {
                    this.ShipmentPackageSeqId = default(string);
                }
            }
            else
            {
                this.ShipmentPackageSeqId = e.ShipmentPackageSeqId;
            }

            if (e.OrderId == null)
            {
                if (e.IsPropertyOrderIdRemoved)
                {
                    this.OrderId = default(string);
                }
            }
            else
            {
                this.OrderId = e.OrderId;
            }

            if (e.OrderItemSeqId == null)
            {
                if (e.IsPropertyOrderItemSeqIdRemoved)
                {
                    this.OrderItemSeqId = default(string);
                }
            }
            else
            {
                this.OrderItemSeqId = e.OrderItemSeqId;
            }

            if (e.ReturnId == null)
            {
                if (e.IsPropertyReturnIdRemoved)
                {
                    this.ReturnId = default(string);
                }
            }
            else
            {
                this.ReturnId = e.ReturnId;
            }

            if (e.ReturnItemSeqId == null)
            {
                if (e.IsPropertyReturnItemSeqIdRemoved)
                {
                    this.ReturnItemSeqId = default(string);
                }
            }
            else
            {
                this.ReturnItemSeqId = e.ReturnItemSeqId;
            }

            if (e.RejectionReasonId == null)
            {
                if (e.IsPropertyRejectionReasonIdRemoved)
                {
                    this.RejectionReasonId = default(string);
                }
            }
            else
            {
                this.RejectionReasonId = e.RejectionReasonId;
            }

            if (e.DamageStatusId == null)
            {
                if (e.IsPropertyDamageStatusIdRemoved)
                {
                    this.DamageStatusId = default(string);
                }
            }
            else
            {
                this.DamageStatusId = e.DamageStatusId;
            }

            if (e.DamageReasonId == null)
            {
                if (e.IsPropertyDamageReasonIdRemoved)
                {
                    this.DamageReasonId = default(string);
                }
            }
            else
            {
                this.DamageReasonId = e.DamageReasonId;
            }

            if (e.ReceivedBy == null)
            {
                if (e.IsPropertyReceivedByRemoved)
                {
                    this.ReceivedBy = default(string);
                }
            }
            else
            {
                this.ReceivedBy = e.ReceivedBy;
            }

            if (e.DatetimeReceived == null)
            {
                if (e.IsPropertyDatetimeReceivedRemoved)
                {
                    this.DatetimeReceived = default(DateTime?);
                }
            }
            else
            {
                this.DatetimeReceived = e.DatetimeReceived;
            }

            if (e.ItemDescription == null)
            {
                if (e.IsPropertyItemDescriptionRemoved)
                {
                    this.ItemDescription = default(string);
                }
            }
            else
            {
                this.ItemDescription = e.ItemDescription;
            }

            if (e.AcceptedQuantity == null)
            {
                if (e.IsPropertyAcceptedQuantityRemoved)
                {
                    this.AcceptedQuantity = default(decimal?);
                }
            }
            else
            {
                this.AcceptedQuantity = e.AcceptedQuantity;
            }

            if (e.RejectedQuantity == null)
            {
                if (e.IsPropertyRejectedQuantityRemoved)
                {
                    this.RejectedQuantity = default(decimal?);
                }
            }
            else
            {
                this.RejectedQuantity = e.RejectedQuantity;
            }

            if (e.DamagedQuantity == null)
            {
                if (e.IsPropertyDamagedQuantityRemoved)
                {
                    this.DamagedQuantity = default(decimal?);
                }
            }
            else
            {
                this.DamagedQuantity = e.DamagedQuantity;
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;
        }
예제 #4
0
        public virtual ShipmentReceiptStateMergePatchedDto ToShipmentReceiptStateMergePatchedDto(IShipmentReceiptStateMergePatched e)
        {
            var dto = new ShipmentReceiptStateMergePatchedDto();

            dto.ShipmentReceiptEventId = e.ShipmentReceiptEventId;
            dto.CreatedAt = e.CreatedAt;
            dto.CreatedBy = e.CreatedBy;
            dto.Version   = e.Version;
            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.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.Active                     = e.Active;
            dto.DamageStatusIds            = e.DamageStatusIds.ToArray();
            dto.IsPropertyProductIdRemoved = e.IsPropertyProductIdRemoved;
            dto.IsPropertyAttributeSetInstanceIdRemoved = e.IsPropertyAttributeSetInstanceIdRemoved;
            dto.IsPropertyLocatorIdRemoved            = e.IsPropertyLocatorIdRemoved;
            dto.IsPropertyShipmentItemSeqIdRemoved    = e.IsPropertyShipmentItemSeqIdRemoved;
            dto.IsPropertyShipmentPackageSeqIdRemoved = e.IsPropertyShipmentPackageSeqIdRemoved;
            dto.IsPropertyOrderIdRemoved           = e.IsPropertyOrderIdRemoved;
            dto.IsPropertyOrderItemSeqIdRemoved    = e.IsPropertyOrderItemSeqIdRemoved;
            dto.IsPropertyReturnIdRemoved          = e.IsPropertyReturnIdRemoved;
            dto.IsPropertyReturnItemSeqIdRemoved   = e.IsPropertyReturnItemSeqIdRemoved;
            dto.IsPropertyRejectionReasonIdRemoved = e.IsPropertyRejectionReasonIdRemoved;
            dto.IsPropertyDamageStatusIdsRemoved   = e.IsPropertyDamageStatusIdsRemoved;
            dto.IsPropertyDamageReasonIdRemoved    = e.IsPropertyDamageReasonIdRemoved;
            dto.IsPropertyReceivedByRemoved        = e.IsPropertyReceivedByRemoved;
            dto.IsPropertyDatetimeReceivedRemoved  = e.IsPropertyDatetimeReceivedRemoved;
            dto.IsPropertyItemDescriptionRemoved   = e.IsPropertyItemDescriptionRemoved;
            dto.IsPropertyAcceptedQuantityRemoved  = e.IsPropertyAcceptedQuantityRemoved;
            dto.IsPropertyRejectedQuantityRemoved  = e.IsPropertyRejectedQuantityRemoved;
            dto.IsPropertyDamagedQuantityRemoved   = e.IsPropertyDamagedQuantityRemoved;
            dto.IsPropertyActiveRemoved            = e.IsPropertyActiveRemoved;
            var shipmentReceiptImageEvents = new List <ShipmentReceiptImageStateCreatedOrMergePatchedOrRemovedDto>();

            foreach (var ee in e.ShipmentReceiptImageEvents)
            {
                ShipmentReceiptImageStateCreatedOrMergePatchedOrRemovedDto eeDto = ShipmentReceiptImageStateEventDtoConverter.ToShipmentReceiptImageStateEventDto(ee);
                shipmentReceiptImageEvents.Add(eeDto);
            }
            dto.ShipmentReceiptImageEvents = shipmentReceiptImageEvents.ToArray();


            return(dto);
        }
예제 #5
0
        public virtual void When(IShipmentReceiptStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.ProductId == null)
            {
                if (e.IsPropertyProductIdRemoved)
                {
                    this.ProductId = default(string);
                }
            }
            else
            {
                this.ProductId = e.ProductId;
            }

            if (e.AttributeSetInstanceId == null)
            {
                if (e.IsPropertyAttributeSetInstanceIdRemoved)
                {
                    this.AttributeSetInstanceId = default(string);
                }
            }
            else
            {
                this.AttributeSetInstanceId = e.AttributeSetInstanceId;
            }

            if (e.LocatorId == null)
            {
                if (e.IsPropertyLocatorIdRemoved)
                {
                    this.LocatorId = default(string);
                }
            }
            else
            {
                this.LocatorId = e.LocatorId;
            }

            if (e.ShipmentItemSeqId == null)
            {
                if (e.IsPropertyShipmentItemSeqIdRemoved)
                {
                    this.ShipmentItemSeqId = default(string);
                }
            }
            else
            {
                this.ShipmentItemSeqId = e.ShipmentItemSeqId;
            }

            if (e.ShipmentPackageSeqId == null)
            {
                if (e.IsPropertyShipmentPackageSeqIdRemoved)
                {
                    this.ShipmentPackageSeqId = default(string);
                }
            }
            else
            {
                this.ShipmentPackageSeqId = e.ShipmentPackageSeqId;
            }

            if (e.OrderId == null)
            {
                if (e.IsPropertyOrderIdRemoved)
                {
                    this.OrderId = default(string);
                }
            }
            else
            {
                this.OrderId = e.OrderId;
            }

            if (e.OrderItemSeqId == null)
            {
                if (e.IsPropertyOrderItemSeqIdRemoved)
                {
                    this.OrderItemSeqId = default(string);
                }
            }
            else
            {
                this.OrderItemSeqId = e.OrderItemSeqId;
            }

            if (e.ReturnId == null)
            {
                if (e.IsPropertyReturnIdRemoved)
                {
                    this.ReturnId = default(string);
                }
            }
            else
            {
                this.ReturnId = e.ReturnId;
            }

            if (e.ReturnItemSeqId == null)
            {
                if (e.IsPropertyReturnItemSeqIdRemoved)
                {
                    this.ReturnItemSeqId = default(string);
                }
            }
            else
            {
                this.ReturnItemSeqId = e.ReturnItemSeqId;
            }

            if (e.RejectionReasonId == null)
            {
                if (e.IsPropertyRejectionReasonIdRemoved)
                {
                    this.RejectionReasonId = default(string);
                }
            }
            else
            {
                this.RejectionReasonId = e.RejectionReasonId;
            }

            if (e.DamageStatusIds == null)
            {
                if (e.IsPropertyDamageStatusIdsRemoved)
                {
                    this.DamageStatusIds = null;
                }
            }
            else
            {
                this.DamageStatusIds = e.DamageStatusIds;
            }

            if (e.DamageReasonId == null)
            {
                if (e.IsPropertyDamageReasonIdRemoved)
                {
                    this.DamageReasonId = default(string);
                }
            }
            else
            {
                this.DamageReasonId = e.DamageReasonId;
            }

            if (e.ReceivedBy == null)
            {
                if (e.IsPropertyReceivedByRemoved)
                {
                    this.ReceivedBy = default(string);
                }
            }
            else
            {
                this.ReceivedBy = e.ReceivedBy;
            }

            if (e.DatetimeReceived == null)
            {
                if (e.IsPropertyDatetimeReceivedRemoved)
                {
                    this.DatetimeReceived = default(DateTime?);
                }
            }
            else
            {
                this.DatetimeReceived = e.DatetimeReceived;
            }

            if (e.ItemDescription == null)
            {
                if (e.IsPropertyItemDescriptionRemoved)
                {
                    this.ItemDescription = default(string);
                }
            }
            else
            {
                this.ItemDescription = e.ItemDescription;
            }

            if (e.AcceptedQuantity == null)
            {
                if (e.IsPropertyAcceptedQuantityRemoved)
                {
                    this.AcceptedQuantity = default(decimal?);
                }
            }
            else
            {
                this.AcceptedQuantity = e.AcceptedQuantity;
            }

            if (e.RejectedQuantity == null)
            {
                if (e.IsPropertyRejectedQuantityRemoved)
                {
                    this.RejectedQuantity = default(decimal?);
                }
            }
            else
            {
                this.RejectedQuantity = e.RejectedQuantity;
            }

            if (e.DamagedQuantity == null)
            {
                if (e.IsPropertyDamagedQuantityRemoved)
                {
                    this.DamagedQuantity = default(decimal?);
                }
            }
            else
            {
                this.DamagedQuantity = e.DamagedQuantity;
            }

            if (e.Active == null)
            {
                if (e.IsPropertyActiveRemoved)
                {
                    this.Active = default(bool);
                }
            }
            else
            {
                this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);
            }


            this.UpdatedBy = e.CreatedBy;
            this.UpdatedAt = e.CreatedAt;


            foreach (IShipmentReceiptImageEvent innerEvent in e.ShipmentReceiptImageEvents)
            {
                IShipmentReceiptImageState innerState = this.ShipmentReceiptImages.Get(innerEvent.GlobalId.SequenceId);

                innerState.Mutate(innerEvent);
                var removed = innerEvent as IShipmentReceiptImageStateRemoved;
                if (removed != null)
                {
                    this.ShipmentReceiptImages.Remove(innerState);
                }
            }
        }
예제 #6
0
        public virtual ShipmentReceiptStateMergePatchedDto ToShipmentReceiptStateMergePatchedDto(IShipmentReceiptStateMergePatched e)
        {
            var dto = new ShipmentReceiptStateMergePatchedDto();

            dto.ShipmentReceiptEventId = e.ShipmentReceiptEventId;
            dto.CreatedAt = e.CreatedAt;
            dto.CreatedBy = e.CreatedBy;
            dto.Version   = e.Version;
            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.Active                     = e.Active;
            dto.IsPropertyProductIdRemoved = e.IsPropertyProductIdRemoved;
            dto.IsPropertyAttributeSetInstanceIdRemoved = e.IsPropertyAttributeSetInstanceIdRemoved;
            dto.IsPropertyLocatorIdRemoved            = e.IsPropertyLocatorIdRemoved;
            dto.IsPropertyShipmentItemSeqIdRemoved    = e.IsPropertyShipmentItemSeqIdRemoved;
            dto.IsPropertyShipmentPackageSeqIdRemoved = e.IsPropertyShipmentPackageSeqIdRemoved;
            dto.IsPropertyOrderIdRemoved           = e.IsPropertyOrderIdRemoved;
            dto.IsPropertyOrderItemSeqIdRemoved    = e.IsPropertyOrderItemSeqIdRemoved;
            dto.IsPropertyReturnIdRemoved          = e.IsPropertyReturnIdRemoved;
            dto.IsPropertyReturnItemSeqIdRemoved   = e.IsPropertyReturnItemSeqIdRemoved;
            dto.IsPropertyRejectionReasonIdRemoved = e.IsPropertyRejectionReasonIdRemoved;
            dto.IsPropertyDamageStatusIdRemoved    = e.IsPropertyDamageStatusIdRemoved;
            dto.IsPropertyDamageReasonIdRemoved    = e.IsPropertyDamageReasonIdRemoved;
            dto.IsPropertyReceivedByRemoved        = e.IsPropertyReceivedByRemoved;
            dto.IsPropertyDatetimeReceivedRemoved  = e.IsPropertyDatetimeReceivedRemoved;
            dto.IsPropertyItemDescriptionRemoved   = e.IsPropertyItemDescriptionRemoved;
            dto.IsPropertyAcceptedQuantityRemoved  = e.IsPropertyAcceptedQuantityRemoved;
            dto.IsPropertyRejectedQuantityRemoved  = e.IsPropertyRejectedQuantityRemoved;
            dto.IsPropertyDamagedQuantityRemoved   = e.IsPropertyDamagedQuantityRemoved;
            dto.IsPropertyActiveRemoved            = e.IsPropertyActiveRemoved;

            return(dto);
        }