FactDev  0.1
project.h
1 #ifndef PROJECT_H
2 #define PROJECT_H
3 
4 #include <QString>
5 #include <QDate>
6 #include <QSharedPointer>
7 
8 #include "models/imodel.h"
9 #include "models/customer.h"
10 
11 namespace Models {
17 class Project : public IModel
18 {
19 public:
23  Project();
27  Project(QString name);
33  Project(int id);
34 
38  virtual ~Project();
39 
43  void commit();
44 
50  void hydrat(int id);
51 
55  void remove();
56 
61  QVariantHash getDataMap();
62 
66  void lock();
67 
71  bool isLocked() const;
72 
76  void unlock();
77 
82  QString getName() const;
83 
88  void setName(const QString &name);
89 
94  QString getDescription() const;
95 
100  void setDescription(const QString &description);
101 
107  QDate getBeginDate() const;
108 
113  void setBeginDate(QDate beginDate);
114 
120  QDate getEndDate() const;
121 
126  void setEndDate(QDate endDate);
127 
132  double getCost() const;
133 
139  double getDailyRate() const;
145  void setDailyRate(double dailyRate);
146 
152  QSharedPointer<Customer> getCustomer() const;
153 
159  void setCustomer(QSharedPointer<Customer> customer);
160 
168  bool operator ==(const Project &p);
169 
176  bool operator <(const Project &p) const;
177 
185  bool operator !=(const Project &p);
186 private:
187  QString _name;
188  QString _description;
189  QDate _beginDate;
190  QDate _endDate;
191  double _cost;
192  double _dailyRate;
193  QSharedPointer<Customer> _customer;
194 };
195 }
196 #endif // PROJECT_H
void setDescription(const QString &description)
Project::setDescription Modify the project description
Definition: project.cpp:99
void setName(const QString &name)
Project::setName Modify the project name
Definition: project.cpp:90
bool operator<(const Project &p) const
Project::operator < defines the operator "< to compare two Project and to see if the fisrt is anterio...
Definition: project.cpp:166
The IModel class.
Definition: imodel.h:13
double getCost() const
Project::getCost Return the Project cost
Definition: project.cpp:124
bool isLocked() const
isLocked Return true if the project is locked : end Date of project is passed.
Definition: project.cpp:81
void hydrat(int id)
Project::hydrat Insert project data which is specified by id in the database.
Definition: project.cpp:50
void setDailyRate(double dailyRate)
Project::setDailyRate Modify the daily rate dailyRate of the current project.
Definition: project.cpp:145
void setCustomer(QSharedPointer< Customer > customer)
Project::setCustomer Modify the customer linked to this project.
Definition: project.cpp:154
The Project class : Project linked to a Customer.
Definition: project.h:17
Project()
Project::Project Construct a Project.
Definition: project.cpp:11
void setBeginDate(QDate beginDate)
Project::setBeginDate Modify beginDate of a Project
Definition: project.cpp:109
bool operator==(const Project &p)
Project::operator == Re-define the operator "==" to compare if the current project is the same to the...
Definition: project.cpp:159
QString getDescription() const
Project::getDescription Return a project description.
Definition: project.cpp:94
void commit()
Project::commit Update project data in the database.
Definition: project.cpp:39
QVariantHash getDataMap()
getDataMap Get all data of model with a HashMap key/value
Definition: project.cpp:67
QSharedPointer< Customer > getCustomer() const
Project::getCustomer Return the reference to the customer linked to this project. ...
Definition: project.cpp:149
void unlock()
unlock Unlock the current project;
Definition: project.cpp:77
QString getName() const
Project::getName Return the project name.
Definition: project.cpp:85
void setEndDate(QDate endDate)
Project::setEndDate Modify endDate of Project
Definition: project.cpp:119
QDate getBeginDate() const
Project::getBeginDate return the date of creation of the Project
Definition: project.cpp:104
virtual ~Project()
~Project Desctruct project object
Definition: project.cpp:34
double getDailyRate() const
Project::getDailyRate Return the daily rate estimated for this project.
Definition: project.cpp:140
bool operator!=(const Project &p)
Project::operator == Re-define the operator "!=" to compare if the current project is differnt to the...
Definition: project.cpp:171
void lock()
lock Lock the current project and change endDate by today();
Definition: project.cpp:72
QDate getEndDate() const
Project::getEndDate Return the endDate of the Project
Definition: project.cpp:114