Пример #1
0
        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            bookingJson    = BookingInfo.Get <string>(executionContext);
                PayloadBooking payloadBooking = new PayloadBooking(tracingService, service);
                payloadBooking.BookingInfo = JsonHelper.DeserializeJson(bookingJson, tracingService);
                ProcessBookingService process = new ProcessBookingService(payloadBooking);
                Response.Set(executionContext, process.ProcessPayload());
            }
            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());
            }
        }