Example #1
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            // TODO not very happy about these being outside try catch but need to think of way
            // of retrying a workflow even when we don't have a context and org service!

            var workflowContext     = GetWorkflowContext(executionContext);
            var organisationService = GetOrganizationService(workflowContext.UserId, executionContext);
            var tracingService      = GetTraceService(executionContext);
            var trace = new DynamicsLoggingService(tracingService, organisationService.GetUniqueOrganisationName(),
                                                   workflowContext.CorrelationId);

            var config = organisationService.GetFExConfiguration(workflowContext.PrimaryEntityId,
                                                                 ConfigAttribute.SchedulingAttributes, trace);

            try
            {
                var repo        = new DynamicsRepository(organisationService, trace);
                var nextRunDate = new CalculateNextRunDateJob(repo, config, trace, workflowContext.Depth, workflowContext.CorrelationId).Execute();
                CurrentRevision.Set(executionContext, config.Revision);
                NextRunDate.Set(executionContext, nextRunDate.NextDate.UtcDateTime);
            }
            catch (Exception exp)
            {
                var msg = "Error has Occured Running CalculateNextRunDate Activity. Seting Last Run Status to Error and logging.";
                HandleException(exp, msg, config, organisationService, trace);
            }
        }
        protected override void Execute(CodeActivityContext executionContext)
        {
            var tracingService = GetTraceService(executionContext);

            var workflowContext     = GetWorkflowContext(executionContext);
            var organisationService = GetOrganizationService(workflowContext.UserId, executionContext);
            var trace = new DynamicsLoggingService(tracingService, organisationService.GetUniqueOrganisationName(),
                                                   workflowContext.CorrelationId);
            var config = organisationService.GetFExConfiguration(workflowContext.PrimaryEntityId, ConfigAttribute.RunAttributes, trace);

            try
            {
                var rateSyncJob = new RateSyncJob(new DynamicsRepository(organisationService, trace), organisationService, config,
                                                  trace, workflowContext.CorrelationId);
                rateSyncJob.Execute();
            }
            catch (Exception exp)
            {
                var msg = "Error has Occured Running PerformRateSync Activity. Seting Last Run Status to Error and logging.";
                HandleException(exp, msg, config, organisationService, trace);
            }
        }