示例#1
0
        public virtual IMovementLineState ToMovementLineState()
        {
            var state = new MovementLineState(true);

            state.LineNumber = this.LineNumber;
            if (this.MovementQuantity != null && this.MovementQuantity.HasValue)
            {
                state.MovementQuantity = this.MovementQuantity.Value;
            }
            state.ProductId              = this.ProductId;
            state.LocatorIdFrom          = this.LocatorIdFrom;
            state.LocatorIdTo            = this.LocatorIdTo;
            state.AttributeSetInstanceId = this.AttributeSetInstanceId;
            if (this.Processed != null && this.Processed.HasValue)
            {
                state.Processed = this.Processed.Value;
            }
            state.ReversalLineNumber = this.ReversalLineNumber;
            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.MovementDocumentNumber = this.MovementDocumentNumber;
            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 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);
            }
        }
示例#3
0
 public static CreateMovementLine ToCreateMovementLine(this MovementLineState state)
 {
     return(state.ToCreateMovementLine <CreateMovementLine>());
 }
示例#4
0
 public static MergePatchMovementLine ToMergePatchMovementLine(this MovementLineState state)
 {
     return(state.ToMergePatchMovementLine <MergePatchMovementLine>());
 }
示例#5
0
 public static RemoveMovementLine ToRemoveMovementLine(this MovementLineState state)
 {
     return(state.ToRemoveMovementLine <RemoveMovementLine>());
 }
示例#6
0
 public static IMovementLineCommand ToCreateOrMergePatchMovementLine(this MovementLineState state)
 {
     return(state.ToCreateOrMergePatchMovementLine <CreateMovementLine, MergePatchMovementLine>());
 }