Setup codebase
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
#include "ComboPackage.h"
|
||||
|
||||
int ComboPackage::m_uid = 0;
|
||||
|
||||
ComboPackage::ComboPackage()
|
||||
: m_id("CMP" + std::to_string(++m_uid)),
|
||||
m_discountPercentage(0.0) {}
|
||||
|
||||
ComboPackage::ComboPackage(const std::string& packageName, double discountPercentage, const util::Map<std::string, Service*>& services)
|
||||
: m_id("CMP" + std::to_string(++m_uid)),
|
||||
m_packageName(packageName),
|
||||
m_discountPercentage(discountPercentage),
|
||||
m_services(services) {}
|
||||
|
||||
const std::string& ComboPackage::getId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
const std::string& ComboPackage::getPackageName() const
|
||||
{
|
||||
return m_packageName;
|
||||
}
|
||||
|
||||
double ComboPackage::getDiscountPercentage() const
|
||||
{
|
||||
return m_discountPercentage;
|
||||
}
|
||||
|
||||
const util::Map<std::string, Service*>& ComboPackage::getServices() const
|
||||
{
|
||||
return m_services;
|
||||
}
|
||||
|
||||
void ComboPackage::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void ComboPackage::setPackageName(const std::string& packageName)
|
||||
{
|
||||
m_packageName = packageName;
|
||||
}
|
||||
|
||||
void ComboPackage::setDiscountPercentage(double discountPercentage)
|
||||
{
|
||||
m_discountPercentage = discountPercentage;
|
||||
}
|
||||
|
||||
void ComboPackage::setServices(const util::Map<std::string, Service*>& services)
|
||||
{
|
||||
m_services = services;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Map.h"
|
||||
|
||||
class Service;
|
||||
|
||||
class ComboPackage
|
||||
{
|
||||
private:
|
||||
static int m_uid;
|
||||
std::string m_id;
|
||||
std::string m_packageName;
|
||||
double m_discountPercentage;
|
||||
util::Map<std::string, Service*> m_services;
|
||||
public:
|
||||
ComboPackage();
|
||||
ComboPackage(const std::string& packageName, double discountPercentage, const util::Map<std::string, Service*>& services);
|
||||
const std::string& getId() const;
|
||||
const std::string& getPackageName() const;
|
||||
double getDiscountPercentage() const;
|
||||
const util::Map<std::string, Service*>& getServices() const;
|
||||
void setId(const std::string& id);
|
||||
void setPackageName(const std::string& packageName);
|
||||
void setDiscountPercentage(double discountPercentage);
|
||||
void setServices(const util::Map<std::string, Service*>& services);
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
#include "InventoryItem.h"
|
||||
|
||||
int InventoryItem::m_uid = 0;
|
||||
|
||||
InventoryItem::InventoryItem()
|
||||
: m_id("IIM" + std::to_string(++m_uid)),
|
||||
m_quantity(0),
|
||||
m_price(0.0) {}
|
||||
|
||||
InventoryItem::InventoryItem(const std::string& partName, int quantity, double price)
|
||||
: m_id("IIM" + std::to_string(++m_uid)),
|
||||
m_partName(partName),
|
||||
m_quantity(quantity),
|
||||
m_price(price) {}
|
||||
|
||||
const std::string& InventoryItem::getId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
const std::string& InventoryItem::getPartName() const
|
||||
{
|
||||
return m_partName;
|
||||
}
|
||||
|
||||
int InventoryItem::getQuantity() const
|
||||
{
|
||||
return m_quantity;
|
||||
}
|
||||
|
||||
double InventoryItem::getPrice() const
|
||||
{
|
||||
return m_price;
|
||||
}
|
||||
|
||||
void InventoryItem::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void InventoryItem::setPartName(const std::string& partName)
|
||||
{
|
||||
m_partName = partName;
|
||||
}
|
||||
|
||||
void InventoryItem::setQuantity(int quantity)
|
||||
{
|
||||
m_quantity = quantity;
|
||||
}
|
||||
|
||||
void InventoryItem::setPrice(double price)
|
||||
{
|
||||
m_price = price;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class InventoryItem
|
||||
{
|
||||
private:
|
||||
static int m_uid;
|
||||
std::string m_id;
|
||||
std::string m_partName;
|
||||
int m_quantity;
|
||||
double m_price;
|
||||
public:
|
||||
InventoryItem();
|
||||
InventoryItem(const std::string& partName, int quantity, double price);
|
||||
const std::string& getId() const;
|
||||
const std::string& getPartName() const;
|
||||
int getQuantity() const;
|
||||
double getPrice() const;
|
||||
void setId(const std::string& id);
|
||||
void setPartName(const std::string& partName);
|
||||
void setQuantity(int quantity);
|
||||
void setPrice(double price);
|
||||
};
|
||||
@@ -0,0 +1,159 @@
|
||||
#include "Invoice.h"
|
||||
|
||||
int Invoice::m_uid = 0;
|
||||
|
||||
Invoice::Invoice()
|
||||
: m_id("INV" + std::to_string(++m_uid)),
|
||||
m_booking(nullptr),
|
||||
m_laborCost(0.0),
|
||||
m_partsCost(0.0),
|
||||
m_discountPercentage(0.0),
|
||||
m_totalAmount(0.0),
|
||||
m_paymentMethod(util::PaymentMode()),
|
||||
m_status(util::PaymentStatus()) {}
|
||||
|
||||
Invoice::Invoice(
|
||||
const std::string& bookingId,
|
||||
ServiceBooking* booking,
|
||||
const util::Timestamp& invoiceDate,
|
||||
double laborCost, const util::Map<int,
|
||||
InventoryItem*>& parts,
|
||||
double partsCost,
|
||||
double discountPercentage,
|
||||
double totalAmount,
|
||||
const util::Timestamp& paymentDate,
|
||||
util::PaymentMode paymentMethod,
|
||||
util::PaymentStatus status
|
||||
)
|
||||
: m_id("INV" + std::to_string(++m_uid)),
|
||||
m_bookingId(bookingId),
|
||||
m_booking(booking),
|
||||
m_invoiceDate(invoiceDate),
|
||||
m_laborCost(laborCost),
|
||||
m_parts(parts),
|
||||
m_partsCost(partsCost),
|
||||
m_discountPercentage(discountPercentage),
|
||||
m_totalAmount(totalAmount),
|
||||
m_paymentDate(paymentDate),
|
||||
m_paymentMethod(paymentMethod),
|
||||
m_status(status) {}
|
||||
|
||||
const std::string& Invoice::getId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
const std::string& Invoice::getBookingId() const
|
||||
{
|
||||
return m_bookingId;
|
||||
}
|
||||
|
||||
ServiceBooking* Invoice::getBooking() const
|
||||
{
|
||||
return m_booking;
|
||||
}
|
||||
|
||||
const util::Timestamp& Invoice::getInvoiceDate() const
|
||||
{
|
||||
return m_invoiceDate;
|
||||
}
|
||||
|
||||
double Invoice::getLaborCost() const
|
||||
{
|
||||
return m_laborCost;
|
||||
}
|
||||
|
||||
const util::Map<int, InventoryItem*>& Invoice::getParts() const
|
||||
{
|
||||
return m_parts;
|
||||
}
|
||||
|
||||
double Invoice::getPartsCost() const
|
||||
{
|
||||
return m_partsCost;
|
||||
}
|
||||
|
||||
double Invoice::getDiscountPercentage() const
|
||||
{
|
||||
return m_discountPercentage;
|
||||
}
|
||||
|
||||
double Invoice::getTotalAmount() const
|
||||
{
|
||||
return m_totalAmount;
|
||||
}
|
||||
|
||||
const util::Timestamp& Invoice::getPaymentDate() const
|
||||
{
|
||||
return m_paymentDate;
|
||||
}
|
||||
|
||||
util::PaymentMode Invoice::getPaymentMethod() const
|
||||
{
|
||||
return m_paymentMethod;
|
||||
}
|
||||
|
||||
util::PaymentStatus Invoice::getStatus() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
void Invoice::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void Invoice::setBookingId(const std::string& bookingId)
|
||||
{
|
||||
m_bookingId = bookingId;
|
||||
}
|
||||
|
||||
void Invoice::setBooking(ServiceBooking* booking)
|
||||
{
|
||||
m_booking = booking;
|
||||
}
|
||||
|
||||
void Invoice::setInvoiceDate(const util::Timestamp& invoiceDate)
|
||||
{
|
||||
m_invoiceDate = invoiceDate;
|
||||
}
|
||||
|
||||
void Invoice::setLaborCost(double laborCost)
|
||||
{
|
||||
m_laborCost = laborCost;
|
||||
}
|
||||
|
||||
void Invoice::setParts(const util::Map<int, InventoryItem*>& parts)
|
||||
{
|
||||
m_parts = parts;
|
||||
}
|
||||
|
||||
void Invoice::setPartsCost(double partsCost)
|
||||
{
|
||||
m_partsCost = partsCost;
|
||||
}
|
||||
|
||||
void Invoice::setDiscountPercentage(double discountPercentage)
|
||||
{
|
||||
m_discountPercentage = discountPercentage;
|
||||
}
|
||||
|
||||
void Invoice::setTotalAmount(double totalAmount)
|
||||
{
|
||||
m_totalAmount = totalAmount;
|
||||
}
|
||||
|
||||
void Invoice::setPaymentDate(const util::Timestamp& paymentDate)
|
||||
{
|
||||
m_paymentDate = paymentDate;
|
||||
}
|
||||
|
||||
void Invoice::setPaymentMethod(util::PaymentMode paymentMethod)
|
||||
{
|
||||
m_paymentMethod = paymentMethod;
|
||||
}
|
||||
|
||||
void Invoice::setStatus(util::PaymentStatus status)
|
||||
{
|
||||
m_status = status;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Map.h"
|
||||
#include "Timestamp.h"
|
||||
#include "Enums.h"
|
||||
|
||||
class ServiceBooking;
|
||||
class InventoryItem;
|
||||
|
||||
class Invoice
|
||||
{
|
||||
private:
|
||||
static int m_uid;
|
||||
std::string m_id;
|
||||
std::string m_bookingId;
|
||||
ServiceBooking* m_booking;
|
||||
util::Timestamp m_invoiceDate;
|
||||
double m_laborCost;
|
||||
util::Map<int, InventoryItem*> m_parts;
|
||||
double m_partsCost;
|
||||
double m_discountPercentage;
|
||||
double m_totalAmount;
|
||||
util::Timestamp m_paymentDate;
|
||||
util::PaymentMode m_paymentMethod;
|
||||
util::PaymentStatus m_status;
|
||||
|
||||
public:
|
||||
Invoice();
|
||||
Invoice(
|
||||
const std::string& bookingId,
|
||||
ServiceBooking* booking,
|
||||
const util::Timestamp& invoiceDate,
|
||||
double laborCost, const util::Map<int,
|
||||
InventoryItem*>& parts,
|
||||
double partsCost,
|
||||
double discountPercentage,
|
||||
double totalAmount,
|
||||
const util::Timestamp& paymentDate,
|
||||
util::PaymentMode paymentMethod,
|
||||
util::PaymentStatus status
|
||||
);
|
||||
const std::string& getId() const;
|
||||
const std::string& getBookingId() const;
|
||||
ServiceBooking* getBooking() const;
|
||||
const util::Timestamp& getInvoiceDate() const;
|
||||
double getLaborCost() const;
|
||||
const util::Map<int, InventoryItem*>& getParts() const;
|
||||
double getPartsCost() const;
|
||||
double getDiscountPercentage() const;
|
||||
double getTotalAmount() const;
|
||||
const util::Timestamp& getPaymentDate() const;
|
||||
util::PaymentMode getPaymentMethod() const;
|
||||
util::PaymentStatus getStatus() const;
|
||||
void setId(const std::string& id);
|
||||
void setBookingId(const std::string& bookingId);
|
||||
void setBooking(ServiceBooking* booking);
|
||||
void setInvoiceDate(const util::Timestamp& invoiceDate);
|
||||
void setLaborCost(double laborCost);
|
||||
void setParts(const util::Map<int, InventoryItem*>& parts);
|
||||
void setPartsCost(double partsCost);
|
||||
void setDiscountPercentage(double discountPercentage);
|
||||
void setTotalAmount(double totalAmount);
|
||||
void setPaymentDate(const util::Timestamp& paymentDate);
|
||||
void setPaymentMethod(util::PaymentMode paymentMethod);
|
||||
void setStatus(util::PaymentStatus status);
|
||||
};
|
||||
@@ -0,0 +1,131 @@
|
||||
#include "JobCard.h"
|
||||
|
||||
int JobCard::m_uid = 0;
|
||||
|
||||
JobCard::JobCard()
|
||||
: m_id("JC" + std::to_string(++m_uid)),
|
||||
m_booking(nullptr),
|
||||
m_service(nullptr),
|
||||
m_technician(nullptr),
|
||||
m_status(ServiceJobStatus()) {}
|
||||
|
||||
JobCard::JobCard(const std::string& bookingId,
|
||||
ServiceBooking* booking,
|
||||
Service* service,
|
||||
const std::string& serviceId,
|
||||
const std::string& technicianId,
|
||||
User* technician,
|
||||
const util::Timestamp& assignedDate,
|
||||
ServiceJobStatus status,
|
||||
const util::Timestamp& completionDate
|
||||
)
|
||||
: m_id("JC" + std::to_string(++m_uid)),
|
||||
m_bookingId(bookingId),
|
||||
m_booking(booking),
|
||||
m_service(service),
|
||||
m_serviceId(serviceId),
|
||||
m_technicianId(technicianId),
|
||||
m_technician(technician),
|
||||
m_assignedDate(assignedDate),
|
||||
m_status(status),
|
||||
m_completionDate(completionDate) {}
|
||||
|
||||
const std::string& JobCard::getId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
const std::string& JobCard::getBookingId() const
|
||||
{
|
||||
return m_bookingId;
|
||||
}
|
||||
|
||||
ServiceBooking* JobCard::getBooking() const
|
||||
{
|
||||
return m_booking;
|
||||
}
|
||||
|
||||
Service* JobCard::getService() const
|
||||
{
|
||||
return m_service;
|
||||
}
|
||||
|
||||
const std::string& JobCard::getServiceId() const
|
||||
{
|
||||
return m_serviceId;
|
||||
}
|
||||
|
||||
const std::string& JobCard::getTechnicianId() const
|
||||
{
|
||||
return m_technicianId;
|
||||
}
|
||||
|
||||
User* JobCard::getTechnician() const
|
||||
{
|
||||
return m_technician;
|
||||
}
|
||||
|
||||
const util::Timestamp& JobCard::getAssignedDate() const
|
||||
{
|
||||
return m_assignedDate;
|
||||
}
|
||||
|
||||
ServiceJobStatus JobCard::getStatus() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
const util::Timestamp& JobCard::getCompletionDate() const
|
||||
{
|
||||
return m_completionDate;
|
||||
}
|
||||
|
||||
void JobCard::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void JobCard::setBookingId(const std::string& bookingId)
|
||||
{
|
||||
m_bookingId = bookingId;
|
||||
}
|
||||
|
||||
void JobCard::setBooking(ServiceBooking* booking)
|
||||
{
|
||||
m_booking = booking;
|
||||
}
|
||||
|
||||
void JobCard::setService(Service* service)
|
||||
{
|
||||
m_service = service;
|
||||
}
|
||||
|
||||
void JobCard::setServiceId(const std::string& serviceId)
|
||||
{
|
||||
m_serviceId = serviceId;
|
||||
}
|
||||
|
||||
void JobCard::setTechnicianId(const std::string& technicianId)
|
||||
{
|
||||
m_technicianId = technicianId;
|
||||
}
|
||||
|
||||
void JobCard::setTechnician(User* technician)
|
||||
{
|
||||
m_technician = technician;
|
||||
}
|
||||
|
||||
void JobCard::setAssignedDate(const util::Timestamp& assignedDate)
|
||||
{
|
||||
m_assignedDate = assignedDate;
|
||||
}
|
||||
|
||||
void JobCard::setStatus(ServiceJobStatus status)
|
||||
{
|
||||
m_status = status;
|
||||
}
|
||||
|
||||
void JobCard::setCompletionDate(const util::Timestamp& completionDate)
|
||||
{
|
||||
m_completionDate = completionDate;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Timestamp.h"
|
||||
|
||||
class ServiceBooking;
|
||||
class Service;
|
||||
class User;
|
||||
|
||||
enum class ServiceJobStatus : int;
|
||||
|
||||
class JobCard
|
||||
{
|
||||
private:
|
||||
static int m_uid;
|
||||
std::string m_id;
|
||||
std::string m_bookingId;
|
||||
ServiceBooking* m_booking;
|
||||
Service* m_service;
|
||||
std::string m_serviceId;
|
||||
std::string m_technicianId;
|
||||
User* m_technician;
|
||||
util::Timestamp m_assignedDate;
|
||||
ServiceJobStatus m_status;
|
||||
util::Timestamp m_completionDate;
|
||||
|
||||
public:
|
||||
JobCard();
|
||||
JobCard(const std::string& bookingId,
|
||||
ServiceBooking* booking,
|
||||
Service* service,
|
||||
const std::string& serviceId,
|
||||
const std::string& technicianId,
|
||||
User* technician,
|
||||
const util::Timestamp& assignedDate,
|
||||
ServiceJobStatus status,
|
||||
const util::Timestamp& completionDate
|
||||
);
|
||||
const std::string& getId() const;
|
||||
const std::string& getBookingId() const;
|
||||
ServiceBooking* getBooking() const;
|
||||
Service* getService() const;
|
||||
const std::string& getServiceId() const;
|
||||
const std::string& getTechnicianId() const;
|
||||
User* getTechnician() const;
|
||||
const util::Timestamp& getAssignedDate() const;
|
||||
ServiceJobStatus getStatus() const;
|
||||
const util::Timestamp& getCompletionDate() const;
|
||||
void setId(const std::string& id);
|
||||
void setBookingId(const std::string& bookingId);
|
||||
void setBooking(ServiceBooking* booking);
|
||||
void setService(Service* service);
|
||||
void setServiceId(const std::string& serviceId);
|
||||
void setTechnicianId(const std::string& technicianId);
|
||||
void setTechnician(User* technician);
|
||||
void setAssignedDate(const util::Timestamp& assignedDate);
|
||||
void setStatus(ServiceJobStatus status);
|
||||
void setCompletionDate(const util::Timestamp& completionDate);
|
||||
};
|
||||
@@ -0,0 +1,75 @@
|
||||
#include "Notification.h"
|
||||
|
||||
int Notification::m_uid = 0;
|
||||
|
||||
Notification::Notification()
|
||||
: m_id("NOT" + std::to_string(++m_uid)),
|
||||
m_recipient(nullptr) {}
|
||||
|
||||
Notification::Notification(const std::string& recipientUserId, User* recipient, const std::string& title, const std::string& message, const util::Timestamp& createdAt)
|
||||
: m_id("NOT" + std::to_string(++m_uid)),
|
||||
m_recipientUserId(recipientUserId),
|
||||
m_recipient(recipient),
|
||||
m_title(title),
|
||||
m_message(message),
|
||||
m_createdAt(createdAt) {}
|
||||
|
||||
const std::string& Notification::getId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
const std::string& Notification::getRecipientUserId() const
|
||||
{
|
||||
return m_recipientUserId;
|
||||
}
|
||||
|
||||
User* Notification::getRecipient() const
|
||||
{
|
||||
return m_recipient;
|
||||
}
|
||||
|
||||
const std::string& Notification::getTitle() const
|
||||
{
|
||||
return m_title;
|
||||
}
|
||||
|
||||
const std::string& Notification::getMessage() const
|
||||
{
|
||||
return m_message;
|
||||
}
|
||||
|
||||
const util::Timestamp& Notification::getCreatedAt() const
|
||||
{
|
||||
return m_createdAt;
|
||||
}
|
||||
|
||||
void Notification::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void Notification::setRecipientUserId(const std::string& recipientUserId)
|
||||
{
|
||||
m_recipientUserId = recipientUserId;
|
||||
}
|
||||
|
||||
void Notification::setRecipient(User* recipient)
|
||||
{
|
||||
m_recipient = recipient;
|
||||
}
|
||||
|
||||
void Notification::setTitle(const std::string& title)
|
||||
{
|
||||
m_title = title;
|
||||
}
|
||||
|
||||
void Notification::setMessage(const std::string& message)
|
||||
{
|
||||
m_message = message;
|
||||
}
|
||||
|
||||
void Notification::setCreatedAt(const util::Timestamp& createdAt)
|
||||
{
|
||||
m_createdAt = createdAt;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Timestamp.h"
|
||||
|
||||
class User;
|
||||
|
||||
class Notification
|
||||
{
|
||||
private:
|
||||
static int m_uid;
|
||||
std::string m_id;
|
||||
std::string m_recipientUserId;
|
||||
User* m_recipient;
|
||||
std::string m_title;
|
||||
std::string m_message;
|
||||
util::Timestamp m_createdAt;
|
||||
public:
|
||||
Notification();
|
||||
Notification(const std::string& recipientUserId, User* recipient, const std::string& title, const std::string& message, const util::Timestamp& createdAt);
|
||||
const std::string& getId() const;
|
||||
const std::string& getRecipientUserId() const;
|
||||
User* getRecipient() const;
|
||||
const std::string& getTitle() const;
|
||||
const std::string& getMessage() const;
|
||||
const util::Timestamp& getCreatedAt() const;
|
||||
void setId(const std::string& id);
|
||||
void setRecipientUserId(const std::string& recipientUserId);
|
||||
void setRecipient(User* recipient);
|
||||
void setTitle(const std::string& title);
|
||||
void setMessage(const std::string& message);
|
||||
void setCreatedAt(const util::Timestamp& createdAt);
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
#include "Service.h"
|
||||
|
||||
int Service::m_uid = 0;
|
||||
|
||||
Service::Service()
|
||||
: m_id("SRV" + std::to_string(++m_uid)),
|
||||
m_laborCost(0.0) {}
|
||||
|
||||
Service::Service(const std::string& name, const util::Map<std::string, InventoryItem*>& requiredInventoryItems, double laborCost)
|
||||
: m_id("SRV" + std::to_string(++m_uid)),
|
||||
m_name(name),
|
||||
m_requiredInventoryItems(requiredInventoryItems),
|
||||
m_laborCost(laborCost) {}
|
||||
|
||||
const std::string& Service::getId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
const std::string& Service::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const util::Map<std::string, InventoryItem*>& Service::getRequiredInventoryItems() const
|
||||
{
|
||||
return m_requiredInventoryItems;
|
||||
}
|
||||
|
||||
double Service::getLaborCost() const
|
||||
{
|
||||
return m_laborCost;
|
||||
}
|
||||
|
||||
void Service::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void Service::setName(const std::string& name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
void Service::setRequiredInventoryItems(const util::Map<std::string, InventoryItem*>& requiredInventoryItems)
|
||||
{
|
||||
m_requiredInventoryItems = requiredInventoryItems;
|
||||
}
|
||||
|
||||
void Service::setLaborCost(double laborCost)
|
||||
{
|
||||
m_laborCost = laborCost;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Map.h"
|
||||
|
||||
class InventoryItem;
|
||||
|
||||
class Service
|
||||
{
|
||||
private:
|
||||
static int m_uid;
|
||||
std::string m_id;
|
||||
std::string m_name;
|
||||
util::Map<std::string, InventoryItem*> m_requiredInventoryItems;
|
||||
double m_laborCost;
|
||||
public:
|
||||
Service();
|
||||
Service(const std::string& name, const util::Map<std::string, InventoryItem*>& requiredInventoryItems, double laborCost);
|
||||
const std::string& getId() const;
|
||||
const std::string& getName() const;
|
||||
const util::Map<std::string, InventoryItem*>& getRequiredInventoryItems() const;
|
||||
double getLaborCost() const;
|
||||
void setId(const std::string& id);
|
||||
void setName(const std::string& name);
|
||||
void setRequiredInventoryItems(const util::Map<std::string, InventoryItem*>& requiredInventoryItems);
|
||||
void setLaborCost(double laborCost);
|
||||
};
|
||||
@@ -0,0 +1,146 @@
|
||||
#include "ServiceBooking.h"
|
||||
|
||||
int ServiceBooking::m_uid = 0;
|
||||
|
||||
ServiceBooking::ServiceBooking()
|
||||
: m_id("SRV" + std::to_string(++m_uid)),
|
||||
m_customer(nullptr),
|
||||
m_discountPercentage(0.0) {}
|
||||
|
||||
ServiceBooking::ServiceBooking(
|
||||
const std::string& id,
|
||||
util::ServiceJobStatus status,
|
||||
const util::Map<std::string,
|
||||
Service*>& services,
|
||||
const std::string& customerId,
|
||||
User* customer,
|
||||
const std::string& vehicleNumber,
|
||||
const std::string& vehicleBrand,
|
||||
const std::string& vehicleModel,
|
||||
const std::string& assignedTechnicianId,
|
||||
const std::string& assignedTechnician,
|
||||
double discountPercentage
|
||||
)
|
||||
: m_id("SRV" + std::to_string(++m_uid)),
|
||||
m_status(status),
|
||||
m_services(services),
|
||||
m_customerId(customerId),
|
||||
m_customer(customer),
|
||||
m_vehicleNumber(vehicleNumber),
|
||||
m_vehicleBrand(vehicleBrand),
|
||||
m_vehicleModel(vehicleModel),
|
||||
m_assignedTechnicianId(assignedTechnicianId),
|
||||
m_assignedTechnician(assignedTechnician),
|
||||
m_discountPercentage(discountPercentage)
|
||||
{
|
||||
}
|
||||
|
||||
const std::string& ServiceBooking::getId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
util::ServiceJobStatus ServiceBooking::getStatus() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
const util::Map<std::string, Service*>& ServiceBooking::getServices() const
|
||||
{
|
||||
return m_services;
|
||||
}
|
||||
|
||||
const std::string& ServiceBooking::getCustomerId() const
|
||||
{
|
||||
return m_customerId;
|
||||
}
|
||||
|
||||
User* ServiceBooking::getCustomer() const
|
||||
{
|
||||
return m_customer;
|
||||
}
|
||||
|
||||
const std::string& ServiceBooking::getVehicleNumber() const
|
||||
{
|
||||
return m_vehicleNumber;
|
||||
}
|
||||
|
||||
const std::string& ServiceBooking::getVehicleBrand() const
|
||||
{
|
||||
return m_vehicleBrand;
|
||||
}
|
||||
|
||||
const std::string& ServiceBooking::getVehicleModel() const
|
||||
{
|
||||
return m_vehicleModel;
|
||||
}
|
||||
|
||||
const std::string& ServiceBooking::getAssignedTechnicianId() const
|
||||
{
|
||||
return m_assignedTechnicianId;
|
||||
}
|
||||
|
||||
const std::string& ServiceBooking::getAssignedTechnician() const
|
||||
{
|
||||
return m_assignedTechnician;
|
||||
}
|
||||
|
||||
double ServiceBooking::getDiscountPercentage() const
|
||||
{
|
||||
return m_discountPercentage;
|
||||
}
|
||||
|
||||
void ServiceBooking::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void ServiceBooking::setStatus(const util::ServiceJobStatus& status)
|
||||
{
|
||||
m_status = status;
|
||||
}
|
||||
|
||||
void ServiceBooking::setServices(const util::Map<std::string, Service*>& services)
|
||||
{
|
||||
m_services = services;
|
||||
}
|
||||
|
||||
void ServiceBooking::setCustomerId(const std::string& customerId)
|
||||
{
|
||||
m_customerId = customerId;
|
||||
}
|
||||
|
||||
void ServiceBooking::setCustomer(User* customer)
|
||||
{
|
||||
m_customer = customer;
|
||||
}
|
||||
|
||||
void ServiceBooking::setVehicleNumber(const std::string& vehicleNumber)
|
||||
{
|
||||
m_vehicleNumber = vehicleNumber;
|
||||
}
|
||||
|
||||
void ServiceBooking::setVehicleBrand(const std::string& vehicleBrand)
|
||||
{
|
||||
m_vehicleBrand = vehicleBrand;
|
||||
}
|
||||
|
||||
void ServiceBooking::setVehicleModel(const std::string& vehicleModel)
|
||||
{
|
||||
m_vehicleModel = vehicleModel;
|
||||
}
|
||||
|
||||
void ServiceBooking::setAssignedTechnicianId(const std::string& assignedTechnicianId)
|
||||
{
|
||||
m_assignedTechnicianId = assignedTechnicianId;
|
||||
}
|
||||
|
||||
void ServiceBooking::setAssignedTechnician(const std::string& assignedTechnician)
|
||||
{
|
||||
m_assignedTechnician = assignedTechnician;
|
||||
}
|
||||
|
||||
void ServiceBooking::setDiscountPercentage(double discountPercentage)
|
||||
{
|
||||
m_discountPercentage = discountPercentage;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Map.h"
|
||||
#include "Enums.h"
|
||||
|
||||
class Service;
|
||||
class User;
|
||||
|
||||
class ServiceBooking
|
||||
{
|
||||
private:
|
||||
static int m_uid;
|
||||
std::string m_id;
|
||||
util::ServiceJobStatus m_status;
|
||||
util::Map<std::string, Service*> m_services;
|
||||
std::string m_customerId;
|
||||
User* m_customer;
|
||||
std::string m_vehicleNumber;
|
||||
std::string m_vehicleBrand;
|
||||
std::string m_vehicleModel;
|
||||
std::string m_assignedTechnicianId;
|
||||
std::string m_assignedTechnician;
|
||||
double m_discountPercentage;
|
||||
public:
|
||||
ServiceBooking();
|
||||
ServiceBooking(
|
||||
const std::string& id,
|
||||
util::ServiceJobStatus status,
|
||||
const util::Map<std::string,
|
||||
Service*>& services,
|
||||
const std::string& customerId,
|
||||
User* customer,
|
||||
const std::string& vehicleNumber,
|
||||
const std::string& vehicleBrand,
|
||||
const std::string& vehicleModel,
|
||||
const std::string& assignedTechnicianId,
|
||||
const std::string& assignedTechnician,
|
||||
double discountPercentage
|
||||
);
|
||||
const std::string& getId() const;
|
||||
util::ServiceJobStatus getStatus() const;
|
||||
const util::Map<std::string, Service*>& getServices() const;
|
||||
const std::string& getCustomerId() const;
|
||||
User* getCustomer() const;
|
||||
const std::string& getVehicleNumber() const;
|
||||
const std::string& getVehicleBrand() const;
|
||||
const std::string& getVehicleModel() const;
|
||||
const std::string& getAssignedTechnicianId() const;
|
||||
const std::string& getAssignedTechnician() const;
|
||||
double getDiscountPercentage() const;
|
||||
void setId(const std::string& id);
|
||||
void setStatus(const util::ServiceJobStatus& status);
|
||||
void setServices(const util::Map<std::string, Service*>& services);
|
||||
void setCustomerId(const std::string& customerId);
|
||||
void setCustomer(User* customer);
|
||||
void setVehicleNumber(const std::string& vehicleNumber);
|
||||
void setVehicleBrand(const std::string& vehicleBrand);
|
||||
void setVehicleModel(const std::string& vehicleModel);
|
||||
void setAssignedTechnicianId(const std::string& assignedTechnicianId);
|
||||
void setAssignedTechnician(const std::string& assignedTechnician);
|
||||
void setDiscountPercentage(double discountPercentage);
|
||||
};
|
||||
@@ -0,0 +1,106 @@
|
||||
#include "User.h"
|
||||
#include "Notification.h"
|
||||
#include "Enums.h"
|
||||
|
||||
int User::m_uid = 0;
|
||||
|
||||
User::User()
|
||||
: m_id("USR" + std::to_string(++m_uid)),
|
||||
m_type(util::UserType()) {}
|
||||
|
||||
User::User(const std::string& userName, const std::string& password, const std::string& name, const std::string& phone, const std::string& email, util::UserType role)
|
||||
: m_id("USR" + std::to_string(++m_uid)),
|
||||
m_userName(userName),
|
||||
m_password(password),
|
||||
m_name(name),
|
||||
m_phone(phone),
|
||||
m_email(email),
|
||||
m_type(role) {}
|
||||
|
||||
User::~User()
|
||||
{
|
||||
for (int index = 0; index < m_notifications.getSize(); index++)
|
||||
{
|
||||
delete m_notifications.getValues()[index];
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& User::getId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
const std::string& User::getUserName() const
|
||||
{
|
||||
return m_userName;
|
||||
}
|
||||
|
||||
const std::string& User::getPassword() const
|
||||
{
|
||||
return m_password;
|
||||
}
|
||||
|
||||
const std::string& User::getName() const
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
const std::string& User::getPhone() const
|
||||
{
|
||||
return m_phone;
|
||||
}
|
||||
|
||||
const std::string& User::getEmail() const
|
||||
{
|
||||
return m_email;
|
||||
}
|
||||
|
||||
util::Map<std::string, Notification*>& User::getNotifications()
|
||||
{
|
||||
return m_notifications;
|
||||
}
|
||||
|
||||
util::UserType User::getUserType() const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void User::setId(const std::string& id)
|
||||
{
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
void User::setUserName(const std::string& userName)
|
||||
{
|
||||
m_userName = userName;
|
||||
}
|
||||
|
||||
void User::setPassword(const std::string& password)
|
||||
{
|
||||
m_password = password;
|
||||
}
|
||||
|
||||
void User::setName(const std::string& name)
|
||||
{
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
void User::setPhone(const std::string& phone)
|
||||
{
|
||||
m_phone = phone;
|
||||
}
|
||||
|
||||
void User::setEmail(const std::string& email)
|
||||
{
|
||||
m_email = email;
|
||||
}
|
||||
|
||||
void User::addNotification(Notification* notification)
|
||||
{
|
||||
m_notifications.insert(notification->getId(), notification);
|
||||
}
|
||||
|
||||
void User::setRole(util::UserType role)
|
||||
{
|
||||
m_type = role;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "Map.h"
|
||||
#include "Observer.h"
|
||||
#include "Enums.h"
|
||||
|
||||
class Notification;
|
||||
|
||||
class User : public Observer
|
||||
{
|
||||
private:
|
||||
static int m_uid;
|
||||
std::string m_id;
|
||||
std::string m_userName;
|
||||
std::string m_password;
|
||||
std::string m_name;
|
||||
std::string m_phone;
|
||||
std::string m_email;
|
||||
util::Map<std::string, Notification*> m_notifications;
|
||||
util::UserType m_type;
|
||||
public:
|
||||
User();
|
||||
User(const std::string& userName, const std::string& password, const std::string& name, const std::string& phone, const std::string& email, util::UserType role);
|
||||
~User();
|
||||
const std::string& getId() const;
|
||||
const std::string& getUserName() const;
|
||||
const std::string& getPassword() const;
|
||||
const std::string& getName() const;
|
||||
const std::string& getPhone() const;
|
||||
const std::string& getEmail() const;
|
||||
util::Map<std::string, Notification*>& getNotifications();
|
||||
util::UserType getUserType() const;
|
||||
void setId(const std::string& id);
|
||||
void setUserName(const std::string& userName);
|
||||
void setPassword(const std::string& password);
|
||||
void setName(const std::string& name);
|
||||
void setPhone(const std::string& phone);
|
||||
void setEmail(const std::string& email);
|
||||
void addNotification(Notification* notification);
|
||||
void setRole(util::UserType role);
|
||||
};
|
||||
Reference in New Issue
Block a user