//#include #include "User.h" #include "Parser.h" #include "DBEngine.h" using namespace std; //Global objects used through the app DBEngine engine; vector users; vector boards; vector mesages; vector groups; vector
articles; User currentUser; //bool isLoggedIn = false; vector pendingAccounts; //accounts waiting to be approved by the admin void goToBoard() { cout<<"*********************************"<>n; cout<<"\nPassword: "<>pass; cout<<"\nPhone: "<>phone; cout<<"\nFax: "<>fax; cout<<"Postal code: "<>postal; addToPendingList(n,pass,phone,fax,postal,false); cout<<"\n8. Return to login menu"<>name; cin.clear(); cin.ignore(); cout<<"\nPassword: "<>password; cin.clear(); cin.ignore(); if (verifyCredentials(name,password)) { break; } else { cout<<"Invalid credentials!"<> choice; switch(choice) { case 0: changeUsername(); break; case 1: changePassword(); break; case 2: changePhone(); break; case 3: changeFax(); break; case 4: changePostal(); break; case 5: mainMenu(); break; } } void yourAccount() { cout<<"*********************************"<> choice; switch(choice) { case 0: mainMenu(); break; case 1: editAccountMenu(); break; } } void showMessages() { cout<<"\n\n0. Return to main menu"<> choice; switch(choice) { case 0: mainMenu(); break; } } void showBoards() { parse("SHOW Boards ;", engine); cout<<"\n\n0. Return to main menu?"<> 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!"< userAttributes; userAttributes.push_back(userAt1); userAttributes.push_back(userAt2); userAttributes.push_back(userAt3); userAttributes.push_back(userAt4); //Relation userRelation("User Relation", userAttributes); //Message Relation & Attributes Attribute messageAt1("Sender", "VARCHAR(20)", true); Attribute messageAt2("Receiver", "VARCHAR(20)", false); Attribute messageAt3("Time Stamp", "VARCHAR(20)", false); Attribute messageAt4("Text", "VARCHAR(20)", false); vector messageAttributes; messageAttributes.push_back(messageAt1); messageAttributes.push_back(messageAt2); messageAttributes.push_back(messageAt3); messageAttributes.push_back(messageAt4); //Relation messageRelation("Messages", messageAttributes); //Board Relation & Attributes Attribute boardAt1("Name", "VARCHAR(20)", true); Attribute boardAt2("Description", "VARCHAR(20)", false); Attribute boardAt3("Group", "VARCHAR(20)", false); vector boardAttributes; boardAttributes.push_back(boardAt1); boardAttributes.push_back(boardAt2); boardAttributes.push_back(boardAt3); //Relation boardRelation("Board Relation", boardAttributes); //Group Relation & Attributes Attribute groupAt1("Name", "VARCHAR(20)", true); Attribute groupAt2("Description", "VARCHAR(20)", false); vector groupAttributes; groupAttributes.push_back(groupAt1); groupAttributes.push_back(groupAt2); Relation groupRelation("Group Relation", groupAttributes); //Article Relation & Attributes Attribute articleAt1("Author", "VARCHAR(20)", true); Attribute articleAt2("Time Stamp", "VARCHAR(20)", false); Attribute articleAt3("Length", "VARCHAR(20)", false); vector articleAttributes; articleAttributes.push_back(articleAt1); articleAttributes.push_back(articleAt2); articleAttributes.push_back(articleAt3); //Relation articleRelation("Article Relation", articleAttributes); cout<<"***************************************"<>choice; eventHandler(choice); } engine.save(); }