00001 /* 00002 * Copyright (c) 2010 Ferruccio Vitale <unixo@devzero.it> 00003 * All rights reserved. 00004 * 00005 * $Id: UserMenu.h 75 2010-09-13 09:25:53Z unixo $ 00006 */ 00007 00008 #ifndef __USERMENU_H__ 00009 #define __USERMENU_H__ 00010 00011 #include "common.h" 00012 #include "User.h" 00013 #include "Exceptions.h" 00014 00015 class UserMenu; 00016 00017 typedef void (UserMenu::*op)(); 00018 00022 class UserMenu 00023 { 00024 private: 00025 User *_currentUser; 00026 map<int, op> usr_operations; 00027 map<int, op> adm_operations; 00028 00029 void printCatalog(int aCid = 0); 00030 00031 // user operations 00032 void browseProductCatalog() throw (BadAuthException); 00033 void showProductDetail() throw (BadAuthException); 00034 void showConfigurationByProduct() throw (BadAuthException); 00035 void showUserProfile() throw (BadAuthException); 00036 void placeNewOrder() throw (BadAuthException); 00037 00038 // admin operations 00039 void addNewCategory() throw (BadAuthException); 00040 void addNewProduct() throw (BadAuthException); 00041 void changeProductDetail() throw (BadAuthException); 00042 void disableUser() throw (BadAuthException); 00043 void displayMonthlyTrend() throw (BadAuthException); 00044 void deleteProduct() throw (BadAuthException); 00045 00046 void displayUnprivilegedMenu() throw (BadAuthException); 00047 void displayAdminMenu() throw (BadAuthException); 00048 void wait(); 00049 00050 bool getNotEmptyLine(const string & msg, string *buffer); 00051 00052 protected: 00053 void enableSttyEcho(bool bValue = true); 00054 00055 public: 00056 UserMenu(); 00057 ~UserMenu(); 00058 00059 void mainMenu(); 00060 bool login(); 00061 void display() throw (BadAuthException); 00062 void registerNewUser(); 00063 }; 00064 00065 #endif /* __USERMENU_H__ */