сделал newInstructor

This commit is contained in:
krivoshein
2024-12-11 12:50:52 +03:00
parent 4556c07fc9
commit 0cb03e49b1
89 changed files with 1318 additions and 671 deletions

View File

@@ -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()