Beispiel #1
0
 public static void ExecuteCommand(int UserCommand, ref VehicleManager vehicleManager, ref List <Vehicle> vehicles, ref long TotalVisitor)
 {
     if (UserCommand == (int)Commandtype.Add)
     {
         vehicleManager.VehicleTypeSelectInstruction();
         Int32   vehicleType   = Convert.ToInt32(Console.ReadLine());
         Vehicle vehicle       = vehicleManager.GetVehicle((VehicleType)vehicleType);
         long    VehicleNextId = vehicleManager.GetNextId(vehicles);
         vehicleManager.Add(vehicleManager.SetVechileData(vehicle, VehicleNextId, ref TotalVisitor), ref vehicles);
     }
     else if (UserCommand == (int)Commandtype.Remove)
     {
         Console.WriteLine("Use Vehicle Id for Remove Vehicle");
         vehicleManager.ShowVechileList(vehicles);
         Console.WriteLine("Please Press Vehile Id");
         object VehicleId = Convert.ToInt32(Console.ReadLine());
         vehicleManager.Remove(VehicleId, ref vehicles);
         Console.WriteLine("Remove Success VehicleId=" + VehicleId);
     }
     else if (UserCommand == (int)Commandtype.ShowVehicleList)
     {
         vehicleManager.ShowVechileList(vehicles);
     }
     else if (UserCommand == (int)Commandtype.ShowVehicleListWithTotalVisitor)
     {
         Console.WriteLine("Total Visitor Is:" + TotalVisitor);
         vehicleManager.ShowVechileList(vehicles);
     }
     else if (UserCommand == (int)Commandtype.ClearCommandLine)
     {
         Console.Clear();
     }
     else if (UserCommand == (int)Commandtype.CommandLineHelp)
     {
         vehicleManager.CommandLineHelpInstruction();
     }
     else
     {
         Console.WriteLine("Please Press Command Between 1 and 5");
     }
 }