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

            MovementLineId other = obj as MovementLineId;

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

            return(true &&
                   Object.Equals(this.MovementDocumentNumber, other.MovementDocumentNumber) &&
                   Object.Equals(this.LineNumber, other.LineNumber)
                   );
        }
Beispiel #2
0
        public virtual IMovementLineState Get(string lineNumber, bool forCreation, bool nullAllowed)
        {
            MovementLineId globalId = new MovementLineId(_movementState.DocumentNumber, lineNumber);

            if (_loadedMovementLineStates.ContainsKey(globalId))
            {
                var state = _loadedMovementLineStates[globalId];
                if (this._movementState != null && this._movementState.ReadOnly == false)
                {
                    ((IMovementLineState)state).ReadOnly = false;
                }
                return(state);
            }
            if (forCreation || ForReapplying)
            {
                var state = new MovementLineState(ForReapplying);
                state.MovementLineId = globalId;
                _loadedMovementLineStates.Add(globalId, state);
                if (this._movementState != null && this._movementState.ReadOnly == false)
                {
                    ((IMovementLineState)state).ReadOnly = false;
                }
                return(state);
            }
            else
            {
                var state = MovementLineStateDao.Get(globalId, nullAllowed);
                if (state != null)
                {
                    _loadedMovementLineStates.Add(globalId, state);
                }
                if (this._movementState != null && this._movementState.ReadOnly == false)
                {
                    ((IMovementLineState)state).ReadOnly = false;
                }
                return(state);
            }
        }