PNP_PIbd-31_Rodionov_I_A_Co.../service/serviceloaddb.h
2024-12-24 18:02:23 +04:00

45 lines
1002 B
C++

#ifndef SERVICELOADDB_H
#define SERVICELOADDB_H
#include <QObject>
#include <QSql>
#include <QSqlDatabase>
#include <QSqlRecord>
#include <QSqlQuery>
#include <QSqlError>
#include <QString>
#include <QDebug>
#include <QStringList>
#include <QMap>
#include <QList>
#include <QFile>
#include "models/types.h" // IWYU pragma: keep
class ServiceLoadDB : public QObject
{
Q_OBJECT
public:
explicit ServiceLoadDB(QObject *parent = nullptr);
void start();
QMap<int, Location> loadLocations();
QMap<int, Department> loadDepartments();
QMap<int, Manufacturer> loadManufacturers();
QMap<int, DeviceType> loadDeviceTypes();
QMap<int, DeviceModel> loadDeviceModels();
QMap<int, Device> loadDevices();
bool updateDevice(const Device &device);
private:
QList<DeviceStructureElement> readStructureElements(int modelId);
private:
QSqlDatabase db;
QString db_input;
QSqlQuery query;
QMap<int, DeviceModel> mapDeviceModels;
};
#endif // SERVICELOADDB_H