public override IEnumerable <LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) { var tokenWebApiResponseName = "WebApiResponse"; if (workflowContext.Tokens.ContainsKey(tokenWebApiResponseName) && workflowContext.Tokens[tokenWebApiResponseName] != null) { bool success = activityContext.GetState <bool>("Successful"); string message = activityContext.GetState <string>("Message"); var dataString = activityContext.GetState <string>("Data"); if (!string.IsNullOrWhiteSpace(dataString)) { ((Response)workflowContext.Tokens[tokenWebApiResponseName]).Data = JsonConvert.DeserializeObject(dataString); } ErrorCode errorCode = activityContext.GetState <ErrorCode>("ErrorCode"); ResolutionAction resolutionAction = activityContext.GetState <ResolutionAction>("ResolutionAction"); ((Response)workflowContext.Tokens[tokenWebApiResponseName]).Success = success; ((Response)workflowContext.Tokens[tokenWebApiResponseName]).Message = message; if (!success) { ((Response)workflowContext.Tokens[tokenWebApiResponseName]).ErrorCode = errorCode; ((Response)workflowContext.Tokens[tokenWebApiResponseName]).ResolutionAction = resolutionAction; } else { ((Response)workflowContext.Tokens[tokenWebApiResponseName]).ErrorCode = ErrorCode.NoError; ((Response)workflowContext.Tokens[tokenWebApiResponseName]).ResolutionAction = ResolutionAction.NoAction; } } yield return(T("Done")); }
/// <summary> /// Called when the error is resolved. /// </summary> /// <param name="action">The action.</param> protected void OnErrorResolved(ResolutionAction action) { if (ErrorResolved != null) { ErrorResolved(null, new ApiErrorTroubleshooterEventArgs(action)); } }
public Response() { this.ErrorCode = ErrorCode.GenericError; this.Success = false; this.Message = "Generic Error"; this.ResolutionAction = ResolutionAction.NoAction; }
private void CreateNewResolutionAction(RuntimeEntityModel context, ResolutionAction unsavedAction, RTProvider providerCache) { RTResolutionAction resolutionAction = RTResolutionAction.CreateRTResolutionAction(0, unsavedAction.ReferenceName, unsavedAction.FriendlyName); resolutionAction.IsActive = true; resolutionAction.Provider = providerCache; context.AddToRTResolutionActionSet(resolutionAction); }
public bool TryResolveConflict(RTConflict conflict, ResolutionAction resolutionAction, string applicableScope, Dictionary <string, string> dataFields) { TraceManager.TraceInformation("ConflictResolver: TryResolveConflict {0} with action: {1} and scope: {2} ", conflict.ConflictType.FriendlyName, resolutionAction.FriendlyName, applicableScope); IEnumerable <ConflictResolutionResult> resolutionResults = new List <ConflictResolutionResult>(); return(m_conflictResolver.TryResolveConflict(conflict, resolutionAction, applicableScope, dataFields, out resolutionResults)); }
// Resolves the given conflict with the provided resolution action and scope public bool TryResolveConflict(RTConflict conflict, ResolutionAction resolutionAction, string applicableScope, out IEnumerable <ConflictResolutionResult> resolutionResults) { ConflictRuleViewModel conflictModel = new ConflictRuleViewModel(conflict, m_model); conflictModel.SelectedResolutionAction = resolutionAction; conflictModel.Scope = applicableScope; resolutionResults = conflictModel.Save(); return(resolutionResults.Where(x => !x.Resolved).Count() == 0); }
// Resolves the given conflict with the provided resolution action ,scope and data fields public bool TryResolveConflict(RTConflict conflict, ResolutionAction resolutionAction, string applicableScope, Dictionary <string, string> dataFields, out IEnumerable <ConflictResolutionResult> resolutionResults) { ConflictRuleViewModel conflictModel = new ConflictRuleViewModel(conflict, m_model); conflictModel.SelectedResolutionAction = resolutionAction; conflictModel.Scope = applicableScope; foreach (ObservableDataField dataField in conflictModel.ObservableDataFields) { dataField.FieldValue = dataFields[dataField.FieldName]; } resolutionResults = conflictModel.Save(); return(resolutionResults.Where(x => !x.Resolved).Count() == 0); }
/// <summary> /// Performs the action. /// </summary> /// <param name="action">The action.</param> private void PerformAction(ResolutionAction action) { switch (action) { case ResolutionAction.Close: Close(); break; case ResolutionAction.HideTroubleshooter: TroubleshooterPanel.Hide(); break; case ResolutionAction.None: TroubleshooterPanel.BackColor = Color.PaleGreen; break; default: throw new NotImplementedException(); } }
/// <summary> /// Initializes a new instance of the <see cref="ApiErrorTroubleshooterEventArgs"/> class with the error resolved. /// </summary> /// <param name="action">The action.</param> public ApiErrorTroubleshooterEventArgs(ResolutionAction action) { m_resolved = true; m_action = action; }
/// <summary> /// Initializes a new instance of the <see cref="ApiErrorTroubleshooterEventArgs"/> class with the error unresolved. /// </summary> public ApiErrorTroubleshooterEventArgs() { m_action = ResolutionAction.None; }
/// <summary> /// Called when the error is resolved. /// </summary> /// <param name="action">The action.</param> protected void OnErrorResolved(ResolutionAction action) { if (ErrorResolved != null) ErrorResolved(null, new ApiErrorTroubleshooterEventArgs(action)); }
public ResolutionActionViewModel(ResolutionAction resolutionAction) { m_resolutionAction = resolutionAction; }
/// <summary> /// Called when the error is resolved. /// </summary> /// <param name="action">The action.</param> protected void OnErrorResolved(ResolutionAction action) { ErrorResolved?.ThreadSafeInvoke(null, new ApiErrorTroubleshooterEventArgs(action)); }