You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.6 KiB
C

#ifndef CAMPSERVICE_H
#define CAMPSERVICE_H
#include <core.h>
#include <data/addressbookdata.h>
#include <data/accservice.h>
#include <isellableservice.h>
#include "data/camp-data.h"
#include "settings/campsettings.h"
class CampService : public Service<CampData>, public ISellableService
{
public:
CampService();
void addPerson(const CampDataPtr& data, const AddressbookDataPtr& address);
void addService(const CampDataPtr& data, const AccServicePtr& service);
void addService(CampDataPtr data, AccServicePtr service, QDecDouble price, const QString& description);
void setOwner(const CampDataPtr& data, const AddressItemPtr& person);
CampDataPtr create();
void calculate(const CampDataPtr& data);
void saveCamp(const CampDataPtr& data);
//void updateCamp(CampDataPtr data);
//void eraseCamp(CampDataPtr data);
//void loadItems(CampDataPtr data);
QList<CampDataPtr> allForSeason();
private:
ServiceItemPtr addServiceInt(const CampDataPtr& data, const AccServicePtr& service);
void calcPeople(CampDataPtr data);
void calcServices(const CampDataPtr& data);
void calcPrice(const CampDataPtr& data);
void addAccFee(const CampDataPtr& data, const AddressItemPtr& item, int startAge, int endAge, int days);
CampSettingsPtr m_settings;
ISeller *m_seller;
// ISellableService interface
public:
QList<IShopItemPtr> shopItems(const QString& category = "") override;
IShopItemPtr shopItem(int itemId) override;
void addedToVoucher(int itemId, int countAdded) override;
ISeller *seller() override;
};
#endif // CAMPSERVICE_H