示例#1
0
        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"));
        }
示例#2
0
 /// <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;
 }
示例#4
0
        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);
        }
示例#5
0
        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));
        }
示例#6
0
        // 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);
        }
示例#7
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);
        }
示例#8
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();
            }
        }
示例#9
0
 /// <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;
 }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiErrorTroubleshooterEventArgs"/> class with the error unresolved.
 /// </summary>
 public ApiErrorTroubleshooterEventArgs()
 {
     m_action = ResolutionAction.None;
 }
示例#11
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));
 }
示例#15
0
 public ResolutionActionViewModel(ResolutionAction resolutionAction)
 {
     m_resolutionAction = resolutionAction;
 }
示例#16
0
 /// <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));
 }
示例#17
0
 /// <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));
 }