mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Починил клинч с мьютексом Провайдера ДБ
This commit is contained in:
@@ -62,7 +62,7 @@ Trainee DataBaseLMS::selectTrainee(int id_trainee)
|
|||||||
"LEFT OUTER JOIN public.computers ON computers.computer_id = users.fk_computer_id "
|
"LEFT OUTER JOIN public.computers ON computers.computer_id = users.fk_computer_id "
|
||||||
"LEFT OUTER JOIN public.classrooms ON classrooms.classroom_id = computers.fk_classroom_id "
|
"LEFT OUTER JOIN public.classrooms ON classrooms.classroom_id = computers.fk_classroom_id "
|
||||||
"WHERE users.user_id = %1 AND users.type = '%2' "
|
"WHERE users.user_id = %1 AND users.type = '%2' "
|
||||||
"ORDER BY groups.name, trainees.name ASC").arg(
|
"ORDER BY groups.name, users.name ASC").arg(
|
||||||
QString::number(id_trainee),
|
QString::number(id_trainee),
|
||||||
TypeUserDBTrainee);
|
TypeUserDBTrainee);
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ void InterfaceDataBaseLMS::slot_LanguageChanged(QString language)
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::connectionToDB()
|
bool InterfaceDataBaseLMS::connectionToDB()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
if(!createConnection())
|
if(!createConnection())
|
||||||
{
|
{
|
||||||
QMessageBox::critical(ownerWidget, dbSettings.dbName, tr("Connection error: ") + db->lastError().text());
|
QMessageBox::critical(ownerWidget, dbSettings.dbName, tr("Connection error: ") + db->lastError().text());
|
||||||
@@ -36,7 +36,7 @@ bool InterfaceDataBaseLMS::connectionToDB()
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::disConnectionFromDB()
|
bool InterfaceDataBaseLMS::disConnectionFromDB()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
deleteConnection();
|
deleteConnection();
|
||||||
//QMessageBox::information(ownerWidget, dbName, tr("Disconnection is successful!"));
|
//QMessageBox::information(ownerWidget, dbName, tr("Disconnection is successful!"));
|
||||||
return true;
|
return true;
|
||||||
@@ -44,7 +44,7 @@ bool InterfaceDataBaseLMS::disConnectionFromDB()
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::DBisConnected()
|
bool InterfaceDataBaseLMS::DBisConnected()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return isConnected();
|
return isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ bool InterfaceDataBaseLMS::DBisConnected()
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::authorizationInstructor(QString login, QString password)
|
bool InterfaceDataBaseLMS::authorizationInstructor(QString login, QString password)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
|
|
||||||
if(int id = selectUserID(DataBaseLMS::TypeUserDBInstructor, login, password))
|
if(int id = selectUserID(DataBaseLMS::TypeUserDBInstructor, login, password))
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ bool InterfaceDataBaseLMS::authorizationInstructor(QString login, QString passwo
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::deAuthorizationInstructor(QString login)
|
bool InterfaceDataBaseLMS::deAuthorizationInstructor(QString login)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
|
|
||||||
if(int id = selectUserID(DataBaseLMS::TypeUserDBInstructor, login))
|
if(int id = selectUserID(DataBaseLMS::TypeUserDBInstructor, login))
|
||||||
{
|
{
|
||||||
@@ -80,49 +80,49 @@ bool InterfaceDataBaseLMS::deAuthorizationInstructor(QString login)
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::deAuthorizationAllInstructors()
|
bool InterfaceDataBaseLMS::deAuthorizationAllInstructors()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return updateAllUsersLoggedIn(DataBaseLMS::TypeUserDBInstructor, false);
|
return updateAllUsersLoggedIn(DataBaseLMS::TypeUserDBInstructor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString InterfaceDataBaseLMS::getNameInstructorByLogin(QString login)
|
QString InterfaceDataBaseLMS::getNameInstructorByLogin(QString login)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectUserNameByLogin(DataBaseLMS::TypeUserDBInstructor, login);
|
return selectUserNameByLogin(DataBaseLMS::TypeUserDBInstructor, login);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::getIdInstructorByLogin(QString login)
|
int InterfaceDataBaseLMS::getIdInstructorByLogin(QString login)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectUserID(DataBaseLMS::TypeUserDBInstructor, login);
|
return selectUserID(DataBaseLMS::TypeUserDBInstructor, login);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Instructor> InterfaceDataBaseLMS::getListInstructors()
|
QList<Instructor> InterfaceDataBaseLMS::getListInstructors()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectAllInstructors();
|
return selectAllInstructors();
|
||||||
}
|
}
|
||||||
|
|
||||||
Instructor InterfaceDataBaseLMS::getInstructor(int id)
|
Instructor InterfaceDataBaseLMS::getInstructor(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectInstructor(id);
|
return selectInstructor(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::newInstructor()
|
int InterfaceDataBaseLMS::newInstructor()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return insertInstructor();
|
return insertInstructor();
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::delInstructor(int id)
|
int InterfaceDataBaseLMS::delInstructor(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return deleteInstructor(id);
|
return deleteInstructor(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::editInstructor(Instructor instructor)
|
int InterfaceDataBaseLMS::editInstructor(Instructor instructor)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
|
|
||||||
//Проверка корректности логина, имени, пароля
|
//Проверка корректности логина, имени, пароля
|
||||||
|
|
||||||
@@ -159,19 +159,19 @@ int InterfaceDataBaseLMS::editInstructor(Instructor instructor)
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::isAdminInstructor(int id)
|
bool InterfaceDataBaseLMS::isAdminInstructor(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectInstructorIsAdmin(id);
|
return selectInstructorIsAdmin(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InterfaceDataBaseLMS::isArchivedInstructor(int id)
|
bool InterfaceDataBaseLMS::isArchivedInstructor(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectUserArchived(DataBaseLMS::TypeUserDBInstructor, id);
|
return selectUserArchived(DataBaseLMS::TypeUserDBInstructor, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InterfaceDataBaseLMS::isLoggedInInstructor(int id)
|
bool InterfaceDataBaseLMS::isLoggedInInstructor(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectUserLoggedIn(DataBaseLMS::TypeUserDBInstructor, id);
|
return selectUserLoggedIn(DataBaseLMS::TypeUserDBInstructor, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ bool InterfaceDataBaseLMS::isLoggedInInstructor(int id)
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::authorizationTrainee(QString login, QString password, QString classroom_name, QString computer_name)
|
bool InterfaceDataBaseLMS::authorizationTrainee(QString login, QString password, QString classroom_name, QString computer_name)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
|
|
||||||
if(int id = selectUserID(DataBaseLMS::TypeUserDBTrainee, login, password))
|
if(int id = selectUserID(DataBaseLMS::TypeUserDBTrainee, login, password))
|
||||||
{
|
{
|
||||||
@@ -195,7 +195,7 @@ bool InterfaceDataBaseLMS::authorizationTrainee(QString login, QString password,
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::deAuthorizationTrainee(QString login)
|
bool InterfaceDataBaseLMS::deAuthorizationTrainee(QString login)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
|
|
||||||
if(int id = selectUserID(DataBaseLMS::TypeUserDBTrainee, login))
|
if(int id = selectUserID(DataBaseLMS::TypeUserDBTrainee, login))
|
||||||
{
|
{
|
||||||
@@ -207,13 +207,13 @@ bool InterfaceDataBaseLMS::deAuthorizationTrainee(QString login)
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::deAuthorizationAllTrainees()
|
bool InterfaceDataBaseLMS::deAuthorizationAllTrainees()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return updateAllUsersLoggedIn(DataBaseLMS::TypeUserDBTrainee, false);
|
return updateAllUsersLoggedIn(DataBaseLMS::TypeUserDBTrainee, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::entryTraineeOnSimulator(int id_trainee)
|
int InterfaceDataBaseLMS::entryTraineeOnSimulator(int id_trainee)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
|
|
||||||
TimingOfTrainee timing(id_trainee);
|
TimingOfTrainee timing(id_trainee);
|
||||||
|
|
||||||
@@ -235,7 +235,7 @@ int InterfaceDataBaseLMS::entryTraineeOnSimulator(int id_trainee)
|
|||||||
|
|
||||||
int InterfaceDataBaseLMS::exitTraineeFromSimulator(int id_trainee)
|
int InterfaceDataBaseLMS::exitTraineeFromSimulator(int id_trainee)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
|
|
||||||
TimingOfTrainee timing(id_trainee);
|
TimingOfTrainee timing(id_trainee);
|
||||||
|
|
||||||
@@ -257,73 +257,73 @@ int InterfaceDataBaseLMS::exitTraineeFromSimulator(int id_trainee)
|
|||||||
|
|
||||||
QString InterfaceDataBaseLMS::getNameTraineeOnComputer(QString computer_name)
|
QString InterfaceDataBaseLMS::getNameTraineeOnComputer(QString computer_name)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectTraineeNameOnComputer(computer_name);
|
return selectTraineeNameOnComputer(computer_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Trainee InterfaceDataBaseLMS::getTraineeOnComputer(QString computer_name)
|
Trainee InterfaceDataBaseLMS::getTraineeOnComputer(QString computer_name)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectTraineeOnComputer(computer_name);
|
return selectTraineeOnComputer(computer_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString InterfaceDataBaseLMS::getNameTraineeByLogin(QString login)
|
QString InterfaceDataBaseLMS::getNameTraineeByLogin(QString login)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectUserNameByLogin(DataBaseLMS::TypeUserDBTrainee, login);
|
return selectUserNameByLogin(DataBaseLMS::TypeUserDBTrainee, login);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::getIdTraineeByLogin(QString login)
|
int InterfaceDataBaseLMS::getIdTraineeByLogin(QString login)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectUserID(DataBaseLMS::TypeUserDBTrainee, login);
|
return selectUserID(DataBaseLMS::TypeUserDBTrainee, login);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Trainee> InterfaceDataBaseLMS::getListTraineesInGroup(int id)
|
QList<Trainee> InterfaceDataBaseLMS::getListTraineesInGroup(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectAllTraineesInGroup(id);
|
return selectAllTraineesInGroup(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Group> InterfaceDataBaseLMS::getListGroups()
|
QList<Group> InterfaceDataBaseLMS::getListGroups()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectAllGroups();
|
return selectAllGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Trainee> InterfaceDataBaseLMS::getListTrainees()
|
QList<Trainee> InterfaceDataBaseLMS::getListTrainees()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectAllTrainees();
|
return selectAllTrainees();
|
||||||
}
|
}
|
||||||
|
|
||||||
Trainee InterfaceDataBaseLMS::getTrainee(int id)
|
Trainee InterfaceDataBaseLMS::getTrainee(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectTrainee(id);
|
return selectTrainee(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
Group InterfaceDataBaseLMS::getGroup(int id)
|
Group InterfaceDataBaseLMS::getGroup(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectGroup(id);
|
return selectGroup(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::newGroup()
|
int InterfaceDataBaseLMS::newGroup()
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return insertGroup();
|
return insertGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::delGroup(int id)
|
int InterfaceDataBaseLMS::delGroup(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return deleteGroup(id);
|
return deleteGroup(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::editGroup(Group group)
|
int InterfaceDataBaseLMS::editGroup(Group group)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
|
|
||||||
//Проверка корректности имени
|
//Проверка корректности имени
|
||||||
QList<Group> listGroups = selectAllGroups();
|
QList<Group> listGroups = selectAllGroups();
|
||||||
@@ -349,97 +349,97 @@ int InterfaceDataBaseLMS::editGroup(Group group)
|
|||||||
|
|
||||||
int InterfaceDataBaseLMS::newTaskAMM(TaskAmmFim task, int id_trainee)
|
int InterfaceDataBaseLMS::newTaskAMM(TaskAmmFim task, int id_trainee)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return insertTaskAMM(task, id_trainee);
|
return insertTaskAMM(task, id_trainee);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::delTaskAMM(int id)
|
int InterfaceDataBaseLMS::delTaskAMM(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return deleteTaskAMM(id);
|
return deleteTaskAMM(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::editTaskAMM(TaskAmmFim task)
|
int InterfaceDataBaseLMS::editTaskAMM(TaskAmmFim task)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return updateTaskAMM(task);
|
return updateTaskAMM(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<TaskAmmFim> InterfaceDataBaseLMS::getListTasksAMMofTrainee(int id_trainee)
|
QList<TaskAmmFim> InterfaceDataBaseLMS::getListTasksAMMofTrainee(int id_trainee)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectTasksAMMofTrainee(id_trainee);
|
return selectTasksAMMofTrainee(id_trainee);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<TaskAmmFim> InterfaceDataBaseLMS::getListTasksFIMofTrainee(int id_trainee)
|
QList<TaskAmmFim> InterfaceDataBaseLMS::getListTasksFIMofTrainee(int id_trainee)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectTasksFIMofTrainee(id_trainee);
|
return selectTasksFIMofTrainee(id_trainee);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskAmmFim InterfaceDataBaseLMS::getTaskAMMbyID(int id_task)
|
TaskAmmFim InterfaceDataBaseLMS::getTaskAMMbyID(int id_task)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectTaskAMMbyID(id_task);
|
return selectTaskAMMbyID(id_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskAmmFim InterfaceDataBaseLMS::getTaskFIMbyID(int id_task)
|
TaskAmmFim InterfaceDataBaseLMS::getTaskFIMbyID(int id_task)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectTaskFIMbyID(id_task);
|
return selectTaskFIMbyID(id_task);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::newTaskFIM(TaskAmmFim task, int id_trainee)
|
int InterfaceDataBaseLMS::newTaskFIM(TaskAmmFim task, int id_trainee)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return insertTaskFIM(task, id_trainee);
|
return insertTaskFIM(task, id_trainee);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::delTaskFIM(int id)
|
int InterfaceDataBaseLMS::delTaskFIM(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return deleteTaskFIM(id);
|
return deleteTaskFIM(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::editTaskFIM(TaskAmmFim task)
|
int InterfaceDataBaseLMS::editTaskFIM(TaskAmmFim task)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return updateTaskFIM(task);
|
return updateTaskFIM(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::replaceReportFIM(TaskAmmFim task)
|
int InterfaceDataBaseLMS::replaceReportFIM(TaskAmmFim task)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return updateReportFIMforTask(task);
|
return updateReportFIMforTask(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::changeStatusTaskFIM(int id_task, QString status)
|
int InterfaceDataBaseLMS::changeStatusTaskFIM(int id_task, QString status)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return updateStatusTaskFIM(id_task, status);
|
return updateStatusTaskFIM(id_task, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::changeStatusTaskAMM(int id_task, QString status)
|
int InterfaceDataBaseLMS::changeStatusTaskAMM(int id_task, QString status)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return updateStatusTaskAMM(id_task, status);
|
return updateStatusTaskAMM(id_task, status);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
int InterfaceDataBaseLMS::newTrainee(int id_group)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return insertTrainee(id_group);
|
return insertTrainee(id_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::delTrainee(int id)
|
int InterfaceDataBaseLMS::delTrainee(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return deleteTrainee(id);
|
return deleteTrainee(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InterfaceDataBaseLMS::editTrainee(Trainee trainee)
|
int InterfaceDataBaseLMS::editTrainee(Trainee trainee)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
|
|
||||||
//Проверка корректности логина, имени, пароля
|
//Проверка корректности логина, имени, пароля
|
||||||
|
|
||||||
@@ -476,12 +476,12 @@ int InterfaceDataBaseLMS::editTrainee(Trainee trainee)
|
|||||||
|
|
||||||
bool InterfaceDataBaseLMS::isArchivedTrainee(int id)
|
bool InterfaceDataBaseLMS::isArchivedTrainee(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectUserArchived(DataBaseLMS::TypeUserDBTrainee, id);
|
return selectUserArchived(DataBaseLMS::TypeUserDBTrainee, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool InterfaceDataBaseLMS::isLoggedInTrainee(int id)
|
bool InterfaceDataBaseLMS::isLoggedInTrainee(int id)
|
||||||
{
|
{
|
||||||
QMutexLocker mtxLocker(&mtxAccess);
|
//QMutexLocker mtxLocker(&mtxAccess);
|
||||||
return selectUserLoggedIn(DataBaseLMS::TypeUserDBTrainee, id);
|
return selectUserLoggedIn(DataBaseLMS::TypeUserDBTrainee, id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
QTranslator qtLanguageTranslator;
|
QTranslator qtLanguageTranslator;
|
||||||
QWidget* ownerWidget;
|
QWidget* ownerWidget;
|
||||||
QMutex mtxAccess;
|
//QMutex mtxAccess;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INTERFACEDATABASELMS_H
|
#endif // INTERFACEDATABASELMS_H
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "processingsystem.h"
|
#include "processingsystem.h"
|
||||||
|
#include "providerdblms.h"
|
||||||
|
|
||||||
#include <clienthandler.h>
|
#include <clienthandler.h>
|
||||||
|
|
||||||
@@ -7,7 +8,10 @@ ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateControlle
|
|||||||
updateController(nullptr),
|
updateController(nullptr),
|
||||||
providerDBLMS(nullptr)
|
providerDBLMS(nullptr)
|
||||||
{
|
{
|
||||||
this->providerDBLMS = providerDBLMS;
|
//this->providerDBLMS = providerDBLMS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this->updateController = updateController;
|
this->updateController = updateController;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,6 +20,10 @@ void ProcessingSystem::initialize(MultiThreadServer *server, DataParser *dataPar
|
|||||||
UpdateController *updateController,
|
UpdateController *updateController,
|
||||||
ChatSystem *chatSystem)
|
ChatSystem *chatSystem)
|
||||||
{
|
{
|
||||||
|
this->providerDBLMS = new ProviderDBLMS(/*parent*/nullptr);
|
||||||
|
this->providerDBLMS->ConnectionToDB();
|
||||||
|
this->providerDBLMS->deAuthorizationAll();
|
||||||
|
|
||||||
this->commonClientServer = commonClientHandler;
|
this->commonClientServer = commonClientHandler;
|
||||||
this->dataParser = dataParser;
|
this->dataParser = dataParser;
|
||||||
this->server = server;
|
this->server = server;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ ProviderDBLMS::~ProviderDBLMS()
|
|||||||
|
|
||||||
void ProviderDBLMS::ConnectionToDB()
|
void ProviderDBLMS::ConnectionToDB()
|
||||||
{
|
{
|
||||||
mtxAccess.lock();
|
mtxAccess.lock();
|
||||||
if(! dbLMS->DBisConnected())
|
if(! dbLMS->DBisConnected())
|
||||||
{
|
{
|
||||||
if(dbLMS->connectionToDB())
|
if(dbLMS->connectionToDB())
|
||||||
@@ -31,7 +31,7 @@ void ProviderDBLMS::ConnectionToDB()
|
|||||||
|
|
||||||
void ProviderDBLMS::DisConnectionFromDB()
|
void ProviderDBLMS::DisConnectionFromDB()
|
||||||
{
|
{
|
||||||
mtxAccess.lock();
|
mtxAccess.lock();
|
||||||
if(dbLMS->DBisConnected())
|
if(dbLMS->DBisConnected())
|
||||||
{
|
{
|
||||||
Q_EMIT signal_BlockAutorization(true);
|
Q_EMIT signal_BlockAutorization(true);
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
loggerThread(nullptr),
|
loggerThread(nullptr),
|
||||||
dataParser(nullptr),
|
dataParser(nullptr),
|
||||||
processingSystem(nullptr),
|
processingSystem(nullptr),
|
||||||
updateController(nullptr),
|
updateController(nullptr)//,
|
||||||
providerDBLMS(nullptr)
|
//providerDBLMS(nullptr)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
mutex = new QMutex;
|
mutex = new QMutex;
|
||||||
@@ -37,13 +37,13 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
updateThread = new QThread;
|
updateThread = new QThread;
|
||||||
loggerThread = new QThread;
|
loggerThread = new QThread;
|
||||||
|
|
||||||
providerDBLMS = new ProviderDBLMS(this);
|
//providerDBLMS = new ProviderDBLMS(this);
|
||||||
providerDBLMS->ConnectionToDB();
|
//providerDBLMS->ConnectionToDB();
|
||||||
providerDBLMS->deAuthorizationAll();
|
//providerDBLMS->deAuthorizationAll();
|
||||||
|
|
||||||
chatSystem = new ChatSystem();
|
chatSystem = new ChatSystem();
|
||||||
|
|
||||||
connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
|
//connect(providerDBLMS, &ProviderDBLMS::signal_BlockAutorization, this, &ServerLMSWidget::slot_BlockAutorization);
|
||||||
|
|
||||||
assetsManager = new AssetsManager;
|
assetsManager = new AssetsManager;
|
||||||
assetsManager->moveToThread(updateThread);
|
assetsManager->moveToThread(updateThread);
|
||||||
@@ -51,8 +51,9 @@ ServerLMSWidget::ServerLMSWidget(QWidget *parent) :
|
|||||||
updateController = new UpdateController;
|
updateController = new UpdateController;
|
||||||
updateController->moveToThread(updateThread);
|
updateController->moveToThread(updateThread);
|
||||||
|
|
||||||
processingSystem = new ProcessingSystem(providerDBLMS, updateController);
|
processingSystem = new ProcessingSystem(/*providerDBLMS*/nullptr, updateController);
|
||||||
processingSystem->moveToThread(updateThread);
|
//processingSystem->moveToThread(updateThread);
|
||||||
|
//providerDBLMS->moveToThread(updateThread);
|
||||||
|
|
||||||
dataParser = new DataParser(assetsManager,processingSystem);
|
dataParser = new DataParser(assetsManager,processingSystem);
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ private:
|
|||||||
CommonClientHandler *commonClientHandler;
|
CommonClientHandler *commonClientHandler;
|
||||||
ChatSystem *chatSystem;
|
ChatSystem *chatSystem;
|
||||||
|
|
||||||
ProviderDBLMS* providerDBLMS;
|
//ProviderDBLMS* providerDBLMS;
|
||||||
|
|
||||||
bool first = true; // для тестов Unity
|
bool first = true; // для тестов Unity
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user