예제 #1
0
파일: OMS.cs 프로젝트: vlbhaskar/Azure203
        public static void Run([QueueTrigger("orders", Connection = "storconnstr")] QueueItem queue
                               , ILogger log)
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString);

            // Create a table client for interacting with the table service
            CloudTableClient          tableClient = storageAccount.CreateCloudTableClient(new TableClientConfiguration());
            TableQuery <OrdersEntity> query       = new TableQuery <OrdersEntity>();

            string filterquery = TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.Equal, queue.RowKey);

            query = new TableQuery <OrdersEntity>().Where(filterquery);

            CloudTable table = tableClient.GetTableReference("orders");
            var        pocos = table.ExecuteQuery(query);


            // Create a table client for interacting with the table service

            Parallel.ForEach(pocos,
                             async x =>
            {
                string subject = "OrderID:" + x.RowKey;
                string message = $"Order with quantity {x.Quantity} and total price {x.Cost}";
                await OmsEmail.SentEmail(x.CustomerEmail, subject, message);
            }
                             );

            log.LogInformation($"C# Queue trigger function processed: {pocos}");
        }
예제 #2
0
파일: OMS.cs 프로젝트: mgupta1976/Azure203
        public static void Run([QueueTrigger("orders", Connection = "<Storageconnectionstring>")] QueueItem input,
                               [Table("orders", "{input.PartitionKey}", "{input.RowKey}", Connection = "<Storageconnectionstring>")]
                               IQueryable <OrdersEntity> pocos, ILogger log)
        {
            Parallel.ForEach(pocos,
                             async x =>
            {
                string subject = "OrderID:" + x.RowKey;
                string message = $"Order with quantity {x.Quantity} and total price {x.Cost}";
                await OmsEmail.SentEmail(x.CustomerEmail, subject, message);
            }
                             );

            log.LogInformation($"C# Queue trigger function processed: {pocos}");
        }