static void Main(string[] args) { #region Main char choice; do { menu(); Console.Write("DIGIT YOUR CHOICE "); choice = Console.ReadKey().KeyChar; switch (choice) { case '1': table = vehicle(); if (table != "x") { dbUtilities.CreateTable(table); Console.WriteLine("\nTable created"); Thread.Sleep(3000); } break; case '2': table = vehicle(); if (table != "x") { takeParameters(); dbUtilities.AddNewItem(table, brand, model, color, displacement, powerKw, matriculation, isUsed, isKm0, kmDone, price, numAirbag, saddleBrand); Console.WriteLine("\nNew item added corectly"); Thread.Sleep(3000); } break; case '3': table = vehicle(); if (table != "x") { dbUtilities.ListTable(table); } break; case '4': table = vehicle(); if (table != "x") { id = takeId(table); takeParameters(); dbUtilities.Update(table, id, brand, model, color, displacement, powerKw, matriculation, isUsed, isKm0, kmDone, price, numAirbag, saddleBrand); id = 0; Console.WriteLine($"\nTable {table} updated"); Thread.Sleep(3000); } break; case '5': table = vehicle(); if (table != "x") { id = takeId(table); dbUtilities.Delete(table, id); id = 0; Console.WriteLine("\nItem removed corectly"); Thread.Sleep(3000); } break; case '6': table = vehicle(); if (table != "x") { dbUtilities.DropTable(table); Console.WriteLine($"\nTable {table} removed"); Thread.Sleep(3000); } break; case '7': dbUtilities.CreateBackup(dbFilePath); Console.WriteLine($"\nBackup created"); Thread.Sleep(3000); break; case '8': dbUtilities.RestoresBackup(dbFilePath); Console.WriteLine($"\nBackup restored"); Thread.Sleep(3000); break; default: break; } }while (choice != 'X' && choice != 'x'); #endregion }
private void tsbSalva_Click(object sender, EventArgs e) { dbUtilities.CreateBackup(dbFilePath); listUtilities.UpdateDb(VehicleList, connStr); }