コード例 #1
0
        static void Main(string[] args)
        {
            //Set loop sentinel
            bool   menuLoop = false;
            string input;
            //Store customer information in list
            List <Customer> customer = new List <Customer>();

            do
            {
                //Main menu
                Console.WriteLine(StandardMessages.DisplayCreateCustomerMenu());
                input = Console.ReadLine();
                switch (input)
                {
                case "1":
                    //Build customer by entering information
                    BuildCustomer.BuildACustomer(customer, menuLoop, input);

                    break;

                case "2":
                    //Displays customer information
                    DisplayCustomerInfo.DisplayCustomerInformation(customer);
                    break;

                case "3":
                    menuLoop = true;;
                    break;

                default:
                    //Displays invalid selection
                    Console.WriteLine(StandardMessages.DisplayInvalidChoice());
                    Console.ReadLine();
                    break;
                }
                //Clears screen
                Console.Clear();
            } while (menuLoop == false);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            //Set loop sentinels
            bool   mainProgramLoop   = false;
            bool   preferredMenuLoop = false;
            string input;
            //Set index to track number of  non-preferred customer transactions.
            int index = 1;

            //Store preferred and non-preferred customer information in lists
            List <PreferredCustomer>    customer             = new List <PreferredCustomer>();
            List <NonPreferredCustomer> nonPreferredCustomer = new List <NonPreferredCustomer>();

            Console.WriteLine(StandardMessages.DisplayProgramInstructions());
            Console.ReadLine();
            Console.Clear();
            do
            {
                //Display main program menu
                Console.WriteLine(StandardMessages.DisplayMainMenu());
                //get input from user
                input = Console.ReadLine();
                switch (input)
                {
                case "1":
                    //Build preferred customer and complete customer transaction
                    BuildCustomer.BuildACustomer(customer, preferredMenuLoop, input);
                    CustomerTransaction.CustomerItemPurchasePreferred(customer, input, preferredMenuLoop);
                    break;

                case "2":
                    //Complete non-preferred customer transaction
                    CustomerTransaction.CustomerItemPurchaseNotPreferred(nonPreferredCustomer, index, input);
                    index++;
                    break;

                case "3":
                    //Display all preferred customers for the day
                    DisplayCustomerInfo.DisplayPreferredCustomerInformation(customer);

                    break;

                case "4":
                    //Display all non-preferred customer **Transactions** for the day
                    DisplayCustomerInfo.DisplayNotPreferredCustomerInformation(nonPreferredCustomer);

                    break;

                case "5":
                    //Exits program
                    mainProgramLoop = true;

                    break;

                default:
                    //Display for invalid selection
                    Console.WriteLine(StandardMessages.DisplayInvalidChoice());
                    break;
                }
                Console.Clear();
            } while (mainProgramLoop == false);
        }