示例#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);
            }
        }
 public CalculateNextRunDateJob(DynamicsRepository repo, IFExConfig config, ILoggingService trace, int depth, Guid correlationId)
 {
     this.repo          = repo;
     this.config        = config;
     this.trace         = trace;
     this.depth         = depth;
     this.correlationId = correlationId;
 }
示例#3
0
 public RateSyncJob(DynamicsRepository repository, IOrganizationService organisationService, IFExConfig config,
                    ILoggingService trace, Guid correlationId)
 {
     this.organisationService = organisationService;
     this.config = config;
     this.trace  = trace;
     repo        = repository;
     rateService = new RateService(config, trace, correlationId);
     rateSyncer  = new RateSyncer(config, trace);
 }
示例#4
0
        private string GetOrganisationUniqueName()
        {
            var name = new DynamicsRepository(organisationService, trace).GetUniqueName();

            return(name);
        }
        public void SetUp()
        {
            var service = new OrganisationServiceFactory().Create();

            repo = new DynamicsRepository(service, new Mock <ILoggingService>().Object);
        }
示例#6
0
 public FExConfig(Entity entity, DynamicsRepository dynamicsRepository)
 {
     this.dynamicsRepository = dynamicsRepository;
     Entity = entity;
 }