Exemple #1
0
        /// <summary>
        /// 启动流程,持久化,然后发送执行活动的任务
        /// </summary>
        /// <param name="process"></param>
        public static void StartProcess(SysTaskProcess process)
        {
            process.NullCheck("process");

            process.Status = SysTaskProcessStatus.Running;

            ProcessContext.AffectedProcesses.AddOrReplace(process);

            if (process.Activities.Count == 0)
            {
                process.Status = SysTaskProcessStatus.Completed;
            }

            using (TransactionScope scope = TransactionScopeFactory.Create())
            {
                Persist();

                if (process.Activities.Count > 0)
                {
                    ExecuteSysTaskActivityTask.SendTask(process.Activities[0]);
                }

                scope.Complete();
            }
        }