예제 #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
        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
        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
        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));
        }
        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)));
        }