mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
124 lines
3.6 KiB
C++
124 lines
3.6 KiB
C++
#ifndef PROVIDERDBLMS_H
|
||
#define PROVIDERDBLMS_H
|
||
|
||
#include <QObject>
|
||
#include <QDebug>
|
||
#include "interfacedatabaselms.h"
|
||
#include "tasksAmmFim.h"
|
||
|
||
class CheckResult
|
||
{
|
||
public:
|
||
bool resDriver = false;
|
||
bool resUser = false;
|
||
bool resDB = false;
|
||
};
|
||
|
||
class ProviderDBLMS : public QObject
|
||
{
|
||
Q_OBJECT
|
||
public:
|
||
explicit ProviderDBLMS(QObject *parent = nullptr);
|
||
~ProviderDBLMS();
|
||
public:
|
||
QString getMainInstructorName();
|
||
|
||
//Авторизация обучаемого на клиенте
|
||
bool authorizationTrainee(QString login, QString password, InterfaceDataBaseLMS::ErrorAuth& error, QString classroom_name = QStringLiteral(""), QString computer_name = QStringLiteral(""));
|
||
bool deAuthorizationTrainee(QString login);
|
||
QString getNameTraineeByLogin(QString login);
|
||
|
||
//Авторизация инструктора на клиенте
|
||
bool authorizationInstructor(QString login, QString password, InterfaceDataBaseLMS::ErrorAuth& error);
|
||
bool deAuthorizationInstructor(QString login);
|
||
QString getNameInstructorByLogin(QString login);
|
||
|
||
//Общая деавторизация
|
||
bool deAuthorizationAll();
|
||
|
||
//Регистрация тайминга Обучаемого
|
||
bool entryTraineeOnSimulator(int id_trainee);
|
||
bool exitTraineeFromSimulator(int id_trainee);
|
||
|
||
//
|
||
int getIdTraineeByLogin(QString login);
|
||
int getIdInstructorByLogin(QString login);
|
||
QString getLoginTraineeById(int id_trainee);
|
||
|
||
QList<Instructor> GetListAllInstructors();
|
||
QList<Trainee> GetListAllTrainees();
|
||
QList<Group> GetListAllGroups();
|
||
|
||
int newInstructor();
|
||
int delInstructor(int id);
|
||
int editInstructor(Instructor instructor);
|
||
|
||
int newTrainee(int id_group);
|
||
int delTrainee(int id);
|
||
int editTrainee(Trainee trainee);
|
||
|
||
int newGroup();
|
||
int delGroup(int id);
|
||
int editGroup(Group group);
|
||
|
||
int newTaskAMM(TaskAmmFim task, int id_trainee);
|
||
int delTaskAMM(int id);
|
||
int editTaskAMM(TaskAmmFim task);
|
||
|
||
int newTaskFIM(TaskAmmFim task, int id_trainee);
|
||
int delTaskFIM(int id);
|
||
int editTaskFIM(TaskAmmFim task);
|
||
int replaceReportFIM(TaskAmmFim task);
|
||
int changeStatusTaskFIM(int id_task, QString status);
|
||
int changeStatusTaskAMM(int id_task, QString status);
|
||
|
||
QList<TaskAmmFim> GetListTasksAMMofTrainee(int id_trainee);
|
||
QList<TaskAmmFim> GetListTasksFIMofTrainee(int id_trainee);
|
||
|
||
TaskAmmFim getTaskAMMbyID(int id_task);
|
||
TaskAmmFim getTaskFIMbyID(int id_task);
|
||
|
||
Q_SIGNALS:
|
||
//сигнал о блокировке авторизации
|
||
bool signal_BlockAutorization(bool block, QString whoFullName, QString type);
|
||
signals:
|
||
void signal_ErrorPostgreSQL(QString text);
|
||
void signal_StateConnectionToDB(bool dbIsConnected, DataBaseSettings dbSettings);
|
||
|
||
void signal_ResultTryConnectDb(bool result);
|
||
void signal_ResultTryDisConnectDb(bool result);
|
||
|
||
void signal_CheckDBResult(CheckResult result);
|
||
void signal_RepareDBResult(CheckResult result);
|
||
|
||
public slots:
|
||
void slot_TryConnectionToDB();
|
||
void slot_TryDisConnectionFromDB();
|
||
|
||
void slot_CheckDB();
|
||
void slot_RepareDB(CheckResult result);
|
||
|
||
private:
|
||
bool ConnectionToDB();
|
||
void DisConnectionFromDB();
|
||
|
||
public:
|
||
bool DBisConnected();
|
||
DataBaseSettings getDBSettings();
|
||
|
||
//PostgreSQL
|
||
static bool checkDriverQPSQLavailable();
|
||
static bool setUserPasswordPostgres(QString userName, QString password);
|
||
bool checkUserLMSexist();
|
||
bool checkDataBaseLMSexist();
|
||
|
||
bool createUser();
|
||
bool createDB();
|
||
|
||
private:
|
||
InterfaceDataBaseLMS* dbLMS;
|
||
QMutex mtxAccess;
|
||
};
|
||
|
||
#endif // PROVIDERDBLMS_H
|