示例#1
0
        public virtual void When(ISellableInventoryItemStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.SellableQuantity == null)
            {
                if (e.IsPropertySellableQuantityRemoved)
                {
                    this.SellableQuantity = default(decimal);
                }
            }
            else
            {
                this.SellableQuantity = (e.SellableQuantity != null && e.SellableQuantity.HasValue) ? e.SellableQuantity.Value : default(decimal);
            }


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


            foreach (ISellableInventoryItemEntryEvent innerEvent in e.SellableInventoryItemEntryEvents)
            {
                ISellableInventoryItemEntryState innerState = this.Entries.Get(innerEvent.GlobalId.EntrySeqId);

                innerState.Mutate(innerEvent);
            }
        }
示例#2
0
        public virtual void When(ISellableInventoryItemStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.SellableQuantity = (e.SellableQuantity != null && e.SellableQuantity.HasValue) ? e.SellableQuantity.Value : default(decimal);

            this.CreatedBy = e.CreatedBy;
            this.CreatedAt = e.CreatedAt;

            foreach (ISellableInventoryItemEntryStateCreated innerEvent in e.SellableInventoryItemEntryEvents)
            {
                ISellableInventoryItemEntryState innerState = this.Entries.Get(innerEvent.GlobalId.EntrySeqId, true);
                innerState.Mutate(innerEvent);
            }
        }