Esempio n. 1
0
 public static void FireNotification(WorkflowNotification notification, WorkflowNotificationEventArgs eventArgs)
 {
     try
     {
         var wfInstance = Node.Load <WorkflowHandlerBase>(notification.WorkflowNodePath);
         var wfApp      = CreateWorkflowApplication(wfInstance, WorkflowApplicationCreationPurpose.Resume, null);
         wfApp.Load(notification.WorkflowInstanceId);
         //wfApp.ResumeBookmark(notification.BookmarkName, notification.NodeId);
         if (ValidWakedUpWorkflow(wfApp))
         {
             Debug.WriteLine(String.Format("##WF> FireNotification: ResumeBookmark: {0}|{1}", notification.NodeId, notification.WorkflowInstanceId));
             wfApp.ResumeBookmark(notification.BookmarkName, eventArgs);
         }
         else
         {
             Debug.WriteLine(String.Format("##WF> FireNotification: Cancel: {0}|{1}", notification.NodeId, notification.WorkflowInstanceId));
             wfApp.Cancel();
         }
     }
     catch (Exception e)
     {
         WriteError("FireNotification", e);
         throw;
     }
 }
Esempio n. 2
0
 public static void NotifyContentChanged(WorkflowNotificationEventArgs eventArgs)
 {
     WorkflowNotification[] notifications = null;
     using (var dbContext = GetDataContext())
     {
         notifications = dbContext.WorkflowNotifications.Where(notification =>
                                                               notification.NodeId == eventArgs.NodeId).ToArray();
     }
     foreach (var notification in notifications)
     {
         InstanceManager.FireNotification(notification, eventArgs);
     }
 }
Esempio n. 3
0
        public static void FireNotification(WorkflowNotification notification, WorkflowNotificationEventArgs eventArgs)
        {
            var wfInstance = Node.Load <WorkflowHandlerBase>(notification.WorkflowNodePath);
            var wfApp      = CreateWorkflowApplication(wfInstance, WorkflowApplicationCreationPurpose.Resume, null);

            wfApp.Load(notification.WorkflowInstanceId);
            //wfApp.ResumeBookmark(notification.BookmarkName, notification.NodeId);
            if (ValidWakedUpWorkflow(wfApp))
            {
                wfApp.ResumeBookmark(notification.BookmarkName, eventArgs);
                Debug.WriteLine("##WF> FireNotification: EXECUTING");
            }
            else
            {
                wfApp.Abort();
                Debug.WriteLine("##WF> FireNotification: ABORT from FireNotification");
            }
        }
Esempio n. 4
0
        public static void NotifyContentChanged(WorkflowNotificationEventArgs eventArgs)
        {
            try
            {
                WorkflowNotification[] notifications = null;
                using (var dbContext = GetDataContext())
                {
                    notifications = dbContext.WorkflowNotifications.Where(notification =>
                                                                          notification.NodeId == eventArgs.NodeId).ToArray();
                }

                //Debug.WriteLine(String.Format("##WF> NotifyContentChanged: Loaded notifications {0}: {1}", notifications.Length, String.Join(", ", notifications.Select(n => n.NodeId + "|" + n.WorkflowInstanceId))));

                foreach (var notification in notifications)
                {
                    InstanceManager.FireNotification(notification, eventArgs);
                }
            }
            catch (Exception e)
            {
                WriteError("NotifyContentChanged", e);
                throw;
            }
        }