mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
PSQL 02.11.2024
This commit is contained in:
@@ -33,8 +33,18 @@ bool DataBaseInstructors::AuthorizationInstructor(QString login, QString passwor
|
||||
|
||||
if(listOfInstructors[i].getLogin() == login && listOfInstructors[i].getPassword() == password)
|
||||
{
|
||||
listOfInstructors[i].setLoggedIn(true);
|
||||
return true;
|
||||
Instructor instructor = listOfInstructors[i];
|
||||
instructor.setLoggedIn(true);
|
||||
|
||||
bool result = dbLMS->updateInstructor(instructor);
|
||||
|
||||
if(result)
|
||||
{
|
||||
LoadInstructorsPSQL();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -45,13 +55,23 @@ bool DataBaseInstructors::deAuthorizationInstructor(QString login)
|
||||
//Инструкторы
|
||||
for(int i = 0; i < listOfInstructors.count(); i++)
|
||||
{
|
||||
//if(listOfInstructors[i].getArchived())
|
||||
//continue;
|
||||
if(listOfInstructors[i].getArchived())
|
||||
continue;
|
||||
|
||||
if(listOfInstructors[i].getLogin() == login)
|
||||
{
|
||||
listOfInstructors[i].setLoggedIn(false);
|
||||
return true;
|
||||
Instructor instructor = listOfInstructors[i];
|
||||
instructor.setLoggedIn(false);
|
||||
|
||||
bool result = dbLMS->updateInstructor(instructor);
|
||||
|
||||
if(result)
|
||||
{
|
||||
LoadInstructorsPSQL();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -131,46 +151,6 @@ void DataBaseInstructors::deleteInstructor(QString name)
|
||||
}
|
||||
}
|
||||
|
||||
void DataBaseInstructors::toArchiveInstructor(QString name)
|
||||
{
|
||||
//Инструкторы
|
||||
for(int i = 0; i < listOfInstructors.count(); i++)
|
||||
{
|
||||
if(listOfInstructors[i].getName() == name)
|
||||
if(! listOfInstructors[i].getArchived())
|
||||
{
|
||||
Instructor instructor = listOfInstructors[i];
|
||||
instructor.setArchived(true);
|
||||
|
||||
bool result = dbLMS->updateInstructor(instructor);
|
||||
|
||||
if(result)
|
||||
LoadInstructorsPSQL();
|
||||
//listOfInstructors[i].setArchived(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DataBaseInstructors::fromeArchiveInstructor(QString name)
|
||||
{
|
||||
//Инструкторы
|
||||
for(int i = 0; i < listOfInstructors.count(); i++)
|
||||
{
|
||||
if(listOfInstructors[i].getName() == name)
|
||||
if(listOfInstructors[i].getArchived())
|
||||
{
|
||||
Instructor instructor = listOfInstructors[i];
|
||||
instructor.setArchived(false);
|
||||
|
||||
bool result = dbLMS->updateInstructor(instructor);
|
||||
|
||||
if(result)
|
||||
LoadInstructorsPSQL();
|
||||
//listOfInstructors[i].setArchived(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DataBaseInstructors::editInstructor(QString name, Instructor instructor)
|
||||
{
|
||||
//Инструкторы
|
||||
@@ -181,7 +161,7 @@ bool DataBaseInstructors::editInstructor(QString name, Instructor instructor)
|
||||
if( (!checkExistNameInstructor(instructor.getName()) || instructor.getName() == name) &&
|
||||
(!checkExistLoginInstructor(instructor.getLogin()) || instructor.getLogin() == listOfInstructors[i].getLogin()) )
|
||||
{
|
||||
instructor.setID(listOfInstructors[i].getID());
|
||||
//instructor.setID(listOfInstructors[i].getID());
|
||||
|
||||
bool result = dbLMS->updateInstructor(instructor);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user