mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Доделал остальные операции по редактированию
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.11.1, 2024-12-10T17:52:46. -->
|
||||
<!-- Written by QtCreator 4.11.1, 2024-12-11T17:49:41. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
@@ -75,6 +75,10 @@ void DataParser::xmlParser(ClientHandler *client, QByteArray array)
|
||||
|
||||
ClientQueryToDB queryToDB;
|
||||
int id = 0;
|
||||
Instructor instructor;
|
||||
Trainee trainee;
|
||||
Group group;
|
||||
void* data = nullptr;
|
||||
|
||||
/*Перебираем все атрибуты тега*/
|
||||
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
|
||||
@@ -87,9 +91,74 @@ void DataParser::xmlParser(ClientHandler *client, QByteArray array)
|
||||
queryToDB.typeQuery = (TypeQueryToDB)value.toInt();
|
||||
else if(name == "id")
|
||||
id = value.toInt();
|
||||
else
|
||||
{
|
||||
switch (queryToDB.typeQuery)
|
||||
{
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR:
|
||||
if(name == "instructor_id")
|
||||
instructor.setID(value.toInt());
|
||||
else if(name == "name")
|
||||
instructor.setName(value);
|
||||
else if(name == "login")
|
||||
instructor.setLogin(value);
|
||||
else if(name == "password")
|
||||
instructor.setPassword(value);
|
||||
else if(name == "is_admin")
|
||||
instructor.setIsAdmin(value.toInt());
|
||||
else if(name == "archived")
|
||||
instructor.setArchived(value.toInt());
|
||||
else if(name == "logged_in")
|
||||
instructor.setLoggedIn(value.toInt());
|
||||
break;
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE:
|
||||
if(name == "trainee_id")
|
||||
trainee.setID(value.toInt());
|
||||
else if(name == "name")
|
||||
trainee.setName(value);
|
||||
else if(name == "login")
|
||||
trainee.setLogin(value);
|
||||
else if(name == "password")
|
||||
trainee.setPassword(value);
|
||||
else if(name == "archived")
|
||||
trainee.setArchived(value.toInt());
|
||||
else if(name == "logged_in")
|
||||
trainee.setLoggedIn(value.toInt());
|
||||
else if(name == "group_trainee")
|
||||
{
|
||||
Group group(value.toInt(), "");
|
||||
trainee.setGroup(group);
|
||||
}
|
||||
else if(name == "computer_trainee")
|
||||
{
|
||||
Computer computer(value.toInt(), "", "", Classroom());
|
||||
trainee.setComputer(computer);
|
||||
}
|
||||
break;
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
|
||||
if(name == "group_id")
|
||||
group.setID(value.toInt());
|
||||
else if(name == "name")
|
||||
group.setName(value);
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
processingSystem->processingClientQueryToDB(client, queryToDB, id);
|
||||
switch (queryToDB.typeQuery)
|
||||
{
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR:
|
||||
data = &instructor;
|
||||
break;
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE:
|
||||
data = &trainee;
|
||||
break;
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
|
||||
data = &group;
|
||||
break;
|
||||
};
|
||||
|
||||
processingSystem->processingClientQueryToDB(client, queryToDB, id, data);
|
||||
}
|
||||
else if(xmlReader.name() == "ClientMessage")
|
||||
{//Сообщение от клиента
|
||||
|
||||
@@ -113,7 +113,7 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
|
||||
emit sigAuthChanged();
|
||||
}
|
||||
|
||||
void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id)
|
||||
void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id, void* data)
|
||||
{
|
||||
QByteArray arrayAnswer;
|
||||
|
||||
@@ -147,12 +147,56 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR:
|
||||
{
|
||||
providerDBLMS->delInstructor(id);
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR:
|
||||
{
|
||||
providerDBLMS->delInstructor(id);
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR:
|
||||
{
|
||||
providerDBLMS->editInstructor(*(Instructor*)data);
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
|
||||
case TypeQueryToDB::TYPE_QUERY_NEW_TRAINEE:
|
||||
{
|
||||
providerDBLMS->newTrainee(id);
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_DEL_TRAINEE:
|
||||
{
|
||||
providerDBLMS->delTrainee(id);
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE:
|
||||
{
|
||||
providerDBLMS->editTrainee(*(Trainee*)data);
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
|
||||
case TypeQueryToDB::TYPE_QUERY_NEW_GROUP:
|
||||
{
|
||||
providerDBLMS->newGroup();
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_DEL_GROUP:
|
||||
{
|
||||
providerDBLMS->delGroup(id);
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
|
||||
{
|
||||
providerDBLMS->editGroup(*(Group*)data);
|
||||
emit sigAuthChanged();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB_LIST_INSTRUCTORS);
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
void initialize(DataParser* dataParser,ServerLMSWidget *server);
|
||||
void processingClientAutorization(ClientHandler *client, ClientAutorization clientAutorization);
|
||||
void processingClientDeAutorization(ClientHandler *client, ClientDeAutorization clientDeAutorization);
|
||||
void processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id = 0);
|
||||
void processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id = 0, void* data = nullptr);
|
||||
void processingClientMessage(ClientHandler *client, ClientMessage clientMessage);
|
||||
void processingClientNotify(ClientHandler *client, ClientNotify clientNotify);
|
||||
|
||||
|
||||
@@ -262,3 +262,38 @@ int ProviderDBLMS::delInstructor(int id)
|
||||
{
|
||||
return dbLMS->delInstructor(id);
|
||||
}
|
||||
|
||||
int ProviderDBLMS::editInstructor(Instructor instructor)
|
||||
{
|
||||
return dbLMS->editInstructor(instructor);
|
||||
}
|
||||
|
||||
int ProviderDBLMS::newTrainee(int id_group)
|
||||
{
|
||||
return dbLMS->newTrainee(id_group);
|
||||
}
|
||||
|
||||
int ProviderDBLMS::delTrainee(int id)
|
||||
{
|
||||
return dbLMS->delTrainee(id);
|
||||
}
|
||||
|
||||
int ProviderDBLMS::editTrainee(Trainee trainee)
|
||||
{
|
||||
return dbLMS->editTrainee(trainee);
|
||||
}
|
||||
|
||||
int ProviderDBLMS::newGroup()
|
||||
{
|
||||
return dbLMS->newGroup();
|
||||
}
|
||||
|
||||
int ProviderDBLMS::delGroup(int id)
|
||||
{
|
||||
return dbLMS->delGroup(id);
|
||||
}
|
||||
|
||||
int ProviderDBLMS::editGroup(Group group)
|
||||
{
|
||||
return dbLMS->editGroup(group);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,15 @@ public:
|
||||
|
||||
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);
|
||||
|
||||
Q_SIGNALS:
|
||||
//сигнал о блокировке авторизации
|
||||
|
||||
@@ -60,7 +60,14 @@ enum TypeQueryToDB{
|
||||
TYPE_QUERY_GET_LIST_INSTRUCTORS,
|
||||
TYPE_QUERY_GET_ALL_LISTS,
|
||||
TYPE_QUERY_NEW_INSTRUCTOR,
|
||||
TYPE_QUERY_DEL_INSTRUCTOR
|
||||
TYPE_QUERY_DEL_INSTRUCTOR,
|
||||
TYPE_QUERY_EDIT_INSTRUCTOR,
|
||||
TYPE_QUERY_NEW_GROUP,
|
||||
TYPE_QUERY_DEL_GROUP,
|
||||
TYPE_QUERY_EDIT_GROUP,
|
||||
TYPE_QUERY_NEW_TRAINEE,
|
||||
TYPE_QUERY_DEL_TRAINEE,
|
||||
TYPE_QUERY_EDIT_TRAINEE
|
||||
};
|
||||
|
||||
class ClientQueryToDB{
|
||||
|
||||
Reference in New Issue
Block a user