Доделал остальные операции по редактированию

This commit is contained in:
krivoshein
2024-12-12 10:27:18 +03:00
parent 1569df7d94
commit d28453440f
56 changed files with 725 additions and 540 deletions

View File

@@ -31,7 +31,6 @@ EditorInstructors::~EditorInstructors()
void EditorInstructors::on_btnNewInstructor_clicked()
{
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_NEW_INSTRUCTOR);
return;
/*
if(int id_instructor = dbLMS->newInstructor())
@@ -127,36 +126,38 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
int id = treeItemCurrent->text(ColumnsTreeInsructors::clmn_ID).toInt();
Instructor instructor = dbLMS->getInstructor(id);
Instructor instructor = connectorToServer->getInstructor(id);
if(instructor.getID() == 0)
return;
if(instructor.getArchived())
if(connectorToServer->isArchivedInstructor(id)/* instructor.getArchived()*/)
{//Архивный
instructor.setArchived(false);
if(int id_edit = dbLMS->editInstructor(instructor))
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR, id, &instructor);
/*if(int id_edit = dbLMS->editInstructor(instructor))
{
loadInstructorsFromDB();
setCurrentInstructor(id_edit);
}
}*/
}
else
{//Не Архивный
if(dbLMS->isLoggedInInstructor(id))
if(connectorToServer->isLoggedInInstructor(id))
{//Инструктор залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot archive a logged-in instructor."));
return;
}
instructor.setArchived(true);
if(int id_edit = dbLMS->editInstructor(instructor))
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR, id, &instructor);
/*if(int id_edit = dbLMS->editInstructor(instructor))
{
if(!archiveVisible)
ui->btnArchive->click();
loadInstructorsFromDB();
setCurrentInstructor(id_edit);
}
}*/
}
}
}
@@ -175,7 +176,7 @@ void EditorInstructors::on_btnEdit_clicked()
int id = treeItemCurrent->text(ColumnsTreeInsructors::clmn_ID).toInt();
if(dbLMS->isLoggedInInstructor(id))
if(connectorToServer->isLoggedInInstructor(id))
{//Инструктор залогирован!
QMessageBox::critical(this, tr("Error!"), tr("You cannot archive a logged-in instructor."));
return;
@@ -183,7 +184,7 @@ void EditorInstructors::on_btnEdit_clicked()
DialogEditInstructor dlg(this);
Instructor instructor = dbLMS->getInstructor(id);
Instructor instructor = connectorToServer->getInstructor(id);
if(instructor.getID() == 0)
return;
@@ -197,7 +198,11 @@ void EditorInstructors::on_btnEdit_clicked()
{
Instructor instructor_edit = dlg.getInstructor();
if(int id_edit = dbLMS->editInstructor(instructor_edit))
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR, id, &instructor_edit);
return;
/*
if(int id_edit = connectorToServer->editInstructor(instructor_edit))
{//Отредактировано
loadInstructorsFromDB();
setCurrentInstructor(id_edit);
@@ -208,6 +213,7 @@ void EditorInstructors::on_btnEdit_clicked()
dlg.setInstructor(instructor_edit);
continue;
}
*/
break;
}