public async Task <dynamic> GetResult(string monthEnding)
        {
            var now = StringUtil.GetMonthEnding(monthEnding);

            var agencyQuery = new AgencyQuery(_connectionString);
            var agencyData  = await agencyQuery.GetAggregationsAsync();

            var briefResponseQuery = new BriefResponseQuery(now, _connectionString);
            var briefResponseData  = await briefResponseQuery.GetAggregationsAsync();

            var briefQuery = new BriefQuery(now, _connectionString);
            var briefData  = await briefQuery.GetAggregationsAsync();

            var austenderQuery = new AustenderQuery(now, _connectionString);
            var austenderData  = await austenderQuery.GetAggregationsAsync();

            var supplierQuery = new SupplierQuery(now, _connectionString);
            var supplierData  = await supplierQuery.GetAggregationsAsync();

            return(new {
                agencyData,
                austenderData,
                briefResponseData,
                briefData,
                supplierData,
                thisMonth = now.ToString("MMMM yyyy")
            });
        }
Beispiel #2
0
        public static async Task Run(
            [TimerTrigger("0 10 20 * * *")] TimerInfo timer,
            ILogger log, ExecutionContext context)
        {
            var config = new ConfigurationBuilder()
                         .SetBasePath(context.FunctionAppDirectory)
                         .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true)
                         .AddEnvironmentVariables()
                         .Build();

            var connectionString = config.GetConnectionString("DevProcurementConnectionString");
            var dmApiUrl         = Environment.GetEnvironmentVariable("dmApiUrl");
            var dmApiKey         = Environment.GetEnvironmentVariable("dmApiKey");

            using (var dmClient = new HttpClient()) {
                dmClient.DefaultRequestHeaders.Add("X-Api-Key", dmApiKey);
                var response = await dmClient.GetStringAsync($"{dmApiUrl}/reports/brief_response/submitted");

                var briefResponseQuery = new BriefResponseQuery(DateTime.Now, connectionString);
                log.LogInformation($"rows updated: {await briefResponseQuery.UpdateImpMarketplaceBriefResponse(response)}");
            }
        }