FactDev  0.1
Databases::CustomerDatabase Class Reference

The CustomerDatabase class Customer table database. More...

#include <customerdatabase.h>

Inheritance diagram for Databases::CustomerDatabase:
Databases::Database

Public Member Functions

WdgModels::CustomersTableModelgetCustomersTable (QString filter="") throw (DbException*)
 CustomerDatabase::getCustomersTable Return an item model of customers for QTableView. More...
 
QStandardItemModel * getTree (QString filter="") throw (DbException*)
 CustomerDatabase::getTree Return an item model of customers for QTree. More...
 
QSharedPointer< Models::CustomergetCustomer (const int pId)
 CustomerDatabase::getCustomer get informations about the customer identified by pId More...
 
int addCustomer (const Models::Customer &)
 CustomerDatabase::addCustomer Add the customer pCustomer to the database. More...
 
void updateCustomer (Customer &)
 CustomerDatabase::updateCustomer Update informations about the customer pCustomer
 
void removeCustomer (const int pId)
 CustomerDatabase::removeCustomer Remove the customer with the id pId More...
 
int getNbCustomers ()
 CustomerDatabase::getNbCustomers Return the number of customers existing. More...
 
QStandardItem * getItemRoot ()
 CustomerDatabase::getItemRoot Return the first item for the QStandardItemModel. More...
 
QStandardItem * getItemCustomer (QSqlQuery q1)
 CustomerDatabase::getItemCustomer Return the customer item for the QStandardItemModel. More...
 
QStandardItem * getItemProject (QSqlQuery q2)
 CustomerDatabase::getItemProject Return the project item for the QStandardItemModel. More...
 
QSharedPointer< Models::CustomergetCustomer (QSqlQuery &q)
 CustomerDatabase::getCustomer Add the element of the q request and return their. More...
 
void updateCustomer (QSqlQuery &q, Customer &pCustomer)
 CustomerDatabase::updateCustomer Update customer data according to the request q More...
 
QPixmap getCustomerImage (const int pId)
 CustomerDatabase::getCustomerImage Return a Customer image. More...
 
void setCustomerImage (Customer &pCustomer)
 CustomerDatabase::setCustomerImage Change the image of the customer pCustomer More...
 
QList< CustomergetCustomers ()
 CustomerDatabase::getCustomers Return all the customers. More...
 
- Public Member Functions inherited from Databases::Database
QString lastError (const QSqlQuery &q) const
 Database::lastError Return an error message on the last error occured during the SQL request q More...
 
void testCases ()
 Database::testCases Realise a test cases.
 
void executeFile (QString pName)
 Database::executerFichier Exeute a specified file named pName More...
 
void openTransaction ()
 Database::openTransaction Open new transaction.
 
void closeTransaction ()
 Database::closeTransaction Close current transaction.
 
void close ()
 Database::close Close database access.
 
void open ()
 Database::open Open database.
 
 ~Database ()
 Database::~Database Suppression object, and close database access.
 
void setDatabase (QSqlDatabase sql)
 Database::setDatabase Set database. More...
 
void updateBillingNumber ()
 Database::updateBillingNumber Update the billing number.
 
void cleanDatabase ()
 Database::clearDatabase Drop alls tables of Database WARNING: We can't restore data after.
 
void changeDatabase (Databases::DbType dbType)
 changeDatabase Change the current database : mysql to sqlite or sqlite to mysql More...
 

Static Public Member Functions

static CustomerDatabaseinstance () throw (DbException*)
 CustomerDatabase::instance Return an instance of CustomerDatabase More...
 
- Static Public Member Functions inherited from Databases::Database
static Databaseinstance (bool tests=false) throw (DbException*)
 Database::getInstance Return an instance of Database. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Databases::Database
 Database (bool tests=false) throw (DbException*)
 Database::Database Database is a singleton.
 
QVariant value (const QSqlQuery &q, const QString &champ) const
 Database::valeur Value of database field. More...
 
- Protected Attributes inherited from Databases::Database
QSettings * _settings
 settings
 
