public ExecuteTransitionResult Execute(ExecuteTransitionCommand transitionCommand)
        {
            preExecute(transitionCommand);
            string currentUserFullName = transitionCommand.CurrentUser.GetFullName();

            transitionCommand.Report.ChangeStatus(transitionCommand.CurrentUser, transitionCommand.CurrentDate, GetBeginStatus(), GetEndStatus());

            string loweredTransitionVerb = TransitionVerbPastTense.ToLower();
            string reportNumber          = transitionCommand.Report.Number;
            string message      = string.Format("You have {0} work order {1}", loweredTransitionVerb, reportNumber);
            string debugMessage = string.Format("{0} has {1} work order {2}", currentUserFullName, loweredTransitionVerb,
                                                reportNumber);

            return(new ExecuteTransitionResult {
                NewStatus = GetEndStatus().FriendlyName
                , NextStep = NextStep.Edit, Action = debugMessage, Message = message
            });
        }
Exemplo n.º 2
0
        public void Execute(IStateCommandVisitor commandVisitor)
        {
//            Log.Info(this, "Executing");
            preExecute(commandVisitor);
            string currentUserFullName = _currentUser.GetFullName();

            _expenseReport.ChangeStatus(_currentUser, DateTime.Now, GetEndStatus());

            commandVisitor.Save(_expenseReport);

            string loweredTransitionVerb = TransitionVerbPastTense.ToLower();
            string reportNumber          = _expenseReport.Number;
            string message = string.Format("You have {0} work order {1}", loweredTransitionVerb, reportNumber);

            commandVisitor.SendMessage(message);
            string debugMessage = string.Format("{0} has {1} work order {2}", currentUserFullName, loweredTransitionVerb,
                                                reportNumber);

//            Log.Debug(this, debugMessage);
            postExecute(commandVisitor);

//            Log.Info(this, "Executed");
        }