AdminUser Class Reference

This class is derived from User and is associated to the entity customer of the ER model. More...

#include <User.h>

Inheritance diagram for AdminUser:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 AdminUser (Row &aRow)
 Class constructor by fetched record.
BasketgetBasket ()
OrderplaceOrder () 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.

Detailed Description

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.


Constructor & Destructor Documentation

AdminUser::AdminUser ( Row &  aRow  ) 

Class constructor by fetched record.

Constructs an instance of AdminUser and fill it with data taken from mysqlpp::Row

Parameters:
aRow Record fetched from the database
See also:
ManagedObject, User::User

References LOG_CTOR.

Referenced by userList().


Member Function Documentation

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().

Parameters:
[in] anUser Instance of user to alter
[in] aPasswd New password to assign
Returns:
True if change was successful
See also:
ManagedObject::store()

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.

Parameters:
[in] aPid The product ID to delete
Returns:
True if operation was successful

References Database::getConnection(), Singleton< Database >::instance(), and LOG.

Referenced by UserMenu::deleteProduct().

Basket* AdminUser::getBasket (  )  [inline, virtual]

Implements User.

Order* AdminUser::placeOrder (  )  throw (string) [inline, virtual]

Implements User.

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.

Returns:
Vector of pointer to class User
See also:
AdminUser, NormalUser, std::vector

References AdminUser(), Database::getConnection(), Singleton< Database >::instance(), KEY_USR_ADMIN, and QUERY_ADMIN_USERLST.

Referenced by UserMenu::disableUser().


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2