示例#1
0
        public static async Task CopyToPoweroffice(
            // Trigger every six minutes, offset by three.
            [TimerTrigger("30 3-59/6 * * * *")] TimerInfo timer,
            ILogger logger)
        {
            try
            {
                var webcrmClientFactory     = new WebcrmClientFactory(logger, TypedEnvironment.WebcrmApiBaseUrl);
                var powerofficeQueueFactory = new PowerofficeQueueFactory(logger, TypedEnvironment.AzureWebJobsStorage);
                var webcrmChangeTracker     = await WebcrmToPowerofficeChangeTracker.Create(logger, webcrmClientFactory, powerofficeQueueFactory);

                var configService = await PowerofficeConfigService.Create(TypedEnvironment.DatabaseCredentials);

                var configurations = configService.LoadEnabledPowerofficeConfigurations();
                foreach (var configuration in configurations)
                {
                    var dateTimeBeforeSync = DateTime.UtcNow;
                    await webcrmChangeTracker.EnqueueUpsertedItemsToPoweroffice(configuration.LastSuccessfulCopyToErpHeartbeat, configuration);

                    await configService.UpdateLastSuccessfulCopyToErpHeartbeat(configuration.WebcrmSystemId, dateTimeBeforeSync);
                }
            }
            catch (SwaggerException ex)
            {
                SwaggerExceptionLogger.Log(ex);
            }
        }
示例#2
0
 protected BaseTester(ITestOutputHelper output)
 {
     OutputLogger = new XunitLogger(output);
     TestPowerofficeClientFactory = new PowerofficeClientFactory(TestTypedEnvironment.PowerofficeApiSettings);
     TestPowerofficeQueueFactory  = new PowerofficeQueueFactory(OutputLogger, TestTypedEnvironment.AzureWebJobsStorage);
     TestWebcrmClientFactory      = new WebcrmClientFactory(OutputLogger, TestTypedEnvironment.WebcrmApiBaseUrl);
 }