mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
108 lines
3.0 KiB
C++
108 lines
3.0 KiB
C++
#include <QDebug>
|
|
#include <QTranslator>
|
|
#include "instructorsAndTrainees.h"
|
|
#include "editortrainees.h"
|
|
#include "editorinstructors.h"
|
|
#include "dialogauthorizationinstructor.h"
|
|
|
|
InstructorsAndTrainees::InstructorsAndTrainees(QString appPath):
|
|
dbLMS(new DataBaseLMS()),
|
|
dataBaseTrainees(new DataBaseTrainees(appPath, dbLMS)),
|
|
dataBaseInstructors(new DataBaseInstructors(appPath, dbLMS)),
|
|
appFilePath(appPath)
|
|
{
|
|
|
|
}
|
|
|
|
InstructorsAndTrainees::~InstructorsAndTrainees()
|
|
{
|
|
delete dataBaseTrainees;
|
|
delete dataBaseInstructors;
|
|
delete dbLMS;
|
|
}
|
|
|
|
void InstructorsAndTrainees::EditTrainees(QWidget* parent)
|
|
{
|
|
EditorTrainees editorTraineesGroups(dataBaseTrainees, &computersLocations, parent);
|
|
//dlg.setWindowTitle(tr("List trainees"));
|
|
//dlg.exec();
|
|
//dlg.show();
|
|
QDialog* dialog = new QDialog(parent);
|
|
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
|
layout->addWidget(&editorTraineesGroups);
|
|
dialog->setWindowTitle(tr("List trainees"));
|
|
dialog->setMinimumSize(1400, 800);
|
|
dialog->exec();
|
|
|
|
if(dbLMS == nullptr)
|
|
dataBaseTrainees->SaveTraineesGroupsXML();
|
|
else
|
|
dataBaseTrainees->LoadTraineesGroupsPSQL();
|
|
}
|
|
|
|
void InstructorsAndTrainees::EditInstructors(QWidget *parent)
|
|
{
|
|
EditorInstructors editorInstructors(dataBaseInstructors, parent);
|
|
//dlg.setWindowTitle(tr("List instructors"));
|
|
//dlg.exec();
|
|
//dlg.show();
|
|
QDialog* dialog = new QDialog(parent);
|
|
QHBoxLayout *layout = new QHBoxLayout(dialog);
|
|
layout->addWidget(&editorInstructors);
|
|
dialog->setWindowTitle(tr("List instructors"));
|
|
dialog->setMinimumSize(1400, 800);
|
|
dialog->exec();
|
|
|
|
if(dbLMS == nullptr)
|
|
dataBaseInstructors->SaveInstructorsXML();
|
|
else
|
|
dataBaseInstructors->LoadInstructorsPSQL();
|
|
}
|
|
|
|
bool InstructorsAndTrainees::authorizationInstructor(QWidget* parent)
|
|
{
|
|
DialogAuthorizationInstructor dlg(parent);
|
|
dlg.setWindowTitle(tr("Instructor authorithation"));
|
|
|
|
switch( dlg.exec() )
|
|
{
|
|
case QDialog::Accepted:
|
|
{
|
|
qDebug() << "Accepted";
|
|
|
|
QString login = dlg.getLogin();
|
|
QString password = dlg.getPassword();
|
|
|
|
return dataBaseInstructors->AuthorizationInstructor(login, password);
|
|
//break;
|
|
}
|
|
case QDialog::Rejected:
|
|
qDebug() << "Rejected";
|
|
break;
|
|
default:
|
|
qDebug() << "Unexpected";
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool InstructorsAndTrainees::authorizationTrainee(QString login, QString password, QString learnClass = QStringLiteral(""), QString computer = QStringLiteral(""))
|
|
{
|
|
return dataBaseTrainees->AuthorizationTrainee(login, password, learnClass, computer);
|
|
}
|
|
|
|
bool InstructorsAndTrainees::deAuthorizationTrainee(QString login)
|
|
{
|
|
return dataBaseTrainees->deAuthorizationTrainee(login);
|
|
}
|
|
|
|
bool InstructorsAndTrainees::authorizationInstructor(QString login, QString password)
|
|
{
|
|
return dataBaseInstructors->AuthorizationInstructor(login, password);
|
|
}
|
|
|
|
bool InstructorsAndTrainees::deAuthorizationInstructor(QString login)
|
|
{
|
|
return dataBaseInstructors->deAuthorizationInstructor(login);
|
|
}
|