private static decimal calculateToppings(OrderDTO order, DTO.PizzaPriceDTO prices) { decimal cost = 0.0M; cost += (order.Sausage) ? prices.SausageCost : 0M; cost += (order.Pepperoni) ? prices.PepperonieCost : 0M; cost += (order.Onions) ? prices.OnionCost : 0M; cost += (order.GreenPeppers) ? prices.GreenPepperCost : 0M; return(cost); }
public static decimal CalculateCost(DTO.Order order) { decimal cost = 0; DTO.PizzaPriceDTO prices = GetPizzaPrices(); cost += calculateSizeCost(order, prices); cost += calculateCrustCost(order, prices); cost += calculateToppingsCost(order, prices); return(cost); }
private static PapaBobs.DTO.PizzaPriceDTO convertToDTO(PizzaPrice pizzaPrice) { var dto = new DTO.PizzaPriceDTO(); dto.SmallSizeCost = pizzaPrice.SmallSizeCost; dto.MediumSizeCost = pizzaPrice.MediumSizeCost; dto.LargeSizeCost = pizzaPrice.LargeSizeCost; dto.ThickCrustCost = pizzaPrice.ThickCrustCost; dto.ThinCrustCost = pizzaPrice.ThinCrustCost; dto.RegularCrustCost = pizzaPrice.RegularCrustCost; dto.SausageCost = pizzaPrice.SausageCost; dto.PepperoniCost = pizzaPrice.PepperoniCost; dto.OnionsCost = pizzaPrice.OnionsCost; dto.GreenPeppersCost = pizzaPrice.GreenPeppersCost; return(dto); }
private static DTO.PizzaPriceDTO convertToDTO(PizzaPrice pizzaPrice) { DTO.PizzaPriceDTO pizzaPriceDTO = new DTO.PizzaPriceDTO(); pizzaPriceDTO.SmallSizeCost = pizzaPrice.SmallSizeCost; pizzaPriceDTO.MediumSizeCost = pizzaPrice.MediumSizeCost; pizzaPriceDTO.LargeSizeCost = pizzaPrice.LargeSizeCost; pizzaPriceDTO.RegularCrustCost = pizzaPrice.RegularCrustCost; pizzaPriceDTO.ThinCrustCost = pizzaPrice.ThinCrustCost; pizzaPriceDTO.ThickCrustCost = pizzaPrice.ThickCrustCost; pizzaPriceDTO.SausageCost = pizzaPrice.SausageCost; pizzaPriceDTO.PepperoniCost = pizzaPrice.PepperoniCost; pizzaPriceDTO.OnionsCost = pizzaPrice.OnionsCost; pizzaPriceDTO.GreenPeppersCost = pizzaPrice.GreenPeppersCost; return(pizzaPriceDTO); }
private static decimal calculateToppingsCost(Order order, DTO.PizzaPriceDTO prices) { decimal cost = 0; if (order.Sausage) { cost += prices.SausageCost; } if (order.Pepperoni) { cost += prices.PepperoniCost; } if (order.Onions) { cost += prices.OnionsCost; } if (order.GreenPeppers) { cost += prices.GreenPeppersCost; } return(cost); }
private static decimal calculateSizeCost(OrderDTO order, DTO.PizzaPriceDTO prices) { decimal cost = 0.0M; switch (order.Size) { case DTO.Enums.SizeType.Small: cost = prices.SmallSizeCost; break; case DTO.Enums.SizeType.Medium: cost = prices.MediumSizeCost; break; case DTO.Enums.SizeType.Large: cost = prices.LargeSizeCost; break; default: break; } return(cost); }
private static decimal calculateCrustCost(OrderDTO order, DTO.PizzaPriceDTO prices) { decimal cost = 0.0M; switch (order.Crust) { case DTO.Enums.CrustType.Regular: cost = prices.RegularCrustCost; break; case DTO.Enums.CrustType.Thin: cost = prices.ThinCrustCost; break; case DTO.Enums.CrustType.Thick: cost = prices.ThickCrustCost; break; default: break; } return(cost); }