mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
сделал newInstructor
This commit is contained in:
@@ -16,10 +16,6 @@ RecognizeSystem::RecognizeSystem(QObject *parent):
|
||||
tmpBlock.clear();
|
||||
countSend = 0;
|
||||
folderList = new QList<QString>;
|
||||
|
||||
listInstructors = new QList<Instructor>;
|
||||
listTrainees = new QList<Trainee>;
|
||||
listGroups = new QList<Group>;
|
||||
}
|
||||
|
||||
RecognizeSystem::~RecognizeSystem()
|
||||
@@ -256,19 +252,29 @@ void RecognizeSystem::recognize(QTcpSocket *socket)
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
|
||||
if(packetType == PacketType::TYPE_XMLANSWER_ON_QUERY_TO_DB){ //ответы формата XML на запросы к БД
|
||||
QByteArray array;
|
||||
stream.startTransaction();
|
||||
stream >> array;
|
||||
//xml-ответы на запросы к БД
|
||||
switch(packetType)
|
||||
{
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS:
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS:
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES:
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_COMPUTERS:
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_CLASSROOMS:
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_TASKS:
|
||||
{
|
||||
QByteArray array;
|
||||
stream.startTransaction();
|
||||
stream >> array;
|
||||
|
||||
if(!stream.commitTransaction()){
|
||||
continue;
|
||||
if(!stream.commitTransaction())
|
||||
continue;
|
||||
|
||||
xmlParserQueryToDB(packetType, array);
|
||||
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
|
||||
xmlParserQueryToDB(array);
|
||||
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
break;
|
||||
};
|
||||
|
||||
packetType = PacketType::TYPE_NONE;
|
||||
}
|
||||
@@ -372,168 +378,153 @@ void RecognizeSystem::xmlParser(QByteArray array)
|
||||
emit sigDeAuth(serverDeAuth);
|
||||
}
|
||||
|
||||
if(xmlReader.name() == "AllLists"){
|
||||
|
||||
xmlReader.readNext();
|
||||
name = xmlReader.name().toString();
|
||||
|
||||
QList<Instructor> listInstructors;
|
||||
|
||||
while(!xmlReader.atEnd())
|
||||
{
|
||||
name = xmlReader.name().toString();
|
||||
|
||||
if(!xmlReader.isStartElement()) {
|
||||
xmlReader.readNext();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(xmlReader.name() == "Instructor")
|
||||
{
|
||||
Instructor instructor;
|
||||
|
||||
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
|
||||
{
|
||||
QString name = attr.name().toString();
|
||||
QString value = attr.value().toString();
|
||||
|
||||
if (name == "instructor_id"){
|
||||
instructor.setID(value.toInt());
|
||||
}
|
||||
if (name == "name"){
|
||||
instructor.setName(value);
|
||||
}
|
||||
if (name == "login"){
|
||||
instructor.setLogin(value);
|
||||
}
|
||||
if (name == "password"){
|
||||
instructor.setPassword(value);
|
||||
}
|
||||
if (name == "is_admin"){
|
||||
instructor.setIsAdmin(value == "true" ? true : false);
|
||||
}
|
||||
if (name == "archived"){
|
||||
instructor.setArchived(value == "true" ? true : false);
|
||||
}
|
||||
if (name == "logged_in"){
|
||||
instructor.setLoggedIn(value == "true" ? true : false);
|
||||
}
|
||||
}
|
||||
|
||||
listInstructors.append(instructor);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//emit sigDeAuth(serverDeAuth);
|
||||
|
||||
xmlReader.readNext();
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
i++;
|
||||
|
||||
*this->listInstructors = listInstructors;
|
||||
//emit sigAnswerQueryToDB(this->listInstructors);
|
||||
}
|
||||
|
||||
xmlReader.readNext();
|
||||
}
|
||||
}
|
||||
|
||||
void RecognizeSystem::xmlParserQueryToDB(QByteArray array)
|
||||
void RecognizeSystem::xmlParserQueryToDB(PacketType packetType, QByteArray array)
|
||||
{
|
||||
QDomDocument groupsTraineesDOM;
|
||||
QDomDocument commonDOM;
|
||||
commonDOM.setContent(array);
|
||||
|
||||
/*
|
||||
QString xmlFileName = appDirPath + "/groupsTrainees.xml";
|
||||
QFile xmlInFile(xmlFileName);
|
||||
if (!xmlInFile.open(QFile::ReadOnly | QFile::Text))
|
||||
switch(packetType)
|
||||
{
|
||||
qDebug() << "LoadTraineesGroupsXML: Не удалось открыть файл " + xmlFileName;
|
||||
return;
|
||||
}
|
||||
else*/
|
||||
{
|
||||
QList<Instructor> listInstructors;
|
||||
QList<Trainee> listTrainees;
|
||||
QList<Group> listGroups;
|
||||
|
||||
listInstructors.clear();
|
||||
listTrainees.clear();
|
||||
listGroups.clear();
|
||||
|
||||
groupsTraineesDOM.setContent(array);
|
||||
|
||||
/*
|
||||
groupsTraineesDOM.setContent(xmlInFile.readAll());
|
||||
xmlInFile.close();*/
|
||||
|
||||
//QDomNode groupsTraineesNode = groupsTraineesDOM.namedItem("groupsTrainees");
|
||||
|
||||
QDomNode allListsNode = groupsTraineesDOM.namedItem("AllLists");
|
||||
|
||||
QDomNode groupsTraineesNode = allListsNode.firstChildElement("GroupsTrainees");
|
||||
QDomNode allInstructorsNode = allListsNode.firstChildElement("Instructors");
|
||||
|
||||
for(int i = 0; i < groupsTraineesNode.childNodes().count(); i++)
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS:
|
||||
{
|
||||
QDomNode groupNode = groupsTraineesNode.childNodes().at(i);
|
||||
if(groupNode.nodeName().toLower() == "group")
|
||||
{//Группа
|
||||
QList<Instructor> listInstructors;
|
||||
QDomNode listNode = commonDOM.namedItem("ListInstructors");
|
||||
|
||||
Group group;
|
||||
group.setName(groupNode.toElement().attribute("group_id"));
|
||||
group.setName(groupNode.toElement().attribute("name"));
|
||||
listGroups.append(group);
|
||||
for(int i = 0; i < listNode.childNodes().count(); i++)
|
||||
{
|
||||
QDomNode instructorNode = listNode.childNodes().at(i);
|
||||
if(instructorNode.nodeName() == "Instructor")
|
||||
{//Инструктор
|
||||
Instructor instructor;
|
||||
instructor.setID(instructorNode.toElement().attribute("instructor_id").toInt());
|
||||
instructor.setName(instructorNode.toElement().attribute("name"));
|
||||
instructor.setLogin(instructorNode.toElement().attribute("login"));
|
||||
instructor.setPassword(instructorNode.toElement().attribute("password"));
|
||||
instructor.setIsAdmin(instructorNode.toElement().attribute("is_admin").toInt());
|
||||
instructor.setArchived(instructorNode.toElement().attribute("archived").toInt());
|
||||
instructor.setLoggedIn(instructorNode.toElement().attribute("logged_in").toInt());
|
||||
|
||||
for(int j = 0; j < groupNode.childNodes().count(); j++)
|
||||
{
|
||||
QDomNode traineeNode = groupNode.childNodes().at(j);
|
||||
if(traineeNode.nodeName().toLower() == "trainee")
|
||||
{//Обучаемый
|
||||
|
||||
Trainee trainee;
|
||||
|
||||
trainee.setID(traineeNode.toElement().attribute("trainee_id").toInt());
|
||||
trainee.setName(traineeNode.toElement().attribute("name"));
|
||||
trainee.setLogin(traineeNode.toElement().attribute("login"));
|
||||
trainee.setPassword(traineeNode.toElement().attribute("password"));
|
||||
trainee.setArchived(traineeNode.toElement().attribute("archived") == QStringLiteral("true") ? true : false);
|
||||
trainee.setArchived(traineeNode.toElement().attribute("logged_in") == QStringLiteral("true") ? true : false);
|
||||
trainee.setGroup(group);
|
||||
|
||||
listTrainees.append(trainee);
|
||||
}
|
||||
listInstructors.append(instructor);
|
||||
}
|
||||
}
|
||||
}//for(int i = 0; i < groupsTraineesNode.childNodes().count(); i++)
|
||||
|
||||
for(int i = 0; i < allInstructorsNode.childNodes().count(); i++)
|
||||
emit sigAnswerQueryToDB_ListInstructors(listInstructors);
|
||||
}
|
||||
break;
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS:
|
||||
{
|
||||
QDomNode instructorNode = allInstructorsNode.childNodes().at(i);
|
||||
if(instructorNode.nodeName().toLower() == "instructor")
|
||||
{//Инструктор
|
||||
QList<Group> listGroups;
|
||||
QDomNode listNode = commonDOM.namedItem("ListGroups");
|
||||
|
||||
Instructor instructor;
|
||||
instructor.setID(instructorNode.toElement().attribute("instructor_id").toInt());
|
||||
instructor.setName(instructorNode.toElement().attribute("name"));
|
||||
instructor.setLogin(instructorNode.toElement().attribute("login"));
|
||||
instructor.setPassword(instructorNode.toElement().attribute("password"));
|
||||
instructor.setIsAdmin(instructorNode.toElement().attribute("is_admin") == QStringLiteral("true") ? true : false);
|
||||
instructor.setArchived(instructorNode.toElement().attribute("archived") == QStringLiteral("true") ? true : false);
|
||||
instructor.setLoggedIn(instructorNode.toElement().attribute("logged_in") == QStringLiteral("true") ? true : false);
|
||||
for(int i = 0; i < listNode.childNodes().count(); i++)
|
||||
{
|
||||
QDomNode groupNode = listNode.childNodes().at(i);
|
||||
if(groupNode.nodeName() == "Group")
|
||||
{//Группа
|
||||
Group group;
|
||||
group.setID(groupNode.toElement().attribute("group_id").toInt());
|
||||
group.setName(groupNode.toElement().attribute("name"));
|
||||
|
||||
listInstructors.append(instructor);
|
||||
listGroups.append(group);
|
||||
}
|
||||
}
|
||||
}//for(int i = 0; i < allInstructorsNode.childNodes().count(); i++)
|
||||
emit sigAnswerQueryToDB_ListGroups(listGroups);
|
||||
}
|
||||
break;
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES:
|
||||
{
|
||||
QList<Trainee> listTrainees;
|
||||
QDomNode listNode = commonDOM.namedItem("ListTrainees");
|
||||
|
||||
*this->listInstructors = listInstructors;
|
||||
*this->listTrainees = listTrainees;
|
||||
*this->listGroups = listGroups;
|
||||
for(int i = 0; i < listNode.childNodes().count(); i++)
|
||||
{
|
||||
QDomNode traineeNode = listNode.childNodes().at(i);
|
||||
if(traineeNode.nodeName() == "Trainee")
|
||||
{//Обучаемый
|
||||
Trainee trainee;
|
||||
trainee.setID(traineeNode.toElement().attribute("trainee_id").toInt());
|
||||
trainee.setName(traineeNode.toElement().attribute("name"));
|
||||
trainee.setLogin(traineeNode.toElement().attribute("login"));
|
||||
trainee.setPassword(traineeNode.toElement().attribute("password"));
|
||||
trainee.setArchived(traineeNode.toElement().attribute("archived").toInt());
|
||||
trainee.setLoggedIn(traineeNode.toElement().attribute("logged_in").toInt());
|
||||
Group group(traineeNode.toElement().attribute("group_trainee").toInt(), "");
|
||||
trainee.setGroup(group);
|
||||
//trainee.setComputer()
|
||||
//trainee.setTasks()
|
||||
|
||||
emit sigAnswerQueryToDB(this->listInstructors, this->listTrainees, this->listGroups);
|
||||
}
|
||||
listTrainees.append(trainee);
|
||||
}
|
||||
}
|
||||
emit sigAnswerQueryToDB_ListTrainees(listTrainees);
|
||||
}
|
||||
break;
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_COMPUTERS:
|
||||
{
|
||||
QList<Computer> listComputers;
|
||||
QDomNode listNode = commonDOM.namedItem("ListComputers");
|
||||
|
||||
for(int i = 0; i < listNode.childNodes().count(); i++)
|
||||
{
|
||||
QDomNode computerNode = listNode.childNodes().at(i);
|
||||
if(computerNode.nodeName() == "Computer")
|
||||
{//Компьютер
|
||||
Computer computer;
|
||||
computer.setID(computerNode.toElement().attribute("computer_id").toInt());
|
||||
computer.setName(computerNode.toElement().attribute("name"));
|
||||
computer.setIpAddress(computerNode.toElement().attribute("ip_address"));
|
||||
//computer.setClassroom
|
||||
|
||||
listComputers.append(computer);
|
||||
}
|
||||
}
|
||||
emit sigAnswerQueryToDB_ListComputers(listComputers);
|
||||
}
|
||||
break;
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_CLASSROOMS:
|
||||
{
|
||||
QList<Classroom> listClassrooms;
|
||||
QDomNode listNode = commonDOM.namedItem("ListClassrooms");
|
||||
|
||||
for(int i = 0; i < listNode.childNodes().count(); i++)
|
||||
{
|
||||
QDomNode classroomNode = listNode.childNodes().at(i);
|
||||
if(classroomNode.nodeName() == "Classroom")
|
||||
{//Класс
|
||||
Classroom classroom;
|
||||
classroom.setID(classroomNode.toElement().attribute("classroom_id").toInt());
|
||||
classroom.setName(classroomNode.toElement().attribute("name"));
|
||||
|
||||
listClassrooms.append(classroom);
|
||||
}
|
||||
}
|
||||
emit sigAnswerQueryToDB_ListClassrooms(listClassrooms);
|
||||
}
|
||||
break;
|
||||
case TYPE_XMLANSWER_QUERY_DB__LIST_TASKS:
|
||||
{
|
||||
QList<Task> listTasks;
|
||||
QDomNode listNode = commonDOM.namedItem("ListTasks");
|
||||
|
||||
for(int i = 0; i < listNode.childNodes().count(); i++)
|
||||
{
|
||||
QDomNode taskNode = listNode.childNodes().at(i);
|
||||
if(taskNode.nodeName() == "Task")
|
||||
{//Задача
|
||||
Task task;
|
||||
task.setID(taskNode.toElement().attribute("task_id").toInt());
|
||||
task.setName(taskNode.toElement().attribute("name"));
|
||||
|
||||
listTasks.append(task);
|
||||
}
|
||||
}
|
||||
emit sigAnswerQueryToDB_ListTasks(listTasks);
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
void RecognizeSystem::checkAccessType(QString type)
|
||||
|
||||
@@ -38,6 +38,13 @@ signals:
|
||||
void sigSocketWaitForReadyRead(int waitTime);
|
||||
void sigStartCompare();
|
||||
|
||||
void sigAnswerQueryToDB_ListInstructors(QList<Instructor> listInstructors);
|
||||
void sigAnswerQueryToDB_ListGroups(QList<Group> listGroups);
|
||||
void sigAnswerQueryToDB_ListTrainees(QList<Trainee> listTrainees);
|
||||
void sigAnswerQueryToDB_ListComputers(QList<Computer> listComputers);
|
||||
void sigAnswerQueryToDB_ListClassrooms(QList<Classroom> listClassrooms);
|
||||
void sigAnswerQueryToDB_ListTasks(QList<Task> listTasks);
|
||||
|
||||
private:
|
||||
QList<QString> *folderList;
|
||||
//MainWindow *mainWindow;
|
||||
@@ -51,12 +58,8 @@ private:
|
||||
qint64 fileSize;
|
||||
int countSend;
|
||||
|
||||
QList<Instructor>* listInstructors;
|
||||
QList<Trainee>* listTrainees;
|
||||
QList<Group>* listGroups;
|
||||
|
||||
void xmlParser(QByteArray array);
|
||||
void xmlParserQueryToDB(QByteArray array);
|
||||
void xmlParserQueryToDB(PacketType packetType, QByteArray array);
|
||||
|
||||
void checkAccessType(QString type);
|
||||
};
|
||||
|
||||
@@ -32,8 +32,13 @@ enum PacketType{
|
||||
TYPE_QT = 9,
|
||||
TYPE_DISABLE = 11,
|
||||
|
||||
TYPE_GET_LIST_INSTRUCTORS = 100,
|
||||
TYPE_XMLANSWER_ON_QUERY_TO_DB = 101 //xml-ответ на запрос к БД
|
||||
//xml-ответы на запросы к БД
|
||||
TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS = 100,
|
||||
TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS = 101,
|
||||
TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES = 102,
|
||||
TYPE_XMLANSWER_QUERY_DB__LIST_COMPUTERS = 103,
|
||||
TYPE_XMLANSWER_QUERY_DB__LIST_CLASSROOMS = 104,
|
||||
TYPE_XMLANSWER_QUERY_DB__LIST_TASKS = 105
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(PacketType)
|
||||
|
||||
@@ -44,7 +44,8 @@ public:
|
||||
|
||||
enum TypeQueryToDB{
|
||||
TYPE_QUERY_GET_LIST_INSTRUCTORS,
|
||||
TYPE_QUERY_GET_ALL_LISTS
|
||||
TYPE_QUERY_GET_ALL_LISTS,
|
||||
TYPE_QUERY_NEW_INSTRUCTOR
|
||||
};
|
||||
|
||||
class ClientQueryToDB{
|
||||
|
||||
@@ -77,6 +77,92 @@ QList<Group> ConnectorToServer::getListGroups()
|
||||
return listGroups;
|
||||
}
|
||||
|
||||
QList<Computer> ConnectorToServer::getListComputers()
|
||||
{
|
||||
return listComputers;
|
||||
}
|
||||
|
||||
QList<Classroom> ConnectorToServer::getListClassrooms()
|
||||
{
|
||||
return listClassrooms;
|
||||
}
|
||||
|
||||
QList<Task> ConnectorToServer::getListTasks()
|
||||
{
|
||||
return listTasks;
|
||||
}
|
||||
|
||||
bool ConnectorToServer::isArchivedInstructor(int id)
|
||||
{
|
||||
for(Instructor instructor : listInstructors)
|
||||
{
|
||||
if(instructor.getID() == id)
|
||||
{
|
||||
if(instructor.getArchived()) return true; else return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConnectorToServer::isAdminInstructor(int id)
|
||||
{
|
||||
for(Instructor instructor : listInstructors)
|
||||
{
|
||||
if(instructor.getID() == id)
|
||||
{
|
||||
if(instructor.getIsAdmin()) return true; else return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConnectorToServer::isLoggedInInstructor(int id)
|
||||
{
|
||||
for(Instructor instructor : listInstructors)
|
||||
{
|
||||
if(instructor.getID() == id)
|
||||
{
|
||||
if(instructor.getLoggedIn()) return true; else return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QList<Trainee> ConnectorToServer::getListTraineesInGroup(int id)
|
||||
{
|
||||
QList<Trainee> list;
|
||||
for(Trainee trainee : listTrainees)
|
||||
{
|
||||
if(trainee.getGroup().getID() == id)
|
||||
list.append(trainee);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
bool ConnectorToServer::isArchivedTrainee(int id)
|
||||
{
|
||||
for(Trainee trainee : listTrainees)
|
||||
{
|
||||
if(trainee.getID() == id)
|
||||
{
|
||||
if(trainee.getArchived()) return true; else return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ConnectorToServer::isLoggedInTrainee(int id)
|
||||
{
|
||||
for(Trainee trainee : listTrainees)
|
||||
{
|
||||
if(trainee.getID() == id)
|
||||
{
|
||||
if(trainee.getLoggedIn()) return true; else return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ConnectorToServer::slot_AnswerQueryToDB(QList<Instructor>* listInstructors,
|
||||
QList<Trainee>* listTrainees,
|
||||
QList<Group>* listGroups)
|
||||
@@ -87,6 +173,44 @@ void ConnectorToServer::slot_AnswerQueryToDB(QList<Instructor>* listInstructors,
|
||||
emit signal_UpdateDB(true, true);
|
||||
}
|
||||
|
||||
void ConnectorToServer::slot_AnswerQueryToDB_ListInstructors(QList<Instructor> listInstructors)
|
||||
{
|
||||
this->listInstructors = listInstructors;
|
||||
emit signal_UpdateDB(true, false);
|
||||
}
|
||||
|
||||
void ConnectorToServer::slot_AnswerQueryToDB_ListGroups(QList<Group> listGroups)
|
||||
{
|
||||
this->listGroups = listGroups;
|
||||
emit signal_UpdateDB(false, true);
|
||||
}
|
||||
|
||||
void ConnectorToServer::slot_AnswerQueryToDB_ListTrainees(QList<Trainee> listTrainees)
|
||||
{
|
||||
this->listTrainees = listTrainees;
|
||||
emit signal_UpdateDB(false, true);
|
||||
}
|
||||
|
||||
void ConnectorToServer::slot_AnswerQueryToDB_ListComputers(QList<Computer> listComputers)
|
||||
{
|
||||
this->listComputers = listComputers;
|
||||
//emit signal_UpdateDB(false, true);
|
||||
}
|
||||
|
||||
void ConnectorToServer::slot_AnswerQueryToDB_ListClassrooms(QList<Classroom> listClassrooms)
|
||||
{
|
||||
this->listClassrooms = listClassrooms;
|
||||
//emit signal_UpdateDB(false, true);
|
||||
}
|
||||
|
||||
void ConnectorToServer::slot_AnswerQueryToDB_ListTasks(QList<Task> listTasks)
|
||||
{
|
||||
this->listTasks = listTasks;
|
||||
//emit signal_UpdateDB(false, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ConnectorToServer::initialize()
|
||||
{
|
||||
createObjects();
|
||||
@@ -110,6 +234,13 @@ void ConnectorToServer::bindConnection()
|
||||
connect(recognizeSystem,&RecognizeSystem::sigAuth,this,&ConnectorToServer::sigLoginResult);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigDeAuth,this,&ConnectorToServer::sigDeLoginResult);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB,this,&ConnectorToServer::slot_AnswerQueryToDB);
|
||||
|
||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB_ListInstructors,this,&ConnectorToServer::slot_AnswerQueryToDB_ListInstructors);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB_ListGroups,this,&ConnectorToServer::slot_AnswerQueryToDB_ListGroups);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB_ListTrainees,this,&ConnectorToServer::slot_AnswerQueryToDB_ListTrainees);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB_ListComputers,this,&ConnectorToServer::slot_AnswerQueryToDB_ListComputers);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB_ListClassrooms,this,&ConnectorToServer::slot_AnswerQueryToDB_ListClassrooms);
|
||||
connect(recognizeSystem,&RecognizeSystem::sigAnswerQueryToDB_ListTasks,this,&ConnectorToServer::slot_AnswerQueryToDB_ListTasks);
|
||||
}
|
||||
|
||||
void ConnectorToServer::createObjects()
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
#include "instructor.h"
|
||||
#include "trainee.h"
|
||||
#include "group.h"
|
||||
#include "computer.h"
|
||||
#include "classroom.h"
|
||||
#include "task.h"
|
||||
|
||||
class ConnectorToServer : public QObject
|
||||
{
|
||||
@@ -21,15 +24,35 @@ public:
|
||||
|
||||
bool sendQueryToDB(TypeQueryToDB typeQuery);
|
||||
|
||||
public:
|
||||
//Запросы к БД (локальной)
|
||||
QList<Instructor> getListInstructors();
|
||||
QList<Trainee> getListTrainees();
|
||||
QList<Group> getListGroups();
|
||||
QList<Computer> getListComputers();
|
||||
QList<Classroom> getListClassrooms();
|
||||
QList<Task> getListTasks();
|
||||
|
||||
bool isArchivedInstructor(int id);
|
||||
bool isAdminInstructor(int id);
|
||||
bool isLoggedInInstructor(int id);
|
||||
|
||||
QList<Trainee> getListTraineesInGroup(int id);
|
||||
bool isArchivedTrainee(int id);
|
||||
bool isLoggedInTrainee(int id);
|
||||
|
||||
public slots:
|
||||
void slot_AnswerQueryToDB(QList<Instructor>* listInstructors,
|
||||
QList<Trainee>* listTrainees,
|
||||
QList<Group>* listGroups);
|
||||
|
||||
void slot_AnswerQueryToDB_ListInstructors(QList<Instructor> listInstructors);
|
||||
void slot_AnswerQueryToDB_ListGroups(QList<Group> listGroups);
|
||||
void slot_AnswerQueryToDB_ListTrainees(QList<Trainee> listTrainees);
|
||||
void slot_AnswerQueryToDB_ListComputers(QList<Computer> listComputers);
|
||||
void slot_AnswerQueryToDB_ListClassrooms(QList<Classroom> listClassrooms);
|
||||
void slot_AnswerQueryToDB_ListTasks(QList<Task> listTasks);
|
||||
|
||||
signals:
|
||||
void sigSetConnect(ServerSettings* serverSettings,QThread *thread);
|
||||
void sigInitializeClient(RecognizeSystem *recognizeSystem,
|
||||
@@ -59,9 +82,13 @@ private:
|
||||
SendSystem *sendSystem;
|
||||
RecognizeSystem *recognizeSystem;
|
||||
|
||||
QList<Instructor> listInstructors;
|
||||
QList<Trainee> listTrainees;
|
||||
//Списочная модель БД СУО
|
||||
QList<Instructor> listInstructors;
|
||||
QList<Group> listGroups;
|
||||
QList<Trainee> listTrainees;
|
||||
QList<Computer> listComputers;
|
||||
QList<Classroom> listClassrooms;
|
||||
QList<Task> listTasks;
|
||||
};
|
||||
|
||||
#endif // CONNECTORTOSERVER_H
|
||||
|
||||
Reference in New Issue
Block a user