Beispiel #1
0
        public virtual void When(IPicklistBinStateCreated e)
        {
            ThrowOnWrongEvent(e);
            this.PicklistId = e.PicklistId;

            this.BinLocationNumber = e.BinLocationNumber;

            this.PrimaryOrderId = e.PrimaryOrderId;

            this.PrimaryShipGroupSeqId = e.PrimaryShipGroupSeqId;

            this.Active = (e.Active != null && e.Active.HasValue) ? e.Active.Value : default(bool);

            this.Deleted = false;

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

            foreach (IPicklistItemStateCreated innerEvent in e.PicklistItemEvents)
            {
                IPicklistItemState innerState = this.PicklistItems.Get(innerEvent.GlobalId.PicklistItemOrderShipGrpInvId, true);
                innerState.Mutate(innerEvent);
            }
        }
Beispiel #2
0
        public virtual void When(IPicklistBinStateMergePatched e)
        {
            ThrowOnWrongEvent(e);

            if (e.PicklistId == null)
            {
                if (e.IsPropertyPicklistIdRemoved)
                {
                    this.PicklistId = default(string);
                }
            }
            else
            {
                this.PicklistId = e.PicklistId;
            }

            if (e.BinLocationNumber == null)
            {
                if (e.IsPropertyBinLocationNumberRemoved)
                {
                    this.BinLocationNumber = default(long?);
                }
            }
            else
            {
                this.BinLocationNumber = e.BinLocationNumber;
            }

            if (e.PrimaryOrderId == null)
            {
                if (e.IsPropertyPrimaryOrderIdRemoved)
                {
                    this.PrimaryOrderId = default(string);
                }
            }
            else
            {
                this.PrimaryOrderId = e.PrimaryOrderId;
            }

            if (e.PrimaryShipGroupSeqId == null)
            {
                if (e.IsPropertyPrimaryShipGroupSeqIdRemoved)
                {
                    this.PrimaryShipGroupSeqId = default(string);
                }
            }
            else
            {
                this.PrimaryShipGroupSeqId = e.PrimaryShipGroupSeqId;
            }

            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 (IPicklistItemEvent innerEvent in e.PicklistItemEvents)
            {
                IPicklistItemState innerState = this.PicklistItems.Get(innerEvent.GlobalId.PicklistItemOrderShipGrpInvId);

                innerState.Mutate(innerEvent);
                var removed = innerEvent as IPicklistItemStateRemoved;
                if (removed != null)
                {
                    this.PicklistItems.Remove(innerState);
                }
            }
        }