static void DisposeObjects() { Console.Clear(); _threads.Clear(); _sorters.Clear(); InitializeSorters(); _connection = null; _dbInsert = null; }
static bool GetArrayData() { Console.WriteLine("Loading data from (1-5)."); Console.WriteLine("File: (1)"); Console.WriteLine("Console: (2)"); Console.WriteLine("Random array: (3)"); Console.WriteLine("Database (ADO.NET): (4)"); Console.WriteLine("Database (EF): (5)"); int key = ParseInteger(); switch (key) { case 0: return(false); case 1: { string filePath; while (!FileIsExist(out filePath)) { ; } _array = ArrayFile.GetArray(filePath); break; } case 2: { Console.WriteLine("Enter the integer values of the array"); Console.WriteLine("To finish, type any letter"); _array = ArrayConsole.GetArray(); break; } case 3: { Console.WriteLine("Enter count of numbers: "); int numCount = ParseInteger(); Console.WriteLine("Enter minimum number: "); int min = ParseInteger(); Console.WriteLine("Enter maximum number: "); int max = ParseInteger(); _array = ArrayRandom.GetArray(numCount, min, max); break; } case 4: { Console.WriteLine("Enter array ID: "); int id = ParseInteger(); _connection = new SqlConnection(ConfigurationManager.AppSettings.Get("ConnectionString")); ArrayADO ado = new ArrayADO(_connection); _array = ado.GetArray(id); _dbInsert = ado; _dbInsert.ArrayId = id; break; } case 5: { Console.WriteLine("Enter array ID: "); int id = ParseInteger(); ArrayEF ef = new ArrayEF(ConfigurationManager.AppSettings.Get("ConnectionString")); _array = ef.GetArray(id); _dbInsert = ef; _dbInsert.ArrayId = id; break; } } return(false); }