Пример #1
0
 public virtual void Save()
 {
     foreach (IMovementConfirmationLineState s in this.LoadedMovementConfirmationLineStates)
     {
         MovementConfirmationLineStateDao.Save(s);
     }
     foreach (IMovementConfirmationLineState s in this._removedMovementConfirmationLineStates.Values)
     {
         MovementConfirmationLineStateDao.Delete(s);
     }
 }
Пример #2
0
        public virtual IMovementConfirmationLineState Get(string lineNumber, bool forCreation, bool nullAllowed)
        {
            MovementConfirmationLineId globalId = new MovementConfirmationLineId(_movementConfirmationState.DocumentNumber, lineNumber);

            if (_loadedMovementConfirmationLineStates.ContainsKey(globalId))
            {
                var state = _loadedMovementConfirmationLineStates[globalId];
                if (this._movementConfirmationState != null && this._movementConfirmationState.ReadOnly == false)
                {
                    ((IMovementConfirmationLineState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new MovementConfirmationLineState(ForReapplying);
                state.MovementConfirmationLineId = globalId;
                _loadedMovementConfirmationLineStates.Add(globalId, state);
                if (this._movementConfirmationState != null && this._movementConfirmationState.ReadOnly == false)
                {
                    ((IMovementConfirmationLineState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = MovementConfirmationLineStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedMovementConfirmationLineStates.Add(globalId, state);
                }
                if (this._movementConfirmationState != null && this._movementConfirmationState.ReadOnly == false)
                {
                    ((IMovementConfirmationLineState)state).ReadOnly = false;
                }
                return(state);
            }
        }