private static void ProcessAllOrders(IDictionary <Guid, IOrder> orders) { OrderProcessingService orderProcessingService = new OrderProcessingService(); IOrderExecutionService orderExecutionService = new OrderExecutionService(); MembershipProcessingStrategy membershipProcessingStrategy = new MembershipProcessingStrategy(orderExecutionService); ProductOrderProcessingStrategy productOrderProcessingStrategy = new ProductOrderProcessingStrategy(orderExecutionService); VideoRequestProcessingStrategy videoRquestProcessingStrategy = new VideoRequestProcessingStrategy(orderExecutionService); Console.WriteLine("\n\t\t---------------------------------------------\n"); Console.WriteLine("\n\t\t*********************************************\n"); Console.WriteLine("\n\t\t* PROCESSING ALL THE PLACED ORDERS *\n"); try { foreach (KeyValuePair <Guid, IOrder> kvp in orders) { string name = kvp.Value.GetType().Name.ToUpper(); switch ((OrderType)Enum.Parse(typeof(OrderType), name)) { case OrderType.MEMBERSHIP: orderProcessingService.SetOrderProcessingStrategy(membershipProcessingStrategy); orderProcessingService.ProcessOrder(kvp.Value); break; case OrderType.PRODUCT: orderProcessingService.SetOrderProcessingStrategy(productOrderProcessingStrategy); orderProcessingService.ProcessOrder(kvp.Value); break; case OrderType.VIDEO: orderProcessingService.SetOrderProcessingStrategy(videoRquestProcessingStrategy); orderProcessingService.ProcessOrder(kvp.Value); break; default: break; } } } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.WriteLine("\n\t\t*********************************************\n"); Console.WriteLine("\n\t\t---------------------------------------------\n"); Console.WriteLine("\n\t\t* ALL ORDERS HAS BEEN PROCESSED *\n"); }