protected override void Execute(CodeActivityContext executionContext)
        {
            //Create the tracing service
            ITracingService tracingService = executionContext.GetExtension <ITracingService>();

            //Create the context
            IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);

            try
            {
                var           surveyJson    = SurveyResponseInfo.Get <string>(executionContext);
                PayloadSurvey payloadSurvey = new PayloadSurvey(tracingService, service);
                payloadSurvey.SurveyResponse = JsonHelper.DeserializeSurveyJson(surveyJson, tracingService);
                ProcessSurveyService processSurveyService = new ProcessSurveyService(payloadSurvey);
                Response.Set(executionContext, processSurveyService.ProcessSurveyResponse());
            }
            catch (FaultException <OrganizationServiceFault> ex)
            {
                throw new InvalidPluginExecutionException(ex.ToString());
            }
            catch (TimeoutException ex)
            {
                throw new InvalidPluginExecutionException(ex.ToString());
            }
            catch (Exception ex)
            {
                throw new InvalidPluginExecutionException(ex.ToString());
            }
        }
Beispiel #2
0
 public ProcessSurveyService(PayloadSurvey payloadSurvey)
 {
     this.payloadSurvey = payloadSurvey;
     this.trace         = payloadSurvey.Trace;
 }