Ejemplo n.º 1
0
        public HttpResponseMessage Approve(NotificationDTO postData)
        {
            try
            {
                var notification = NotificationsController.Instance.GetNotification(postData.NotificationId);
                if (notification != null)
                {
                    if (string.IsNullOrEmpty(notification.Context))
                    {
                        return(Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" }));
                    }

                    string[] parameters = notification.Context.Split(':');

                    var stateTransiction = new StateTransaction
                    {
                        ContentItemId  = int.Parse(parameters[0]),
                        CurrentStateId = int.Parse(parameters[2]),
                        Message        = new StateTransactionMessage(),
                        UserId         = UserInfo.UserID
                    };
                    _workflowEngine.CompleteState(stateTransiction);

                    return(Request.CreateResponse(HttpStatusCode.OK, new { Result = "success" }));
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }

            return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "unable to process notification"));
        }
Ejemplo n.º 2
0
        public void CompleteState(ContentItem contentItem, string comment)
        {
            StateTransaction stateTransaction = new StateTransaction
            {
                ContentItemId  = contentItem.ContentItemId,
                CurrentStateId = contentItem.StateID,

                Message = new StateTransactionMessage
                {
                    UserComment = comment
                },
                UserId = _userController.GetCurrentUserInfo().UserID
            };

            _workflowEngine.CompleteState(stateTransaction);
        }