44 lines
No EOL
1.2 KiB
C++
44 lines
No EOL
1.2 KiB
C++
#include "article.h"
|
|
#include "utils.h"
|
|
|
|
#include <iomanip>
|
|
#include <sstream>
|
|
|
|
// Article::Article() : Entity() {}
|
|
|
|
Article::Article(int price) : price_(price) {}
|
|
|
|
// Article::Article(std::shared_ptr<Seller> sellerPtr) : Entity() { sellerPtr_ = sellerPtr; }
|
|
|
|
void Article::setArticleNo(int articleNo) { articleNo_ = articleNo; }
|
|
|
|
void Article::setPrice(int price) { price_ = price; }
|
|
|
|
void Article::setDescription(const std::string& description) { description_ = description; }
|
|
|
|
void Article::setSale(Sale* salePtr) { salePtr_ = salePtr; }
|
|
|
|
void Article::setSeller(Seller* sellerPtr) { sellerPtr_ = sellerPtr; }
|
|
|
|
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_; }
|
|
|
|
std::string Article::getPriceAsString() const
|
|
{
|
|
return formatCentAsEuroString(price_);
|
|
}
|
|
|
|
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();
|
|
} |