Beispiel #1
0
        public static void Run(
            [QueueTrigger("invoice-print-request")] InvoicePrintRequest printRequest,
            Binder binder,
            ILogger log)
        {
            var jsReportUrl = Environment.GetEnvironmentVariable("JsReportUrl");
            var pdf         = new InvoicePrinter(jsReportUrl).Print(printRequest.InvoiceToPrint);

            StoreResultInBlobAsync(
                binder,
                $"Invoice_{printRequest.InvoiceToPrint.InvoiceNumber.Replace("/","_")}",
                pdf);
        }
        public static void Run(
            [QueueTrigger("invoice-generation-request")] InvoiceGenerationRequest request,
            [Table("billingItems")] CloudTable billingItems,
            [CosmosDB("crm", "invoices", ConnectionStringSetting = "cosmosDb")] out dynamic generatedInvoice,
            [Queue("invoice-print-request")] out InvoicePrintRequest printRequest,
            [Queue("invoice-notification-request")] out InvoiceNotificationRequest notificationRequest,
            ILogger log)
        {
            log.LogInformation($"[GenerateInvoiceFunc] Queue trigger. Function processed: {request.CustomerCode} {request.Year} {request.Month}");

            var generator = new InvoiceGenerator();
            var items     = GetBillingItemsFromTable(billingItems, request);
            var invoice   = generator.Generate(request, items);

            generatedInvoice = invoice;

            printRequest = new InvoicePrintRequest {
                InvoiceToPrint = invoice
            };
            notificationRequest = new InvoiceNotificationRequest {
                InvoiceForNotification = invoice
            };
        }