This class is derived from User and is associated to the entity customer of the ER model. More...
#include <User.h>
Public Member Functions | |
AdminUser (Row &aRow) | |
Class constructor by fetched record. | |
Basket * | getBasket () |
Order * | placeOrder () throw (string) |
vector< User * > & | userList () |
Registered user list. | |
bool | changeUserPassword (User &anUser, string aPasswd) |
Change user password Let an administrator to change a user password: this method could also be used to disable a user login. | |
void | showMonthlyTrend () |
Displays the monthly trend of sales, grouped by year/month. | |
bool | deleteProduct (int aPid) |
Delete a product. |
This class is derived from User and is associated to the entity customer of the ER model.
An administrator should be considered an instance of a generic user but with higher privileges, such that he can administer the system. As derived from User, the class must of course implements all virtual pure methods; anyway, the operations of placing an order or getting the product basket have no meaning for an administrator: for this reason, these methods return a null value, which must be handled by the client programmer.
AdminUser::AdminUser | ( | Row & | aRow | ) |
Class constructor by fetched record.
Constructs an instance of AdminUser and fill it with data taken from mysqlpp::Row
aRow | Record fetched from the database |
References LOG_CTOR.
Referenced by userList().
bool AdminUser::changeUserPassword | ( | User & | anUser, | |
string | aPasswd | |||
) |
Change user password Let an administrator to change a user password: this method could also be used to disable a user login.
To make this change persistent, remember to commit by calling store().
[in] | anUser | Instance of user to alter |
[in] | aPasswd | New password to assign |
References KEY_USR_PASSWD, ManagedObject::setValueForKey(), User::uniqueID(), and ManagedObject::update().
Referenced by UserMenu::disableUser().
bool AdminUser::deleteProduct | ( | int | aPid | ) |
Delete a product.
If the product has already been sold in past orders, it's marked as deleted, otherwise it's physically removed from the database.
[in] | aPid | The product ID to delete |
References Database::getConnection(), Singleton< Database >::instance(), and LOG.
Referenced by UserMenu::deleteProduct().
void AdminUser::showMonthlyTrend | ( | ) |
Displays the monthly trend of sales, grouped by year/month.
References Database::getConnection(), Singleton< Database >::instance(), Database::printResult(), and QUERY_ADMIN_TREND.
Referenced by UserMenu::displayMonthlyTrend().
vector< User * > & AdminUser::userList | ( | ) |
Registered user list.
Returns the list of currently registered users, even if locked.
References AdminUser(), Database::getConnection(), Singleton< Database >::instance(), KEY_USR_ADMIN, and QUERY_ADMIN_USERLST.
Referenced by UserMenu::disableUser().