Initial implementation of salemodel
This commit is contained in:
parent
bc67018c1c
commit
e24b6c4e5f
11 changed files with 212 additions and 1 deletions
|
@ -24,6 +24,7 @@ bool Article::isSold() { return salePtr_ ? true : false; }
|
|||
std::string Article::getDescription() { return description_; }
|
||||
|
||||
Seller* Article::getSeller() { return sellerPtr_; }
|
||||
Sale* Article::getSale() { return salePtr_; }
|
||||
|
||||
int Article::getPrice() const { return price_; }
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ class Article : public Entity
|
|||
int getArticleNo();
|
||||
std::string getDescription();
|
||||
Seller* getSeller();
|
||||
Sale* getSale();
|
||||
int getPrice() const;
|
||||
std::string getPriceAsString() const;
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ void Marketplace::loadFromDb()
|
|||
|
||||
SellersVec& Marketplace::getSellers() { return sellers_; }
|
||||
|
||||
SalesVec& Marketplace::getSales() { return sales_; }
|
||||
|
||||
int Marketplace::getNextSellerNo()
|
||||
{
|
||||
auto iter = std::max_element(
|
||||
|
|
|
@ -26,6 +26,7 @@ class Marketplace
|
|||
void loadFromDb();
|
||||
|
||||
SellersVec& getSellers();
|
||||
SalesVec& getSales();
|
||||
int getNextSellerNo();
|
||||
int getNextArticleNo();
|
||||
int getNumSellersDelete();
|
||||
|
|
|
@ -31,6 +31,13 @@ int Sale::sumInCents()
|
|||
return sum;
|
||||
}
|
||||
|
||||
std::string Sale::sumAsString()
|
||||
{
|
||||
std::stringstream sumStream;
|
||||
sumStream << std::right << std::setw(12) << std::showbase << std::put_money(sumInCents(), false);
|
||||
return sumStream.str();
|
||||
}
|
||||
|
||||
std::string Sale::getTimestamp() { return timestamp_; }
|
||||
|
||||
void Sale::setTimestamp(const std::string& timestamp) { timestamp_ = timestamp; }
|
|
@ -20,6 +20,7 @@ class Sale : public Entity
|
|||
ArticlesVec& getArticles();
|
||||
std::string getTimestamp();
|
||||
int sumInCents();
|
||||
std::string sumAsString();
|
||||
|
||||
void removeArticle(const Article* articlePtr);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue