コード例 #1
0
        private void DisplayStoreOrderHistory()
        {
            // Get all of the stores
            var stores = StoreManagerApplication.GetAllData <Store>()
                         .Select(data => data as StoreData);
            // Get their names
            var storeNames = stores.Select(sd => sd.Name).ToArray();
            // See which one the user wishes to see
            int selectedOption = CUI.PromptForMenuSelection(storeNames, false);
            // Get the store they wish to see
            var selectedStore = stores.ElementAt(selectedOption);

            if (selectedStore.OrderIds.Any())
            {
                // display all of the orders
                selectedStore.OrderIds.ForEach(o => DisplayOrder(o));
            }
            else
            {
                Console.WriteLine($"No orders for '{selectedStore.Name}'");
            }
        }