diff --git a/DBAppV2.cpp b/DBAppV2.cpp index 4fb481f..7c4ab79 100755 --- a/DBAppV2.cpp +++ b/DBAppV2.cpp @@ -13,6 +13,8 @@ vector mesages; vector groups; vector
articles; User currentUser; +//bool isLoggedIn = false; +vector pendingAccounts; //accounts waiting to be approved by the admin void goToBoard() { @@ -23,17 +25,16 @@ void goToBoard() cout<<"0. Return to main menu"<>postal; - createNewAccount(n,pass,phone,fax,postal,false); + addToPendingList(n,pass,phone,fax,postal,false); + - cout<<"account successfully created!"<> newName; - currentUser.setName(newName); - //Have it update the relation here - cout << "\nName successfully changed!\n" << endl; + string userInput; + cin.ignore(); + getline(cin, userInput); + + //currentUser.setName(userInput); + parse(userInput, engine); + mainMenu(); } void changePassword() { cout<<"Enter new password: "<> newPassword; - currentUser.setPassword(newPassword); - //Have it update the relation here - cout << "\nPassword successfully changed!\n" << endl; + string userInput; + cin.ignore(); + getline(cin, userInput); + + //currentUser.setPassword(userInput); + parse(userInput, engine); mainMenu(); } void changePhone() { cout<<"Enter new phone number: "<> newPhoneNumber; - currentUser.setPhone(newPhoneNumber); - //Have it update the relation here - cout << "\nPhone Number successfully changed!\n" << endl; + string userInput; + cin.ignore(); + getline(cin, userInput); + + //currentUser.setPhone(userInput); + parse(userInput, engine); mainMenu(); } void changeFax() { - cout<<"Enter new fax number: "<> newFaxNumber; - currentUser.setFax(newFaxNumber); - //Have it update the relation here - cout << "\nFax Number successfully changed!\n" << endl; + cout<<"Enter new fax number: "<> newPostalNumber; - currentUser.setPostal(newPostalNumber); - //Have it update the relation here - cout << "\nPostal Number successfully changed!\n" << endl; + cout<<"Enter new fax number: "<> choice; + switch(choice) + { + case 0: mainMenu(); break; + } +} + +void showCurrentUsers() +{ + + parse("SHOW Users ;", engine); + + cout<<"\n\n0. Return to main menu?"<> choice; + switch(choice) + { + case 0: mainMenu(); break; + } +} + +void showArticles() +{ + parse("SHOW Articles ;", engine); + + cout<<"\n\n0. Return to main menu?"<> choice; + switch(choice) + { + case 0: mainMenu(); break; + } +} + +void showGroups() +{ + parse("SHOW Groups ;", engine); + + cout<<"\n\n0. Return to main menu?"<> choice; + switch(choice) + { + case 0: mainMenu(); break; + } +} + +void enterCommand() +{ + + string userInput; + cin.ignore(); + getline(cin, userInput); + + parse(userInput, engine); + + cout<<"\n\n0. Return to main menu?"<> choice; + switch(choice) + { + case 0: mainMenu(); break; + } +} + +void approvePending() +{ + cout<<"\nEnter the user number to approve: "<>user; + + //make it idiotProof for invalid input? + + users.push_back(pendingAccounts[user]); + pendingAccounts.erase(pendingAccounts.begin()+user); + + + cout<<"Account approved!"<>user; + + //make it idiotProof for invalid input? + + pendingAccounts.erase(pendingAccounts.begin()+user); + + cout<<"Account rejected!"<>choice; eventHandler(choice); } + + engine.save(); }