public virtual IMovementConfirmationLineState ToMovementConfirmationLineState()
        {
            var state = new MovementConfirmationLineState(true);

            state.LineNumber         = this.LineNumber;
            state.MovementLineNumber = this.MovementLineNumber;
            if (this.TargetQuantity != null && this.TargetQuantity.HasValue)
            {
                state.TargetQuantity = this.TargetQuantity.Value;
            }
            if (this.ConfirmedQuantity != null && this.ConfirmedQuantity.HasValue)
            {
                state.ConfirmedQuantity = this.ConfirmedQuantity.Value;
            }
            if (this.DifferenceQuantity != null && this.DifferenceQuantity.HasValue)
            {
                state.DifferenceQuantity = this.DifferenceQuantity.Value;
            }
            if (this.ScrappedQuantity != null && this.ScrappedQuantity.HasValue)
            {
                state.ScrappedQuantity = this.ScrappedQuantity.Value;
            }
            state.Description = this.Description;
            if (this.Processed != null && this.Processed.HasValue)
            {
                state.Processed = this.Processed.Value;
            }
            if (this.Active != null && this.Active.HasValue)
            {
                state.Active = this.Active.Value;
            }
            if (this.Version != null && this.Version.HasValue)
            {
                state.Version = this.Version.Value;
            }
            state.MovementConfirmationDocumentNumber = this.MovementConfirmationDocumentNumber;
            state.CreatedBy = this.CreatedBy;
            if (this.CreatedAt != null && this.CreatedAt.HasValue)
            {
                state.CreatedAt = this.CreatedAt.Value;
            }
            state.UpdatedBy = this.UpdatedBy;
            if (this.UpdatedAt != null && this.UpdatedAt.HasValue)
            {
                state.UpdatedAt = this.UpdatedAt.Value;
            }

            return(state);
        }
Пример #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);
            }
        }
Пример #3
0
 public static CreateMovementConfirmationLine ToCreateMovementConfirmationLine(this MovementConfirmationLineState state)
 {
     return(state.ToCreateMovementConfirmationLine <CreateMovementConfirmationLine>());
 }
Пример #4
0
 public static MergePatchMovementConfirmationLine ToMergePatchMovementConfirmationLine(this MovementConfirmationLineState state)
 {
     return(state.ToMergePatchMovementConfirmationLine <MergePatchMovementConfirmationLine>());
 }
Пример #5
0
 public static RemoveMovementConfirmationLine ToRemoveMovementConfirmationLine(this MovementConfirmationLineState state)
 {
     return(state.ToRemoveMovementConfirmationLine <RemoveMovementConfirmationLine>());
 }
Пример #6
0
 public static IMovementConfirmationLineCommand ToCreateOrMergePatchMovementConfirmationLine(this MovementConfirmationLineState state)
 {
     return(state.ToCreateOrMergePatchMovementConfirmationLine <CreateMovementConfirmationLine, MergePatchMovementConfirmationLine>());
 }