Example #1
0
 public virtual void Save()
 {
     foreach (IInOutImageState s in this.LoadedInOutImageStates)
     {
         InOutImageStateDao.Save(s);
     }
     foreach (IInOutImageState s in this._removedInOutImageStates.Values)
     {
         InOutImageStateDao.Delete(s);
     }
 }
Example #2
0
        public virtual IInOutImageState Get(string sequenceId, bool forCreation, bool nullAllowed)
        {
            InOutImageId globalId = new InOutImageId(_inOutState.DocumentNumber, sequenceId);

            if (_loadedInOutImageStates.ContainsKey(globalId))
            {
                var state = _loadedInOutImageStates[globalId];
                if (this._inOutState != null && this._inOutState.ReadOnly == false)
                {
                    ((IInOutImageState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new InOutImageState(ForReapplying);
                state.InOutImageId = globalId;
                _loadedInOutImageStates.Add(globalId, state);
                if (this._inOutState != null && this._inOutState.ReadOnly == false)
                {
                    ((IInOutImageState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = InOutImageStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedInOutImageStates.Add(globalId, state);
                }
                if (this._inOutState != null && this._inOutState.ReadOnly == false)
                {
                    ((IInOutImageState)state).ReadOnly = false;
                }
                return(state);
            }
        }