public static void editVechile(int vID)
        {
            string vType = getVType(vID);

            try
            {
                if (vType != null)
                {
                    if (vType.Equals("MINI", StringComparison.InvariantCultureIgnoreCase))
                    {
                        MiniVehicle mini = getInitializeObjMini("MINI");
                        updateMini(mini, vID);
                        searchVehicle(vID);
                    }
                    else if (vType.Equals("MAXI", StringComparison.InvariantCultureIgnoreCase))
                    {
                        MaxiVehicle maxi = getInitializeObjMaxi("MAXI");
                        updateMaxi(maxi, vID);
                        searchVehicle(vID);
                    }
                }
                else
                {
                    throw new Exception("Vehile with Vehicle ID = " + vID + " not found.");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("\n" + e.Message);
            }
        }
 static void updateMini(MiniVehicle mini, int vID)
 {
     try
     {
         mini.validateEntry();
         SqlCommand cmd = new SqlCommand("UPDATE Vehicle SET fuelType = @fuelType, vehicleMake =@vehicleMake , vehicleType=@vehicleType , noOfKiloMeters =@noOfKM WHERE vehicleID = @vehicleID;" +
                                         "UPDATE Mini SET seatingCapacity = @seatCap WHERE vehicleID = @vehicleID;" +
                                         "UPDATE Bill SET billAmount = @billAmount WHERE vehicleID = @vehicleID;", con);
         cmd.Parameters.AddWithValue("@vehicleID", vID);
         cmd.Parameters.AddWithValue("@fuelType", mini.getFuelType());
         cmd.Parameters.AddWithValue("@vehicleMake", mini.getVehicleMake());
         cmd.Parameters.AddWithValue("@vehicleType", mini.getVehicleType());
         cmd.Parameters.AddWithValue("@noOfKM", mini.getNoOfKiloMeters());
         cmd.Parameters.AddWithValue("@seatCap", mini.getSeatingCapacity());
         cmd.Parameters.AddWithValue("@billAmount", mini.calculateBill());
         con.Open();
         if (cmd.ExecuteNonQuery() != 0)
         {
             Console.WriteLine("\nThe Vehicle updated successfully.");
         }
         else
         {
             throw new Exception();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("\nVehicle details not updated.");
         Console.WriteLine(e.Message);
     }
     finally
     {
         con.Close();
     }
 }
 static void addToDBMini(MiniVehicle mini)
 {
     try
     {
         mini.validateEntry();
         SqlCommand cmd = new SqlCommand("INSERT INTO Vehicle VALUES (@fuelType, @vehicleMake, @vehicleType, @noOfKM);" +
                                         "INSERT INTO Mini VALUES(IDENT_CURRENT('Vehicle'), @seatCap);" +
                                         "INSERT INTO Bill(vehicleID, billAmount) VALUES(IDENT_CURRENT('Vehicle'), @billAmount);", con);
         cmd.Parameters.AddWithValue("@fuelType", mini.getFuelType());
         cmd.Parameters.AddWithValue("@vehicleMake", mini.getVehicleMake());
         cmd.Parameters.AddWithValue("@vehicleType", mini.getVehicleType());
         cmd.Parameters.AddWithValue("@noOfKM", mini.getNoOfKiloMeters());
         cmd.Parameters.AddWithValue("@seatCap", mini.getSeatingCapacity());
         cmd.Parameters.AddWithValue("@billAmount", mini.calculateBill());
         con.Open();
         if (cmd.ExecuteNonQuery() != 0)
         {
             Console.WriteLine("\nThe Vehicle added successfully.");
         }
         else
         {
             throw new Exception();
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("\nVehicle Not Added.");
         Console.WriteLine(e.Message);
     }
     finally
     {
         con.Close();
     }
 }
        public static void addVehicle()
        {
            Console.WriteLine("\nChoose Vehicle Type:");
            Console.WriteLine("1. Mini Vehicle");
            Console.WriteLine("2. Maxi Vehicle");
            Console.Write("Enter Choice: ");
            int vType = Convert.ToInt32(Console.ReadLine());

            switch (vType)
            {
            case 1:
                MiniVehicle mini = getInitializeObjMini("MINI");
                addToDBMini(mini);
                break;

            case 2:
                MaxiVehicle maxi = getInitializeObjMaxi("MAXI");
                addToDBMaxi(maxi);
                break;

            default:
                Console.WriteLine("\nInvalid Choice");
                break;
            }
        }
        static MiniVehicle getInitializeObjMini(string vehicleType)
        {
            Console.WriteLine("\nEnter Details of Vehicle:");
            Console.Write("{0,-20} : ", "Fuel Type['P'/'D']");
            char fType = Convert.ToChar(Console.ReadLine().ToUpper());

            Console.Write("{0,-20} : ", "Vehicle Make");
            string veMake = Console.ReadLine().ToUpper();

            Console.Write("{0,-20} : ", "No Of Kilo Meters");
            int nKM = Convert.ToInt32(Console.ReadLine());

            Console.Write("{0,-20} : ", "Seating Capacity");
            int seatCP = Convert.ToInt32(Console.ReadLine());

            MiniVehicle mini = new MiniVehicle(fType, veMake, vehicleType, nKM, seatCP);

            mini.validateFuelType();
            mini.calculateRatePerKiloMeter();
            return(mini);
        }