/// <summary> /// Introduction screen of program /// </summary> /// <param name="connectionString">JSON file settings to connect to SQL DB</param> public void MainMenu(string connectionString) { //Console.ForegroundColor = ConsoleColor.Cyan; dal = new ParkDBDAL(connectionString); bool exit = false; while (!exit) { Console.Clear(); Console.WriteLine("National Park CampGround Reservation System"); Console.WriteLine("\n1) Login"); //Option 2 not implemented //Console.WriteLine("2) Register"); Console.WriteLine("0) Quit"); int userChoice = GetInteger("\nPlease Choose Menu Item:"); if (userChoice == 1) { // Loads List of Parks ParkListMenu(); } else if (userChoice == 2) { //Do something //Not implemented currently } else if (userChoice == 0) { //End program exit = true; } } }
public void Start() { transaction = new TransactionScope(); dal = new ParkDBDAL(_connectionString); // Get the SQL Script to run string sql = File.ReadAllText("TempTestDB.sql"); // Execute the script using (SqlConnection conn = new SqlConnection(_connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(sql, conn); cmd.ExecuteNonQuery(); } }