public decimal GetOrderPrice(Order order) { _orderService = new DAL.OrderService(); _customerService = new DAL.CustomerService(); bool isNewCustomer = _orderService.IsNewCustomer(order.CustomerId); Customer customer = _customerService.GetCustomer(order.CustomerId); var orderDate = order.OrderDate.DayOfWeek; if (!string.IsNullOrWhiteSpace(order.Coupon)) { return(order.Quantity * Convert.ToDecimal(ConfigurationManager.AppSettings["CouponCost"])); } else if (isNewCustomer) { return(order.Quantity * Convert.ToDecimal(ConfigurationManager.AppSettings["NewCustomer"])); } else if (customer.IsGoldRatedCustomer && !isNewCustomer) { return(order.Quantity * Convert.ToDecimal(ConfigurationManager.AppSettings["GoldRatedCustomerCost"])); } else if (orderDate == DayOfWeek.Saturday || orderDate == DayOfWeek.Sunday) { return(order.Quantity * Convert.ToDecimal(ConfigurationManager.AppSettings["WeekendCost"])); } else { return(_orderService.GetOrderPrice(order) + (basePrice * order.Quantity)); } }
public int SaveCustomer(Customer customer) { _customerService = new DAL.CustomerService(); return(_customerService.SaveCustomer(customer)); }
public int ValidateCustomer(Customer customer) { _customerService = new DAL.CustomerService(); return(_customerService.ValidateCustomer(customer)); }