Exemple #1
0
 public virtual void Save()
 {
     foreach (IPhysicalInventoryLineState s in this.LoadedPhysicalInventoryLineStates)
     {
         PhysicalInventoryLineStateDao.Save(s);
     }
     foreach (IPhysicalInventoryLineState s in this._removedPhysicalInventoryLineStates.Values)
     {
         PhysicalInventoryLineStateDao.Delete(s);
     }
 }
Exemple #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);
            }
        }