void XmlDataPersistance::execLoad()
{
    try
    {
        loadCategories(categoriesFilePath_);
        loadUvs(uvsFilePath_);
        loadDegrees(degreesFilePath_);
        loadStudents(studentsFilePath_);
    }
    catch(UTProfilerException e)
    {
        qDebug() << e.getInfo();
    }
}
Beispiel #2
0
/* * * * * * * * * * * * * * * * * * * * * * * * *
		Main Program:
		Display menu, get and run user choice.
* * * * * * * * * * * * * * * * * * * * * * * * */
int main()
{
	int choice = 0;	// store user selection
	int quit = 0;	// flag to end program
	
	// print the menu, loop until user quits
	do {
		printf("\n\nWelcome to STUDENTS!\n===================\n\n"
			"There are currently %d students in memory.\n\n"
			"1.  Add New Student(s)\n"
			"2.  Find Student by Last Name\n"
			"3.  List All Students\n"
			"4.  Sort Database\n"
			"5.  Load Students File (./students.dat)\n"
			"6.  Save Students File (./students.dat)\n"
			"7.  Clear Memory (New Database)\n"
			"8.  Quit\n\n", numStudents);
		
		// input the user selection
		choice = inputInteger("Choice: ");
		printf("\n");
		
		// run the appropriate function based on user choice
		switch (choice)
		{
			case 1: // add
				addStudents();
				break;
			case 2: // find
				findStudent();
				break;
			case 3: // list
				listStudents();
				break;
			case 4: // sort
				sortStudents();
				break;
			case 5: // load
				if (numStudents == 0 || confirm("LOAD file and LOSE all students in memory (y/n) ? "))
					loadStudents();
				break;
			case 6: // save (only if students[] is not empty)
				if (numStudents == 0) printf("There are no students to save yet!\n");
				else if (confirm("OVERWRITE the file (y/n) ? "))
					saveStudents();
				break;
			case 7: // new
				if (confirm("DELETE all students from memory (y/n) ? "))
					clearStudents();
				break;
			case 8: // quit
			default: // quit
				if (confirm("QUIT and LOSE all data in memory (y/n) ? "))
				{
					printf("\nThank you and goodbye!\n\n");
					quit = 1;
				}
				break;
		}
	} while (quit == 0);	// keep repeating until user chooses to quit
	
	// quit = 1: end program successfully
	#ifdef _MSC_VER
		getchar();
		getchar();
	#endif

	return 0;
}