Esempio n. 1
0
        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj))
            {
                return(true);
            }

            InventoryItemEntryId other = obj as InventoryItemEntryId;

            if (other == null)
            {
                return(false);
            }

            return(true &&
                   Object.Equals(this.InventoryItemId, other.InventoryItemId) &&
                   Object.Equals(this.EntrySeqId, other.EntrySeqId)
                   );
        }
Esempio n. 2
0
        public virtual IInventoryItemEntryState Get(long entrySeqId, bool forCreation, bool nullAllowed)
        {
            InventoryItemEntryId globalId = new InventoryItemEntryId(_inventoryItemState.InventoryItemId, entrySeqId);

            if (_loadedInventoryItemEntryStates.ContainsKey(globalId))
            {
                var state = _loadedInventoryItemEntryStates[globalId];
                if (this._inventoryItemState != null && this._inventoryItemState.ReadOnly == false)
                {
                    ((IInventoryItemEntryState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new InventoryItemEntryState(ForReapplying);
                state.InventoryItemEntryId = globalId;
                _loadedInventoryItemEntryStates.Add(globalId, state);
                if (this._inventoryItemState != null && this._inventoryItemState.ReadOnly == false)
                {
                    ((IInventoryItemEntryState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = InventoryItemEntryStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedInventoryItemEntryStates.Add(globalId, state);
                }
                if (this._inventoryItemState != null && this._inventoryItemState.ReadOnly == false)
                {
                    ((IInventoryItemEntryState)state).ReadOnly = false;
                }
                return(state);
            }
        }