Esempio n. 1
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IShipmentItemStateMergePatched MapMergePatch(IMergePatchShipmentItem c, IShipmentCommand outerCommand, long version, IShipmentState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentItemEventId(c.ShipmentId, c.ShipmentItemSeqId, version);
            IShipmentItemStateMergePatched e = NewShipmentItemStateMergePatched(stateEventId);
            var s = outerState.ShipmentItems.Get(c.ShipmentItemSeqId);

            e.ProductId = c.ProductId;
            e.AttributeSetInstanceId = c.AttributeSetInstanceId;
            e.Quantity = c.Quantity;
            e.ShipmentContentDescription = c.ShipmentContentDescription;
            e.Active = c.Active;
            e.IsPropertyProductIdRemoved = c.IsPropertyProductIdRemoved;
            e.IsPropertyAttributeSetInstanceIdRemoved = c.IsPropertyAttributeSetInstanceIdRemoved;
            e.IsPropertyQuantityRemoved = c.IsPropertyQuantityRemoved;
            e.IsPropertyShipmentContentDescriptionRemoved = c.IsPropertyShipmentContentDescriptionRemoved;
            e.IsPropertyActiveRemoved = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
Esempio n. 2
0
        public virtual ShipmentItemStateMergePatchedDto ToShipmentItemStateMergePatchedDto(IShipmentItemStateMergePatched e)
        {
            var dto = new ShipmentItemStateMergePatchedDto();

            dto.ShipmentItemEventId        = e.ShipmentItemEventId;
            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.Quantity                   = e.Quantity;
            dto.ShipmentContentDescription = e.ShipmentContentDescription;
            dto.Active = e.Active;
            dto.IsPropertyProductIdRemoved = e.IsPropertyProductIdRemoved;
            dto.IsPropertyAttributeSetInstanceIdRemoved = e.IsPropertyAttributeSetInstanceIdRemoved;
            dto.IsPropertyQuantityRemoved = e.IsPropertyQuantityRemoved;
            dto.IsPropertyShipmentContentDescriptionRemoved = e.IsPropertyShipmentContentDescriptionRemoved;
            dto.IsPropertyActiveRemoved = e.IsPropertyActiveRemoved;

            return(dto);
        }
 void IShipmentItemState.When(IShipmentItemStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Esempio n. 4
0
        public virtual void When(IShipmentItemStateMergePatched 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.Quantity == null)
            {
                if (e.IsPropertyQuantityRemoved)
                {
                    this.Quantity = default(decimal?);
                }
            }
            else
            {
                this.Quantity = e.Quantity;
            }

            if (e.ShipmentContentDescription == null)
            {
                if (e.IsPropertyShipmentContentDescriptionRemoved)
                {
                    this.ShipmentContentDescription = default(string);
                }
            }
            else
            {
                this.ShipmentContentDescription = e.ShipmentContentDescription;
            }

            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;
        }