コード例 #1
0
        private void TrySetupWatcherIdsState(WorkflowContext workflowContext, ActivityContext activityContext)
        {
            if (workflowContext.HasStateFor(activityContext.Record, _stateKey))
            {
                return;
            }

            // It seems that not even arrays are supported to be saved to the state, hence the string
            workflowContext.SetStateFor(activityContext.Record, _stateKey, string.Join(",", CumulatedWatcherIds(workflowContext.Content)));
        }
コード例 #2
0
ファイル: TimerActivity.cs プロジェクト: Zlatinsz/podnebeto
        private bool IsExpired(WorkflowContext workflowContext, ActivityContext activityContext) {
            DateTime started;

            if (!workflowContext.HasStateFor(activityContext.Record, "StartedUtc")) {
                workflowContext.SetStateFor(activityContext.Record, "StartedUtc", started = _clock.UtcNow);
            }
            else {
                started = workflowContext.GetStateFor<DateTime>(activityContext.Record, "StartedUtc");
            }

            var amount = activityContext.GetState<int>("Amount");
            var type = activityContext.GetState<string>("Unity");

            return _clock.UtcNow > When(started, amount, type);
        }
コード例 #3
0
ファイル: TimerActivity.cs プロジェクト: zaieda/Coevery
        private bool IsExpired(WorkflowContext workflowContext, ActivityContext activityContext)
        {
            DateTime started;

            if (!workflowContext.HasStateFor(activityContext.Record, "StartedUtc"))
            {
                workflowContext.SetStateFor(activityContext.Record, "StartedUtc", started = _clock.UtcNow);
            }
            else
            {
                started = workflowContext.GetStateFor <DateTime>(activityContext.Record, "StartedUtc");
            }

            var amount = activityContext.GetState <int>("Amount");
            var type   = activityContext.GetState <string>("Type");

            return(_clock.UtcNow > When(started, amount, type));
        }
コード例 #4
0
ファイル: TimerActivity.cs プロジェクト: anycall/Orchard
        private bool IsExpired(WorkflowContext workflowContext, ActivityContext activityContext) {
            DateTime started;

            if (!workflowContext.HasStateFor(activityContext.Record, "StartedUtc")) {
                var dateString = activityContext.GetState<string>("Date");
                var date = _dateServices.ConvertFromLocalizedString(dateString);
                started = date ?? _clock.UtcNow;

                workflowContext.SetStateFor(activityContext.Record, "StartedUtc", started);
            }
            else {
                started = workflowContext.GetStateFor<DateTime>(activityContext.Record, "StartedUtc");
            }

            var amount = activityContext.GetState<int>("Amount");
            var type = activityContext.GetState<string>("Unity");

            return _clock.UtcNow > When(started, amount, type);
        }
コード例 #5
0
        private bool IsExpired(WorkflowContext workflowContext, ActivityContext activityContext)
        {
            DateTime started;

            if (!workflowContext.HasStateFor(activityContext.Record, "StartedUtc"))
            {
                var dateString = activityContext.GetState <string>("Date");
                var date       = _dateServices.ConvertFromLocalizedString(dateString);
                started = date ?? _clock.UtcNow;

                workflowContext.SetStateFor(activityContext.Record, "StartedUtc", started);
            }
            else
            {
                started = workflowContext.GetStateFor <DateTime>(activityContext.Record, "StartedUtc");
            }

            var amount = activityContext.GetState <int>("Amount");
            var type   = activityContext.GetState <string>("Unity");

            return(_clock.UtcNow > When(started, amount, type));
        }
コード例 #6
0
        private void TrySetupWatcherIdsState(WorkflowContext workflowContext, ActivityContext activityContext)
        {
            if (workflowContext.HasStateFor(activityContext.Record, _stateKey)) return;

            // It seems that not even arrays are supported to be saved to the state, hence the string
            workflowContext.SetStateFor(activityContext.Record, _stateKey, string.Join(",", CumulatedWatcherIds(workflowContext.Content)));
        }