Beispiel #1
0
 public static void Notify(string email, string message)
 {
     try
     {
         using (var notification = new NotificationServiceClient())
         {
             notification.SendEmail(email, message);
         }
     }
     catch
     {
         // if it fails ignore.
     }
 }
Beispiel #2
0
        public void PlaceOrder(OrderModel order)
        {
            if (order.Quantity <= 0)
                throw new NotSupportedException();

            using (var transaction = new TransactionScope(TransactionScopeOption.Required))
            {
                CustomerBase customer;
                ProductBase prod;
                using (var mappers = new OrdersDataMapperContainer())
                {
                    prod = EnsureProductExistance(mappers.ProductMapper, order.ProductCode);

                    customer = EnsureCustomerExistance(mappers.CustomerMapper, order.CustomerId);

                    using (var orderService = new CustomerOrderReceiverServiceClient())
                    {
                        orderService.HandleOrder(new CustomerOrderModel
                                                     {
                                                         CustomerId = order.CustomerId,
                                                         ProductCode = order.ProductCode,
                                                         Quantity = order.Quantity
                                                     });
                    }
                    try
                    {
                        using (var notification = new NotificationServiceClient())
                        {
                            notification.SendEmail(customer.Email, "Your order was .");
                        }
                    }
                    catch
                    {
                        // if it fails ignore.
                    }

                    transaction.Complete();
                }

            }
        }