2018-07-09 16:06:27 +02:00
|
|
|
#include "article.h"
|
2018-08-02 13:06:37 +02:00
|
|
|
#include "utils.h"
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2018-07-23 14:25:18 +02:00
|
|
|
#include <iomanip>
|
|
|
|
#include <sstream>
|
|
|
|
|
2018-07-21 19:24:56 +02:00
|
|
|
// Article::Article() : Entity() {}
|
|
|
|
|
|
|
|
Article::Article(int price) : price_(price) {}
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2018-07-12 14:37:56 +02:00
|
|
|
// Article::Article(std::shared_ptr<Seller> sellerPtr) : Entity() { sellerPtr_ = sellerPtr; }
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2018-07-11 12:52:57 +02:00
|
|
|
void Article::setArticleNo(int articleNo) { articleNo_ = articleNo; }
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2018-07-11 12:52:57 +02:00
|
|
|
void Article::setPrice(int price) { price_ = price; }
|
2018-07-09 16:06:27 +02:00
|
|
|
|
2018-07-11 12:52:57 +02:00
|
|
|
void Article::setDescription(const std::string& description) { description_ = description; }
|
|
|
|
|
2018-07-12 14:37:56 +02:00
|
|
|
void Article::setSale(Sale* salePtr) { salePtr_ = salePtr; }
|
|
|
|
|
|
|
|
void Article::setSeller(Seller* sellerPtr) { sellerPtr_ = sellerPtr; }
|
2018-07-11 12:52:57 +02:00
|
|
|
|
2018-07-12 12:06:55 +02:00
|
|
|
bool Article::isSold() { return salePtr_ ? true : false; }
|
|
|
|
|
|
|
|
std::string Article::getDescription() { return description_; }
|
|
|
|
|
2018-07-12 14:37:56 +02:00
|
|
|
Seller* Article::getSeller() { return sellerPtr_; }
|
2018-07-25 16:04:45 +02:00
|
|
|
Sale* Article::getSale() { return salePtr_; }
|
2018-07-12 13:36:13 +02:00
|
|
|
|
2018-07-20 11:52:26 +02:00
|
|
|
int Article::getPrice() const { return price_; }
|
2018-07-13 13:04:30 +02:00
|
|
|
|
2018-07-23 14:25:18 +02:00
|
|
|
std::string Article::getPriceAsString() const
|
|
|
|
{
|
2018-08-02 13:06:37 +02:00
|
|
|
return formatCentAsEuroString(price_);
|
2018-07-23 14:25:18 +02:00
|
|
|
}
|
|
|
|
|
2018-07-30 14:43:02 +02:00
|
|
|
int Article::getArticleNo() const { return articleNo_; }
|
|
|
|
|
|
|
|
std::string Article::getCompleteArticleNo() const
|
|
|
|
{
|
|
|
|
std::stringstream artNoStream;
|
|
|
|
artNoStream << sourceNo_ << "K" << std::setfill('0') << std::setw(5) << articleNo_;
|
|
|
|
return artNoStream.str();
|
|
|
|
}
|