FactDev  0.1
Databases::ProjectDatabase Class Reference

The ProjectDatabase class Project table database. More...

#include <projectdatabase.h>

Inheritance diagram for Databases::ProjectDatabase:
Databases::Database

Public Member Functions

Models::ProjectgetProject (const int pId)
 ProjectDatabase::getProject Get informations about the project identified by 'pId'. More...
 
Models::ProjectgetProject (QSqlQuery &q)
 ProjectDatabase::getProject. More...
 
int addProject (const Models::Project &)
 ProjectDatabase:addProject Add the project 'pProject' to the database. More...
 
void updateProject (const Models::Project &)
 ProjectDatabase:updateProject Update informations about the project.
 
void removeProject (const int pId)
 removeProject Remove the project with the id 'pId' More...
 
int getNbProjects ()
 ProjectDatabase:getNbProjects Return the number of projects existing. More...
 
int getNbProjects (const int customerId)
 Get the number of projects. More...
 
QMap< int, Models::ProjectgetProjectsOfCustomer (QSharedPointer< Models::Customer > c, const bool projectLocked=true)
 getProjectsOfCustomer Return all projects of a customer More...
 
QList< Models::ProjectgetProjects (const int customerId)
 getProjects Return all projects of a customer More...
 
WdgModels::ProjectsTableModelgetProjectsTable (const int pId) throw (DbException*)
 getProjectsTable Return all projects of a customer in QStandardItemModel More...
 
QSharedPointer< ProjectupdateProject (QSqlQuery &q)
 getProject Obtain a project without new query More...
 
QList< Project * > getAllProjects ()
 Project::getAllProjects Return the list of projects. More...
 
double getCostProjects (QList< Project * > projects)
 ProjectDatabase::getCostProjects compute the cost of the project list given in parameter. 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 ProjectDatabaseinstance () throw (DbException*)
 ProjectDatabase::getInstance Return an instance of ProjectDatabase. 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 ProjectDatabase class Project table database.

Author
Florent Berbie
See Also
Database
Project

Member Function Documentation

int Databases::ProjectDatabase::addProject ( const Models::Project pProject)

ProjectDatabase:addProject Add the project 'pProject' to the database.

Returns
project id
QList< Project * > Databases::ProjectDatabase::getAllProjects ( )

Project::getAllProjects Return the list of projects.

Returns
Projects list
double Databases::ProjectDatabase::getCostProjects ( QList< Project * >  projects)

ProjectDatabase::getCostProjects compute the cost of the project list given in parameter.

Parameters
projectsthe list of projects
Returns
the cost of the list given
int Databases::ProjectDatabase::getNbProjects ( )

ProjectDatabase:getNbProjects Return the number of projects existing.

Returns
number of projects
int Databases::ProjectDatabase::getNbProjects ( const int  customerId)

Get the number of projects.

Parameters
customerIdIf customerId isn't specified if it's not valid, get all projects else get the specified customer projects
Returns
Number of projects in the database for all or for a customer
Models::Project * Databases::ProjectDatabase::getProject ( const int  pId)

ProjectDatabase::getProject Get informations about the project identified by 'pId'.

Parameters
pIdproject
Returns
the project
Models::Project * Databases::ProjectDatabase::getProject ( QSqlQuery &  q)

ProjectDatabase::getProject.

Parameters
q
Returns
QList< Project > Databases::ProjectDatabase::getProjects ( const int  customerId)

getProjects Return all projects of a customer

Parameters
customerIdThe customer id
Returns
List with all projects of customer
QMap< int, Models::Project > Databases::ProjectDatabase::getProjectsOfCustomer ( QSharedPointer< Models::Customer c,
const bool  projectLocked = true 
)

getProjectsOfCustomer Return all projects of a customer

Parameters
cThe customer
Returns
All projects of c with id in key
WdgModels::ProjectsTableModel * Databases::ProjectDatabase::getProjectsTable ( const int  pId)
throw (DbException *
)

getProjectsTable Return all projects of a customer in QStandardItemModel

Parameters
filterSelect only projects who are specified by filter
Returns
QStandardItemModel an item model for QTableView
ProjectDatabase * Databases::ProjectDatabase::instance ( )
throw (DbException *
)
static

ProjectDatabase::getInstance Return an instance of ProjectDatabase.

Returns
Instance of ProjectDatabase
void Databases::ProjectDatabase::removeProject ( const int  pId)

removeProject Remove the project with the id 'pId'

Parameters
pIdproject id
QSharedPointer< Models::Project > Databases::ProjectDatabase::updateProject ( QSqlQuery &  q)

getProject Obtain a project without new query

Parameters
qThe query to use
Returns
The project linked to q

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