public static TRemovePicklistItem ToRemovePicklistItem <TRemovePicklistItem>(this IPicklistItemState state)
            where TRemovePicklistItem : IRemovePicklistItem, new()
        {
            var cmd = new TRemovePicklistItem();

            cmd.PicklistItemOrderShipGrpInvId = state.PicklistItemOrderShipGrpInvId;
            return(cmd);
        }
        public static TCreatePicklistItem ToCreatePicklistItem <TCreatePicklistItem>(this IPicklistItemState state)
            where TCreatePicklistItem : ICreatePicklistItem, new()
        {
            var cmd = new TCreatePicklistItem();

            cmd.PicklistItemOrderShipGrpInvId = state.PicklistItemOrderShipGrpInvId;
            cmd.ItemStatusId  = state.ItemStatusId;
            cmd.Quantity      = state.Quantity;
            cmd.Active        = ((IPicklistItemStateProperties)state).Active;
            cmd.PicklistBinId = state.PicklistBinId;
            return(cmd);
        }
Beispiel #3
0
        public IPicklistItemState Get(PicklistBinPicklistItemId id, bool nullAllowed)
        {
            IPicklistItemState state = CurrentSession.Get <PicklistItemState>(id);

            if (!nullAllowed && state == null)
            {
                state = new PicklistItemState();
                (state as PicklistItemState).PicklistBinPicklistItemId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IPicklistItemState>(state, new Type[] {  }, _readOnlyPropertyNames));
            }
            return(state);
        }
Beispiel #4
0
        public void Delete(IPicklistItemState state)
        {
            IPicklistItemState s = state;

            if (ReadOnlyProxyGenerator != null)
            {
                s = ReadOnlyProxyGenerator.GetTarget <IPicklistItemState>(state);
            }
            var saveable = s as ISaveable;

            if (saveable != null)
            {
                saveable.Save();
            }
            CurrentSession.Delete(s);
        }
Beispiel #5
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);
            }
        }
 public void AddToSave(IPicklistItemState state)
 {
     throw new NotSupportedException();
 }
        public static TMergePatchPicklistItem ToMergePatchPicklistItem <TMergePatchPicklistItem>(this IPicklistItemState state)
            where TMergePatchPicklistItem : IMergePatchPicklistItem, new()
        {
            var cmd = new TMergePatchPicklistItem();

            cmd.PicklistItemOrderShipGrpInvId = state.PicklistItemOrderShipGrpInvId;
            cmd.ItemStatusId  = state.ItemStatusId;
            cmd.Quantity      = state.Quantity;
            cmd.Active        = ((IPicklistItemStateProperties)state).Active;
            cmd.PicklistBinId = state.PicklistBinId;

            if (state.ItemStatusId == null)
            {
                cmd.IsPropertyItemStatusIdRemoved = true;
            }
            if (state.Quantity == null)
            {
                cmd.IsPropertyQuantityRemoved = true;
            }
            return(cmd);
        }
        public static IPicklistItemCommand ToCreateOrMergePatchPicklistItem <TCreatePicklistItem, TMergePatchPicklistItem>(this IPicklistItemState state)
            where TCreatePicklistItem : ICreatePicklistItem, new()
            where TMergePatchPicklistItem : IMergePatchPicklistItem, new()
        {
            bool bUnsaved = ((IPicklistItemState)state).IsUnsaved;

            if (bUnsaved)
            {
                return(state.ToCreatePicklistItem <TCreatePicklistItem>());
            }
            else
            {
                return(state.ToMergePatchPicklistItem <TMergePatchPicklistItem>());
            }
        }
 public PicklistItemStateDtoWrapper(IPicklistItemState state)
 {
     this._state = state;
 }
 public PicklistItemStateDtoWrapper()
 {
     this._state = new PicklistItemState();
 }
Beispiel #11
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);
                }
            }
        }
Beispiel #12
0
 public virtual void Remove(IPicklistItemState state)
 {
     this._removedPicklistItemStates.Add(state.GlobalId, state);
 }
Beispiel #13
0
 public virtual void AddToSave(IPicklistItemState state)
 {
     this._loadedPicklistItemStates[state.GlobalId] = state;
 }