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

            PhysicalInventoryLineId other = obj as PhysicalInventoryLineId;

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

            return(true &&
                   Object.Equals(this.PhysicalInventoryDocumentNumber, other.PhysicalInventoryDocumentNumber) &&
                   Object.Equals(this.InventoryItemId, other.InventoryItemId)
                   );
        }
Beispiel #2
0
        public virtual IPhysicalInventoryLineState Get(InventoryItemId inventoryItemId, bool forCreation, bool nullAllowed)
        {
            PhysicalInventoryLineId globalId = new PhysicalInventoryLineId(_physicalInventoryState.DocumentNumber, inventoryItemId);

            if (_loadedPhysicalInventoryLineStates.ContainsKey(globalId))
            {
                var state = _loadedPhysicalInventoryLineStates[globalId];
                if (this._physicalInventoryState != null && this._physicalInventoryState.ReadOnly == false)
                {
                    ((IPhysicalInventoryLineState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new PhysicalInventoryLineState(ForReapplying);
                state.PhysicalInventoryLineId = globalId;
                _loadedPhysicalInventoryLineStates.Add(globalId, state);
                if (this._physicalInventoryState != null && this._physicalInventoryState.ReadOnly == false)
                {
                    ((IPhysicalInventoryLineState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = PhysicalInventoryLineStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedPhysicalInventoryLineStates.Add(globalId, state);
                }
                if (this._physicalInventoryState != null && this._physicalInventoryState.ReadOnly == false)
                {
                    ((IPhysicalInventoryLineState)state).ReadOnly = false;
                }
                return(state);
            }
        }