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))); }
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); }
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)); }
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 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))); }