예제 #1
0
        /// <summary>
        /// Prints a list of customers and their orders.
        /// </summary>
        /// <param name="m_OrderSystem">The OrderSytem object for the application.</param>
        private static void ShowCustomersAndOrders(OrderSystem orderSystem)
        {
            // Initialize
            Customer customer = null;
            Order    order    = null;

            // Print header
            Console.WriteLine("Customers and their orders:");
            Console.WriteLine("---------------------------------");

            // Print customers and orders
            for (int i = 0; i < orderSystem.Customers.Count; i++)
            {
                customer = orderSystem.Customers[i];
                Console.WriteLine("Customer #{0}: {1}", i.ToString(), customer.Name);
                for (int j = 0; j < customer.Orders.Count; j++)
                {
                    order = customer.Orders[j];
                    Console.WriteLine("-->Order dated {0}", order.Date);
                }

                for (int k = 0; k < order.OrderItems.Count; k++)
                {
                    Console.WriteLine("---->Order item #{0}: {1}", k.ToString(), order.OrderItems[k].Name);
                }
            }

            // Skip line
            Console.WriteLine();
        }
예제 #2
0
파일: Program.cs 프로젝트: ssickles/archive
        /// <summary>
        /// Prints a list of customers and their orders.
        /// </summary>
        /// <param name="m_OrderSystem">The OrderSytem object for the application.</param>
        private static void ShowCustomersAndOrders(OrderSystem orderSystem)
        {
            // Initialize
            Customer customer = null;
            Order order = null;

            // Print header
            Console.WriteLine("Customers and their orders:");
            Console.WriteLine("---------------------------------");

            // Print customers and orders
            for (int i = 0; i < orderSystem.Customers.Count; i++)
            {
                customer = orderSystem.Customers[i];
                Console.WriteLine("Customer #{0}: {1}", i.ToString(), customer.Name);
                for (int j = 0; j < customer.Orders.Count; j++)
                {
                    order = customer.Orders[j];
                    Console.WriteLine("-->Order dated {0}", order.Date);

                }

                for (int k = 0; k < order.OrderItems.Count; k++)
                {
                    Console.WriteLine("---->Order item #{0}: {1}", k.ToString(), order.OrderItems[k].Name);
                }
            }

            // Skip line
            Console.WriteLine();
        }
예제 #3
0
        /// <summary>
        /// Prints a customer and order list when the order system is populated.
        /// </summary>
        static void OrderSystem_Populated(object sender, EventArgs e)
        {
            OrderSystem orderSystem = sender as OrderSystem;

            ShowCustomersAndOrders(orderSystem);
        }