public override Duration GetDuration()
        {
            EnsureOperationIsLoadedIfExists();
            Duration operationDuration = GetDurationOfOperation();
            Duration transitionTime    =
                new Duration(TransitionTimer.CalculateTransitionTime(operationDuration));

            return(transitionTime.Plus(operationDuration));
        }
        public DueTime GetStartTimeBackward()
        {
            if (_productionOrderOperation.StartBackward == null)
            {
                return(null);
            }

            DueTime transitionTime =
                new DueTime(TransitionTimer.CalculateTransitionTime(GetDuration()));
            DueTime startTimeOfOperation =
                new DueTime(_productionOrderOperation.StartBackward.GetValueOrDefault());
            DueTime startTime = startTimeOfOperation.Minus(transitionTime);

            return(startTime);
        }
        public void SetStartTimeBackward(DueTime startTime)
        {
            if (_productionOrderOperation.IsReadOnly)
            {
                throw new MrpRunException("A readOnly entity cannot be changed anymore.");
            }

            DueTime transitionTime =
                new DueTime(TransitionTimer.CalculateTransitionTime(GetDuration()));
            // startBackwards
            DueTime startTimeOfOperation = startTime.Plus(transitionTime);

            _productionOrderOperation.StartBackward = startTimeOfOperation.GetValue();
            // endBackwards
            _productionOrderOperation.EndBackward =
                startTimeOfOperation.GetValue() + GetDuration().GetValue();
        }