コード例 #1
0
        private async Task NotifyCustomerOfDelay(Customer customer, Order order)
        {
            var message =
                string.Format("Dear {0} {1}, Your order {2} cannot be delivered - please contact customer support",
                    customer.FirstName, customer.Surname, order.ID);

            await EmailClient.Send(customer.EmailAddress, "Failed delivering order", message);
        }
コード例 #2
0
        public async Task SendOrder(Customer customer, Order order)
        {
            try
            {
                var orderEta = CalculateOrderEta(order, customer.Address);

                await SendAsync(order, customer.Address);

                await NotifyCustomerOfSuccess(customer, order.ID, orderEta);

            }
            catch (IllegalOrderException exc)
            {
                await NotifyCustomerOfDelay(customer, order);

                throw new OrderProcessingException("Failed to deliver order " + order.ID, exc);
            }
        }
コード例 #3
0
        private DateTime CalculateOrderEta(Order order, Address destination)
        {
            return _shippingCalculators[order.ShippingMethod].CalculateEta(_originCountry, destination);

        }
コード例 #4
0
 private async Task SendAsync(Order order, Address address)
 {
     await Task.FromResult(false);
 }