public virtual void When(IShipmentPackageContentStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.Quantity == null)
            {
                if (e.IsPropertyQuantityRemoved)
                {
                    this.Quantity = default(decimal?);
                }
            }
            else
            {
                this.Quantity = e.Quantity;
            }

            if (e.SubProductId == null)
            {
                if (e.IsPropertySubProductIdRemoved)
                {
                    this.SubProductId = default(string);
                }
            }
            else
            {
                this.SubProductId = e.SubProductId;
            }

            if (e.SubProductQuantity == null)
            {
                if (e.IsPropertySubProductQuantityRemoved)
                {
                    this.SubProductQuantity = default(decimal?);
                }
            }
            else
            {
                this.SubProductQuantity = e.SubProductQuantity;
            }

            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;
        }
Esempio n. 2
0
        }// END Map(ICreate... ////////////////////////////

        protected virtual IShipmentPackageContentStateMergePatched MapMergePatch(IMergePatchShipmentPackageContent c, IShipmentPackageCommand outerCommand, long version, IShipmentPackageState outerState)
        {
            c.RequesterId = outerCommand.RequesterId;
            var stateEventId = new ShipmentPackageContentEventId(c.ShipmentPackageId, c.ShipmentItemSeqId, version);
            IShipmentPackageContentStateMergePatched e = NewShipmentPackageContentStateMergePatched(stateEventId);
            var s = outerState.ShipmentPackageContents.Get(c.ShipmentItemSeqId);

            e.Quantity                            = c.Quantity;
            e.SubProductId                        = c.SubProductId;
            e.SubProductQuantity                  = c.SubProductQuantity;
            e.Active                              = c.Active;
            e.IsPropertyQuantityRemoved           = c.IsPropertyQuantityRemoved;
            e.IsPropertySubProductIdRemoved       = c.IsPropertySubProductIdRemoved;
            e.IsPropertySubProductQuantityRemoved = c.IsPropertySubProductQuantityRemoved;
            e.IsPropertyActiveRemoved             = c.IsPropertyActiveRemoved;

            e.CreatedBy = (string)c.RequesterId;
            e.CreatedAt = ApplicationContext.Current.TimestampService.Now <DateTime>();
            return(e);
        }// END Map(IMergePatch... ////////////////////////////
 void IShipmentPackageContentState.When(IShipmentPackageContentStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Esempio n. 4
0
        public virtual ShipmentPackageContentStateMergePatchedDto ToShipmentPackageContentStateMergePatchedDto(IShipmentPackageContentStateMergePatched e)
        {
            var dto = new ShipmentPackageContentStateMergePatchedDto();

            dto.ShipmentPackageContentEventId = e.ShipmentPackageContentEventId;
            dto.CreatedAt                           = e.CreatedAt;
            dto.CreatedBy                           = e.CreatedBy;
            dto.Version                             = e.Version;
            dto.CommandId                           = e.CommandId;
            dto.Quantity                            = e.Quantity;
            dto.SubProductId                        = e.SubProductId;
            dto.SubProductQuantity                  = e.SubProductQuantity;
            dto.Active                              = e.Active;
            dto.IsPropertyQuantityRemoved           = e.IsPropertyQuantityRemoved;
            dto.IsPropertySubProductIdRemoved       = e.IsPropertySubProductIdRemoved;
            dto.IsPropertySubProductQuantityRemoved = e.IsPropertySubProductQuantityRemoved;
            dto.IsPropertyActiveRemoved             = e.IsPropertyActiveRemoved;

            return(dto);
        }