Esempio n. 1
0
 public Order(int id, string firstName, string lastName, int age, string email, bool isMember, float orderValue, Myenum orderStatus)
 {
     Id          = id;
     FirstName   = firstName;
     LastName    = lastName;
     Age         = age;
     Email       = email;
     IsMember    = isMember;
     OrderValue  = orderValue;
     OrderStatus = orderStatus;
 }
        /// <summary>
        /// The main menu for selecting the options according to the exercise
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            List <Bus> buses = new List <Bus>();
            int        number;

            Console.WriteLine(@" 
             enter 1 to EnterNewBus:
             enter 2 to BusSelection:
             enter 3 to  RefuelingOrHandling:
             enter 4 to TravelPresentation:
                enter -1 to Exit :");
            Console.WriteLine("enter a number: ");
            while (!int.TryParse(Console.ReadLine(), out number))
            {
                Console.WriteLine("rong number!!! enter again:");
            }

            Myenum choice = (Myenum)number;

            while (choice != Myenum.Exit)
            {
                switch (choice)
                {
                case Myenum.EnterNewBus:
                    Console.WriteLine("Please introduce a new bus to the company: ");
                    Addbus(ref buses);
                    break;

                case Myenum.BusSelection:
                    Console.WriteLine("Choose a bus to travel: ");
                    Busselection(buses);
                    break;

                case Myenum.RefuelingOrHandling:
                    Console.WriteLine("Treatment or refueling: ");
                    RefuelOrTreat(buses);
                    break;

                case Myenum.TravelPresentation:
                    Console.WriteLine("View the license number and passenger for all buses in the company: ");
                    foreach (Bus item in buses)
                    {
                        Console.WriteLine(item);
                    }
                    break;

                case Myenum.Exit:
                    break;

                default:
                    Console.WriteLine("end of progrem: ");
                    break;
                }
                Console.WriteLine();
                Console.WriteLine("enter a number: ");
                while (!int.TryParse(Console.ReadLine(), out number))
                {
                    Console.WriteLine("rong number!!! enter again: ");
                }

                choice = (Myenum)number;
                Console.WriteLine();
            }
        }