Пример #1
0
        public virtual void When(IOrderShipmentStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

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

            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;
        }
Пример #2
0
        protected virtual IOrderShipmentStateMergePatched Map(IMergePatchOrderShipment c)
        {
            var stateEventId = new OrderShipmentEventId(c.OrderShipmentId, c.Version);
            IOrderShipmentStateMergePatched e = NewOrderShipmentStateMergePatched(stateEventId);

            e.Quantity = c.Quantity;
            e.Active   = c.Active;
            e.IsPropertyQuantityRemoved = c.IsPropertyQuantityRemoved;
            e.IsPropertyActiveRemoved   = c.IsPropertyActiveRemoved;

            e.CommandId = c.CommandId;


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

            var version = c.Version;


            return(e);
        }
Пример #3
0
        public virtual void MergePatch(IMergePatchOrderShipment c)
        {
            IOrderShipmentStateMergePatched e = Map(c);

            Apply(e);
        }
Пример #4
0
 void IOrderShipmentState.When(IOrderShipmentStateMergePatched e)
 {
     throw new NotSupportedException();
 }
Пример #5
0
        public virtual OrderShipmentStateMergePatchedDto ToOrderShipmentStateMergePatchedDto(IOrderShipmentStateMergePatched e)
        {
            var dto = new OrderShipmentStateMergePatchedDto();

            dto.OrderShipmentEventId = e.OrderShipmentEventId;
            dto.CreatedAt            = e.CreatedAt;
            dto.CreatedBy            = e.CreatedBy;
            dto.CommandId            = e.CommandId;
            dto.Quantity             = e.Quantity;
            dto.Active = e.Active;
            dto.IsPropertyQuantityRemoved = e.IsPropertyQuantityRemoved;
            dto.IsPropertyActiveRemoved   = e.IsPropertyActiveRemoved;

            return(dto);
        }