public static int RegisterWait(int nodeID, Guid wfInstanceId, string bookMarkName, string wfContentPath) { try { WriteDebug("**************** RegisterWait: " + wfInstanceId); using (var dbContext = GetDataContext()) { var notification = new WorkflowNotification() { BookmarkName = bookMarkName, NodeId = nodeID, WorkflowInstanceId = wfInstanceId, WorkflowNodePath = wfContentPath }; dbContext.WorkflowNotifications.InsertOnSubmit(notification); dbContext.SubmitChanges(); return(notification.NotificationId); } } catch (Exception e) { WriteError("RegisterWait", e); throw; } }
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; } }
partial void DeleteWorkflowNotification(WorkflowNotification instance);
partial void UpdateWorkflowNotification(WorkflowNotification instance);
partial void InsertWorkflowNotification(WorkflowNotification instance);