static void Main(string[] args) { DBTools = new DBtools(); char scelta = ' '; do { Console.WriteLine("\n*** FORMULA ONE - CONSOLE ***\n"); Console.WriteLine("1 - Create Countries"); Console.WriteLine("2 - Create Teams"); Console.WriteLine("3 - Create Drivers"); Console.WriteLine("4 - Create Circuits"); Console.WriteLine("5 - Create Races"); Console.WriteLine("6 - Create RacesPoints"); Console.WriteLine("7 - Create Scorse"); Console.WriteLine("------------------"); Console.WriteLine("B - Backup"); Console.WriteLine("T - Restore"); Console.WriteLine("R - Reset"); Console.WriteLine("------------------"); Console.WriteLine("X - EXIT\n"); scelta = Console.ReadKey(true).KeyChar; switch (scelta) { case '1': DBTools.ExecuteSqlScript("Countries.sql"); break; case '2': DBTools.ExecuteSqlScript("Teams.sql"); break; case '3': DBTools.ExecuteSqlScript("Drivers.sql"); break; case '4': DBTools.ExecuteSqlScript("Circuits.sql"); break; case '5': DBTools.ExecuteSqlScript("Races.sql"); break; case '6': DBTools.ExecuteSqlScript("RacesPoints.sql"); break; case '7': DBTools.ExecuteSqlScript("Scores.sql"); break; case 'B': Thread.Sleep(1050); DBTools.DBBackup(); break; case 'T': Thread.Sleep(1050); DBTools.DBRestore(); break; case 'R': Thread.Sleep(1050); DBTools.DBBackup(); bool OK; OK = DBTools.callDropTable("Country"); if (OK) { OK = DBTools.callDropTable("Team"); } if (OK) { OK = DBTools.callDropTable("Driver"); } //script file if (OK) { OK = DBTools.callExecuteSqlScript("countries"); } if (OK) { OK = DBTools.callExecuteSqlScript("teams"); } if (OK) { OK = DBTools.callExecuteSqlScript("drivers"); } if (OK) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("RESET DB OK"); Console.ForegroundColor = ConsoleColor.White; } else { DBTools.DBRestore(); } break; default: if (scelta != 'X' && scelta != 'x') { Console.WriteLine("\nUncorrect Choice - Try Again\n"); } break; } } while (scelta != 'X' && scelta != 'x'); }
static void Main(string[] args) { Console.Title = "Formula 1"; DBtoolsInst = new DBtools(); dotAnimation("Starting", ConsoleColor.Green, true); char scelta = ' '; do { Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("\n*** FORMULA ONE - BATCH SCRIPTS ***\n"); Console.WriteLine("1 - Create Countries"); Console.WriteLine("2 - Create Teams"); Console.WriteLine("3 - Create Drivers"); Console.WriteLine("4 - Create Circuits"); Console.WriteLine("5 - Create GP"); Console.WriteLine("6 - Create Points"); Console.WriteLine("7 - Create GPresults"); Console.WriteLine("8 - Create relations"); Console.WriteLine("9 - Drop relations"); Console.WriteLine("------------------"); Console.WriteLine("B - Backup"); Console.WriteLine("T - Restore"); Console.WriteLine("R - Reset"); Console.WriteLine("------------------"); Console.WriteLine("X - EXIT\n"); scelta = Console.ReadKey(true).KeyChar; switch (scelta) { case '1': THanimation(); Thread.Sleep(1015); callExecuteSqlScript("countries"); break; case '2': THanimation(); Thread.Sleep(1015); callExecuteSqlScript("teams"); break; case '3': THanimation(); Thread.Sleep(1015); callExecuteSqlScript("drivers"); break; case '4': THanimation(); Thread.Sleep(1015); callExecuteSqlScript("circuits"); break; case '5': THanimation(); Thread.Sleep(1015); callExecuteSqlScript("gps"); break; case '6': THanimation(); Thread.Sleep(1015); callExecuteSqlScript("points"); break; case '7': THanimation(); Thread.Sleep(1015); callExecuteSqlScript("gpResults"); break; case '8': THanimation(); Thread.Sleep(1015); callExecuteSqlScript("relations"); break; case '9': THanimation(); Thread.Sleep(1015); callExecuteSqlScript("dropRelations"); break; case 'B': THanimation(); Thread.Sleep(1015); DBtoolsInst.DBBackup(); break; case 'T': THanimation(); Thread.Sleep(1015); DBtoolsInst.DBRestore(); break; case 'R': THanimation(); Thread.Sleep(1015); DBtoolsInst.DBBackup(); bool OK; //tabelle //OK=callExecuteSqlScript("dropRelations"); //if (OK) OK = callDropTable("Country"); if (OK) { OK = callDropTable("Team"); } if (OK) { OK = callDropTable("Driver"); } if (OK) { OK = callDropTable("Circuit"); } if (OK) { OK = callDropTable("GP"); } if (OK) { OK = callDropTable("Point"); } if (OK) { OK = callDropTable("GPResult"); } //script file if (OK) { OK = callExecuteSqlScript("countries"); } if (OK) { OK = callExecuteSqlScript("teams"); } if (OK) { OK = callExecuteSqlScript("drivers"); } if (OK) { OK = callExecuteSqlScript("circuits"); } if (OK) { OK = callExecuteSqlScript("gps"); } if (OK) { OK = callExecuteSqlScript("points"); } if (OK) { OK = callExecuteSqlScript("gpResults"); } //if (OK) OK = callExecuteSqlScript("relations"); if (OK) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("RESET DB OK"); } else { DBtoolsInst.DBRestore(); } break; case 'x': dotAnimation("Closing", ConsoleColor.Green, false); break; default: if (scelta != 'X' && scelta != 'x') { Console.WriteLine("\nUncorrect Choice - Try Again\n"); } break; } } while (scelta != 'X' && scelta != 'x'); }