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:
@@ -15,7 +15,7 @@ EditorInstructors::EditorInstructors(ConnectorToServer* connectorToServer, bool
|
||||
|
||||
this->adminMode = adminMode;
|
||||
|
||||
preparationTreeWidget(/*ui->treeWidget*/);
|
||||
preparationTreeWidget();
|
||||
//setNotLoggedInVisible(true);
|
||||
loadInstructorsFromDB();
|
||||
|
||||
@@ -107,8 +107,6 @@ void EditorInstructors::on_btnDeleteInstructor_clicked()
|
||||
if(QMessageBox::warning(this, tr("Attention!"), tr("The deletion will be irrevocable.\nDelete it anyway?"), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
|
||||
{
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR, id);
|
||||
//if(dbLMS->delInstructor(id))
|
||||
//loadInstructorsFromDB();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,15 +128,10 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
|
||||
if(instructor.getID() == 0)
|
||||
return;
|
||||
|
||||
if(connectorToServer->isArchivedInstructor(id)/* instructor.getArchived()*/)
|
||||
if(connectorToServer->isArchivedInstructor(id))
|
||||
{//Архивный
|
||||
instructor.setArchived(false);
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR, id, &instructor);
|
||||
/*if(int id_edit = dbLMS->editInstructor(instructor))
|
||||
{
|
||||
loadInstructorsFromDB();
|
||||
setCurrentInstructor(id_edit);
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{//Не Архивный
|
||||
@@ -150,6 +143,8 @@ void EditorInstructors::on_btnToOrFromArchive_clicked()
|
||||
|
||||
instructor.setArchived(true);
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR, id, &instructor);
|
||||
if(!archiveVisible)
|
||||
ui->btnArchive->click();
|
||||
/*if(int id_edit = dbLMS->editInstructor(instructor))
|
||||
{
|
||||
if(!archiveVisible)
|
||||
@@ -197,25 +192,8 @@ void EditorInstructors::on_btnEdit_clicked()
|
||||
case QDialog::Accepted:
|
||||
{
|
||||
Instructor instructor_edit = dlg.getInstructor();
|
||||
|
||||
connectorToServer->sendQueryToDB(TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR, id, &instructor_edit);
|
||||
|
||||
return;
|
||||
/*
|
||||
if(int id_edit = connectorToServer->editInstructor(instructor_edit))
|
||||
{//Отредактировано
|
||||
loadInstructorsFromDB();
|
||||
setCurrentInstructor(id_edit);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
dlg.setInstructor(instructor_edit);
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
|
||||
break;
|
||||
}
|
||||
case QDialog::Rejected:
|
||||
return;
|
||||
@@ -232,6 +210,10 @@ void EditorInstructors::on_btnArchive_clicked()
|
||||
{
|
||||
bool state = ui->btnArchive->isChecked();
|
||||
setArchiveVisible(state);
|
||||
if(!state)
|
||||
{
|
||||
lastCurrentID = 0;
|
||||
}
|
||||
loadInstructorsFromDB();
|
||||
}
|
||||
|
||||
@@ -248,6 +230,8 @@ void EditorInstructors::on_treeWidget_currentItemChanged(QTreeWidgetItem *curren
|
||||
|
||||
int id = current->text(ColumnsTreeInsructors::clmn_ID).toInt();
|
||||
|
||||
lastCurrentID = id;
|
||||
|
||||
if(connectorToServer->isArchivedInstructor(id))
|
||||
{//Архивный
|
||||
ui->btnToOrFromArchive->setText(tr("From archive"));
|
||||
@@ -284,16 +268,4 @@ void EditorInstructors::on_treeWidget_currentItemChanged(QTreeWidgetItem *curren
|
||||
}
|
||||
}
|
||||
|
||||
void EditorInstructors::setCurrentInstructor(int id)
|
||||
{
|
||||
for(int i = 0; i < treeWidget->topLevelItemCount(); i++)
|
||||
{
|
||||
QTreeWidgetItem * item = treeWidget->topLevelItem(i);
|
||||
if(item != nullptr)
|
||||
if(item->text(ColumnsTreeInsructors::clmn_ID).toInt() == id)
|
||||
{
|
||||
treeWidget->setCurrentItem(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user