Esempio n. 1
0
 public virtual void Save()
 {
     foreach (IInventoryItemRequirementEntryState s in this.LoadedInventoryItemRequirementEntryStates)
     {
         InventoryItemRequirementEntryStateDao.Save(s);
     }
     foreach (IInventoryItemRequirementEntryState s in this._removedInventoryItemRequirementEntryStates.Values)
     {
         InventoryItemRequirementEntryStateDao.Delete(s);
     }
 }
Esempio n. 2
0
        public virtual IInventoryItemRequirementEntryState Get(long entrySeqId, bool forCreation, bool nullAllowed)
        {
            InventoryItemRequirementEntryId globalId = new InventoryItemRequirementEntryId(_inventoryItemRequirementState.InventoryItemRequirementId, entrySeqId);

            if (_loadedInventoryItemRequirementEntryStates.ContainsKey(globalId))
            {
                var state = _loadedInventoryItemRequirementEntryStates[globalId];
                if (this._inventoryItemRequirementState != null && this._inventoryItemRequirementState.ReadOnly == false)
                {
                    ((IInventoryItemRequirementEntryState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new InventoryItemRequirementEntryState(ForReapplying);
                state.InventoryItemRequirementEntryId = globalId;
                _loadedInventoryItemRequirementEntryStates.Add(globalId, state);
                if (this._inventoryItemRequirementState != null && this._inventoryItemRequirementState.ReadOnly == false)
                {
                    ((IInventoryItemRequirementEntryState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = InventoryItemRequirementEntryStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedInventoryItemRequirementEntryStates.Add(globalId, state);
                }
                if (this._inventoryItemRequirementState != null && this._inventoryItemRequirementState.ReadOnly == false)
                {
                    ((IInventoryItemRequirementEntryState)state).ReadOnly = false;
                }
                return(state);
            }
        }