Пример #1
0
        public static void RecalcInbox()
        {
            using (var context = new DataModelDataContext())
            {
                foreach (var d in WF.Sample.Business.Helpers.DocumentHelper.GetAll())
                {
                    Guid id = d.Id;
                    try
                    {
                        if (_runtime.IsProcessExists(id))
                        {
                            _runtime.UpdateSchemeIfObsolete(id);
                            context.DropWorkflowInbox(id);
                            FillInbox(id, context);

                            context.SubmitChanges();
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(string.Format("Unable to calculate the inbox for process Id = {0}", id), ex);
                    }
                }
            }
        }
Пример #2
0
        static void _runtime_ProcessStatusChanged(object sender, ProcessStatusChangedEventArgs e)
        {
            if (e.NewStatus != ProcessStatus.Idled && e.NewStatus != ProcessStatus.Finalized)
            {
                return;
            }

            if (string.IsNullOrEmpty(e.SchemeCode))
            {
                return;
            }

            WorkflowActions.DeleteEmptyPreHistory(e.ProcessId);
            _runtime.PreExecuteFromCurrentActivity(e.ProcessId);

            //Inbox
            using (var context = new DataModelDataContext())
            {
                context.DropWorkflowInbox(e.ProcessId);
                context.SubmitChanges();
            }

            if (e.NewStatus != ProcessStatus.Finalized)
            {
                var d = new Action <ProcessStatusChangedEventArgs>(PreExecuteAndFillInbox);
                d.BeginInvoke(e, FillInboxCallback, null);
            }

            //Change state name
            var nextState = WorkflowInit.Runtime.GetLocalizedStateName(e.ProcessId, e.ProcessInstance.CurrentState);

            using (var context = new DataModelDataContext())
            {
                var document = DocumentHelper.Get(e.ProcessId, context);
                if (document == null)
                {
                    return;
                }

                document.StateName = nextState;
                context.SubmitChanges();
            }
        }
        static void _runtime_ProcessStatusChanged(object sender, ProcessStatusChangedEventArgs e)
        {
            if (e.NewStatus != ProcessStatus.Idled && e.NewStatus != ProcessStatus.Finalized)
                return;

            if (string.IsNullOrEmpty(e.SchemeCode))
                return;

            WorkflowActions.DeleteEmptyPreHistory(e.ProcessId);
            _runtime.PreExecuteFromCurrentActivity(e.ProcessId);

            //Inbox
            using (var context = new DataModelDataContext())
            {
                context.DropWorkflowInbox(e.ProcessId);
                context.SubmitChanges();
            }

            if (e.NewStatus != ProcessStatus.Finalized)
            {
                var d = new Action<ProcessStatusChangedEventArgs>(PreExecuteAndFillInbox);
                d.BeginInvoke(e, FillInboxCallback, null);
            }

            //Change state name
            var nextState = WorkflowInit.Runtime.GetLocalizedStateName(e.ProcessId, e.ProcessInstance.CurrentState);
            using (var context = new DataModelDataContext())
            {
                var document = DocumentHelper.Get(e.ProcessId, context);
                if (document == null)
                    return;

                document.StateName = nextState;
                context.SubmitChanges();
            }
        }
        public static void RecalcInbox()
        {
            using (var context = new DataModelDataContext())
            {
                foreach (var d in WF.Sample.Business.Helpers.DocumentHelper.GetAll())
                {
                    Guid id = d.Id;
                    try
                    {
                        if (_runtime.IsProcessExists(id))
                        {
                            _runtime.UpdateSchemeIfObsolete(id);
                            context.DropWorkflowInbox(id);
                            FillInbox(id, context);

                            context.SubmitChanges();

                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(string.Format("Unable to calculate the inbox for process Id = {0}", id), ex);
                    }

                }
            }
        }