Esempio n. 1
0
        public TxActivity RollbackToPreviousActivity()
        {
            TxActivity originalActivity = this.CurrentActivity;
            TxActivity previousActivity = null;

            if (this.CurrentActivityIndex >= 0)
            {
                this.CurrentActivityIndex--;
                previousActivity = this.CurrentActivity;
            }

            originalActivity.IsNotNull(a => a.Status = TxActivityStatus.RolledBack);
            previousActivity.IsNotNull(a =>
            {
                a.Status    = TxActivityStatus.RollingBack;
                this.Status = TxProcessStatus.RollingBack;
            }).IsNull(() => this.Status = TxProcessStatus.RolledBack);

            return(previousActivity);
        }
Esempio n. 2
0
        /// <summary>
        /// 流转到下一环节
        /// </summary>
        /// <returns></returns>
        public TxActivity MoveToNextActivity()
        {
            TxActivity originalActivity = this.CurrentActivity;
            TxActivity nextActivity     = null;

            if (this.CurrentActivityIndex < this.Activities.Count)
            {
                this.CurrentActivityIndex++;
                nextActivity = this.CurrentActivity;
            }

            originalActivity.IsNotNull(a => a.Status = TxActivityStatus.Completed);
            nextActivity.IsNotNull(a =>
            {
                a.Status    = TxActivityStatus.Running;
                this.Status = TxProcessStatus.Running;
            }).IsNull(() => this.Status = TxProcessStatus.Completed);

            return(nextActivity);
        }