static void Main(string[] args) { Console.WindowWidth = 100; Menu consoleMenu = new Menu(); consoleMenu.MainMenu = new string[] { " Student ", " Teacher ", " Accountant ", " Print all "," Parse XML ", " Exit " }; Menu subMenu = new Menu(); subMenu.MainMenu = new string[] { " ADD ", " EDIT ", " PRINT ", " DELETE ", " DELETE ALL ", " <-BACK " }; int exitMainMenu = 0; Man mainMan = new Man(); do { switch (consoleMenu.ShowMenu(consoleMenu.MainMenu, "MENU")) { case -1: exitMainMenu = -1; break; case 0: do { exitMainMenu = Menu.SubMenu(mainMan, subMenu, "STUDENT", exitMainMenu); } while (exitMainMenu != -1); exitMainMenu = 0; break; case 1: do { exitMainMenu = Menu.SubMenu(mainMan, subMenu, "TEACHER", exitMainMenu); } while (exitMainMenu != -1); exitMainMenu = 0; break; case 2: do { exitMainMenu = Menu.SubMenu(mainMan, subMenu, "ACCOUNTANT", exitMainMenu); } while (exitMainMenu != -1); exitMainMenu = 0; break; case 3: Print.PrintAll(mainMan); break; case 4: ParseXML.CreateXML(mainMan); break; default: break; } } while (exitMainMenu != -1); }
static public int SubMenu(Man mainMan,Menu subMenu, string str, int exitMainMenu) { switch (subMenu.ShowMenu(subMenu.MainMenu, str)) { case -1: exitMainMenu = -1; break; case 0: mainMan.CreateListStudent(mainMan,str); break; case 1: mainMan.Edit(mainMan,str); break; case 2: Print.PrintInfo(mainMan, str); break; case 3: mainMan.DelIndex(mainMan, str); break; case 4: switch (str) { case "STUDENT": mainMan.ListStudent.Clear(); break; case "TEACHER": mainMan.ListTeacher.Clear(); break; case "ACCOUNTANT": mainMan.ListAccountant.Clear(); break; default: break; } Print.Proces("DELETE"); break; default: break; } return exitMainMenu; }