예제 #1
0
        public void SubmitButtonClick()
        {
            var customer = GetCustomerSubmittedInfo();
            var order    = GetOrderSubmittedInfo();

            if (customer.Id == null)
            {
                ICustomerRepository customerRepo = new CustomerRepository();
                customer.Id = customerRepo.CreateCustomer(customer);
            }
            order.CustomerId = customer.Id.Value;

            ITaxCalculationService taxCalculationService = new TaxCalculationService();
            var taxRate = taxCalculationService.GetTaxRate(customer.Province);

            order.Items.ForEach(item => item.Taxes = item.Quantity * item.Price * taxRate);

            IOrderRepository orderRepository = new OrderRepository();

            orderRepository.SaveOrder(order);

            IShippingService shippingService = new ShippingService();
            var trackingNumber = shippingService.ShipOrder(order.OrderNumber);

            Console.WriteLine($"Thank you for your order. Your tracking number is {trackingNumber}");
            Console.ReadKey();
        }
예제 #2
0
 private ShopFacade()
 {
     accountService  = new AccountService();
     paymentService  = new PaymentService();
     shippingService = new ShippingService();
     emailService    = new EmailService();
     smsService      = new SmsService();
 }