Skip to content

Instantly share code, notes, and snippets.

using System;
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Azure.WebJobs.Extensions.SendGrid;
using SendGrid.Helpers.Mail;
using PacodelaCruz.DurableFunctions.Models;
namespace PacodelaCruz.DurableFunctions.Approval
{
@pacodelacruz
pacodelacruz / OrchestrateRequestApproval.cs
Created April 16, 2018 11:37
Durable Functions Approval Orchestration
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
@pacodelacruz
pacodelacruz / TriggerApprovalByBlob.cs
Created April 16, 2018 11:37
Durable Functions Trigger
using System.IO;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs.Extensions.Http;
using PacodelaCruz.DurableFunctions.Models;
{
"requiresApproval": false,
"discount": 0.15
}
{
{% assign isDiscountEnabled = true %}
{% assign channelsWithDiscount = "Mobile" | Split: "|" %}
{% assign zoneOneCodes = "3000|3001|3002|3003|3004|3005|3006|3007|3008" | Split: "|" %}
{% assign zoneTwoCodes = "3205|3206|3207" | Split: "|" %}
{% assign minAmountForHigherDiscount = 50 %}
{% assign maxWeightForHigherDiscount = 10 %}
{% assign minAmountWithoutApproval = 10 %}
{% assign maxWeightWithoutApproval = 18 %}
{
{% assign zoneOneCodes = "3000|3001|3002|3003|3004|3005|3006|3007|3008" | Split: "|" %}
{% assign zoneTwoCodes = "3205|3206|3207" | Split: "|" %}
{%- if content.totalWeight > 18 or content.subtotal < 10 -%}
"requiresApproval": true,
{%- else -%}
"requiresApproval": false,
{%- endif -%}
{
"orderNumber": "1234",
"date": "2018-01-16",
"channel": "Mobile",
"customerId": "pacodelacruz",
"shipTo": {
"name": "Paco de la Cruz",
"street": "365 Around the Sun St",
"city": "Melbourne",
"state": "VIC",
let CustomerToFind = "{id}";
AzureDiagnostics
| where Category == "WorkflowRuntime"
| where trackedProperties_IsBAMEvent_b == true
| where trackedProperties_CustomerId_s == CustomerToFind
| project OrderNumber = trackedProperties_OrderNumber_s,
OrderTotal = trackedProperties_OrderTotal_d,
OrderDate = trackedProperties_OrderDate_s,
Channel = trackedProperties_Channel_s,
AzureDiagnostics
| where Category == "WorkflowRuntime"
| where trackedProperties_IsBAMEvent_b == true
| project OrderNumber = trackedProperties_OrderNumber_s,
OrderTotal = trackedProperties_OrderTotal_d,
OrderDate = trackedProperties_OrderDate_s,
Channel = trackedProperties_Channel_s,
CustomerId = trackedProperties_CustomerId_s,
Workflow = resource_workflowName_s ,
WorkflowRunId = resource_runId_s
AzureDiagnostics
| where Category == "WorkflowRuntime"
| where trackedProperties_IsBAMEvent_b == true
| summarize Amount = sum(trackedProperties_OrderTotal_d) by trackedProperties_OrderDate_s, trackedProperties_Channel_s
| order by trackedProperties_OrderDate_s asc