QSqlDatabase mDatabase
 contains Database
 
QList< Database * > _instances
 List of instances.
 
- Static Protected Attributes inherited from Databases::Database
static Database_instance = 0
 Instance.
 
static bool _dbInstance = 0
 an instance of db is open
 
static bool isOpen = false
 Database is open.
 
static bool _isMysql = false
 

Detailed Description

The CustomerDatabase class Customer table database.

Author
Antoine de Roquemaurel
Manantsoa Razanajatovo
Florent Berbie
See Also
Database
Customer

Member Function Documentation

int Databases::CustomerDatabase::addCustomer ( const Models::Customer pCustomer)

CustomerDatabase::addCustomer Add the customer pCustomer to the database.

Returns
customer id
QSharedPointer< Models::Customer > Databases::CustomerDatabase::getCustomer ( const int  pId)

CustomerDatabase::getCustomer get informations about the customer identified by pId

Parameters
pIdcustomer id
Returns
the Customer
QSharedPointer< Models::Customer > Databases::CustomerDatabase::getCustomer ( QSqlQuery &  q)

CustomerDatabase::getCustomer Add the element of the q request and return their.

Parameters
qSQL request
Returns
a customer formed according to QSharedPointer
QPixmap Databases::CustomerDatabase::getCustomerImage ( const int  pId)

CustomerDatabase::getCustomerImage Return a Customer image.

Parameters
pIdCustomer id
Returns
Customer image
QList< Customer > Databases::CustomerDatabase::getCustomers ( )

CustomerDatabase::getCustomers Return all the customers.

Returns
QList of customers
WdgModels::CustomersTableModel * Databases::CustomerDatabase::getCustomersTable ( QString  filter = "")
throw (DbException *
)

CustomerDatabase::getCustomersTable Return an item model of customers for QTableView.

Parameters
filterSelect only customers who are specified by filter
Exceptions
DbException
Returns
QStandardItemModel an item model for QTableView
QStandardItem * Databases::CustomerDatabase::getItemCustomer ( QSqlQuery  q1)

CustomerDatabase::getItemCustomer Return the customer item for the QStandardItemModel.

Parameters
q1the row of the sql query for customers
Returns
QStandardItem an item for QTree (level/depth 1)
QStandardItem * Databases::CustomerDatabase::getItemProject ( QSqlQuery  q2)

CustomerDatabase::getItemProject Return the project item for the QStandardItemModel.

Parameters
q2the row of the sql query for projects
Returns
QStandardItem an item for QTree (level/depth 2)
QStandardItem * Databases::CustomerDatabase::getItemRoot ( )

CustomerDatabase::getItemRoot Return the first item for the QStandardItemModel.

Returns
QStandardItem an item for QTree (level/depth 0)
int Databases::CustomerDatabase::getNbCustomers ( )

CustomerDatabase::getNbCustomers Return the number of customers existing.

Returns
number of customers
QStandardItemModel * Databases::CustomerDatabase::getTree ( QString  filter = "")
throw (DbException *
)

CustomerDatabase::getTree Return an item model of customers for QTree.

Parameters
filterSelect only customers who are specified by filter
Exceptions
DbException
Returns
QStandardItemModel an item model for QTreeView
CustomerDatabase * Databases::CustomerDatabase::instance ( )
throw (DbException *
)
static

CustomerDatabase::instance Return an instance of CustomerDatabase

See Also
DbException
Returns
Instance of CustomerDatabase
void Databases::CustomerDatabase::removeCustomer ( const int  pId)

CustomerDatabase::removeCustomer Remove the customer with the id pId

Parameters
pIdcustomer id
void Databases::CustomerDatabase::setCustomerImage ( Models::Customer pCustomer)

CustomerDatabase::setCustomerImage Change the image of the customer pCustomer

Parameters
pCustomerCustomer
void Databases::CustomerDatabase::updateCustomer ( QSqlQuery &  q,
Customer pCustomer 
)

CustomerDatabase::updateCustomer Update customer data according to the request q

Parameters
qSQL request

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