mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
PSQL id 06.11.2024
This commit is contained in:
@@ -16,12 +16,22 @@ add_library(DataBaseLMS SHARED
|
||||
DataBaseLMS_global.h
|
||||
databaselms.cpp
|
||||
databaselms.h
|
||||
basicentity.cpp
|
||||
basicentity.h
|
||||
user.cpp
|
||||
user.h
|
||||
instructor.cpp
|
||||
instructor.h
|
||||
trainee.h
|
||||
trainee.cpp
|
||||
trainee.h
|
||||
group.cpp
|
||||
group.h
|
||||
computer.cpp
|
||||
computer.h
|
||||
task.cpp
|
||||
task.h
|
||||
classroom.cpp
|
||||
classroom.h
|
||||
)
|
||||
|
||||
target_link_libraries(DataBaseLMS PRIVATE Qt5::Widgets)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.11.1, 2024-11-02T13:43:21. -->
|
||||
<!-- Written by QtCreator 4.11.1, 2024-11-06T16:05:43. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
||||
14
DB_LMS/DataBaseLMS/basicentity.cpp
Normal file
14
DB_LMS/DataBaseLMS/basicentity.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "basicentity.h"
|
||||
|
||||
BasicEntity::BasicEntity():
|
||||
id(),
|
||||
name()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BasicEntity::BasicEntity(int id, QString name)
|
||||
{
|
||||
this->id = id;
|
||||
this->name = name;
|
||||
}
|
||||
24
DB_LMS/DataBaseLMS/basicentity.h
Normal file
24
DB_LMS/DataBaseLMS/basicentity.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef BASICENTITY_H
|
||||
#define BASICENTITY_H
|
||||
|
||||
#include <QString>
|
||||
#include "DataBaseLMS_global.h"
|
||||
|
||||
class BasicEntity
|
||||
{
|
||||
public:
|
||||
BasicEntity();
|
||||
BasicEntity(int id, QString name);
|
||||
|
||||
void setID(int id){this->id = id;}
|
||||
int getID(){return id;}
|
||||
|
||||
void setName(QString name){this->name = name;}
|
||||
QString getName(){return name;}
|
||||
|
||||
protected:
|
||||
int id;
|
||||
QString name;
|
||||
};
|
||||
|
||||
#endif // BASICENTITY_H
|
||||
13
DB_LMS/DataBaseLMS/classroom.cpp
Normal file
13
DB_LMS/DataBaseLMS/classroom.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include "classroom.h"
|
||||
|
||||
Classroom::Classroom():
|
||||
BasicEntity()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Classroom::Classroom(int id, QString name):
|
||||
BasicEntity(id, name)
|
||||
{
|
||||
|
||||
}
|
||||
13
DB_LMS/DataBaseLMS/classroom.h
Normal file
13
DB_LMS/DataBaseLMS/classroom.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef CLASSROOM_H
|
||||
#define CLASSROOM_H
|
||||
|
||||
#include "basicentity.h"
|
||||
|
||||
class DATABASELMS_EXPORT Classroom: public BasicEntity
|
||||
{
|
||||
public:
|
||||
Classroom();
|
||||
Classroom(int id, QString name);
|
||||
};
|
||||
|
||||
#endif // CLASSROOM_H
|
||||
16
DB_LMS/DataBaseLMS/computer.cpp
Normal file
16
DB_LMS/DataBaseLMS/computer.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "computer.h"
|
||||
|
||||
Computer::Computer():
|
||||
BasicEntity(),
|
||||
classroom(),
|
||||
ipAddress()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Computer::Computer(int id, QString name, QString ipAddress, Classroom classroom):
|
||||
BasicEntity(id, name)
|
||||
{
|
||||
this->ipAddress = ipAddress;
|
||||
this->classroom = classroom;
|
||||
}
|
||||
24
DB_LMS/DataBaseLMS/computer.h
Normal file
24
DB_LMS/DataBaseLMS/computer.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef COMPUTER_H
|
||||
#define COMPUTER_H
|
||||
|
||||
#include "basicentity.h"
|
||||
#include "classroom.h"
|
||||
|
||||
class DATABASELMS_EXPORT Computer: public BasicEntity
|
||||
{
|
||||
public:
|
||||
Computer();
|
||||
Computer(int id, QString name, QString ipAddress, Classroom classroom);
|
||||
|
||||
void setClassroom(Classroom classroom){this->classroom = classroom;}
|
||||
Classroom getClassroom(){return classroom;}
|
||||
|
||||
void setIpAddress(QString ipAddress){this->ipAddress = ipAddress;}
|
||||
QString getIpAddress(){return ipAddress;}
|
||||
|
||||
private:
|
||||
Classroom classroom;
|
||||
QString ipAddress;
|
||||
};
|
||||
|
||||
#endif // COMPUTER_H
|
||||
@@ -81,13 +81,13 @@ QList<Trainee> DataBaseLMS::selectAllTrainees()
|
||||
QList<Trainee> listTrainees;
|
||||
|
||||
QString queryStr = QString("SELECT trainees.trainee_id, trainees.name, trainees.login, trainees.password, trainees.archived, trainees.logged_in, "
|
||||
"groups_of_trainees.name, "
|
||||
"educational_classes.name, "
|
||||
"computers.name, computers.ip_address "
|
||||
"FROM public.trainees JOIN public.groups_of_trainees ON groups_of_trainees.group_id = trainees.group_trainees "
|
||||
"LEFT OUTER JOIN public.computers ON computers.computer_id = trainees.computer "
|
||||
"LEFT OUTER JOIN public.educational_classes ON educational_classes.class_id = computers.class "
|
||||
"ORDER BY groups_of_trainees.name ASC");
|
||||
"groups.group_id, groups.name, "
|
||||
"computers.computer_id, computers.name, computers.ip_address, "
|
||||
"classrooms.classroom_id, classrooms.name "
|
||||
"FROM public.trainees JOIN public.groups ON groups.group_id = trainees.group_trainee "
|
||||
"LEFT OUTER JOIN public.computers ON computers.computer_id = trainees.computer_trainee "
|
||||
"LEFT OUTER JOIN public.classrooms ON classrooms.classroom_id = computers.classroom_computer "
|
||||
"ORDER BY groups.name, trainees.name ASC");
|
||||
|
||||
QSqlQuery query(*db);
|
||||
if(!query.exec(queryStr))
|
||||
@@ -106,11 +106,13 @@ QList<Trainee> DataBaseLMS::selectAllTrainees()
|
||||
trainee.setPassword(query.value(3).toString());
|
||||
trainee.setArchived(query.value(4).toBool());
|
||||
trainee.setLoggedIn(query.value(5).toBool());
|
||||
trainee.setGroup(query.value(6).toString());
|
||||
|
||||
trainee.setLearnClass(query.value(7).toString());
|
||||
trainee.setComputer(query.value(8).toString());
|
||||
trainee.setIpAddress(query.value(9).toString());
|
||||
Group group = Group(query.value(6).toInt(), query.value(7).toString());
|
||||
trainee.setGroup(group);
|
||||
|
||||
Classroom classroom = Classroom(query.value(11).toInt(), query.value(12).toString());
|
||||
Computer computer = Computer(query.value(8).toInt(), query.value(9).toString(), query.value(10).toString(), classroom);
|
||||
trainee.setComputer(computer);
|
||||
|
||||
trainee.setTasks(selectTasksOfTrainee(trainee.getID()));
|
||||
|
||||
@@ -125,8 +127,8 @@ QList<Group> DataBaseLMS::selectAllGroups()
|
||||
{
|
||||
QList<Group> listGroups;
|
||||
|
||||
QString queryStr = QString("SELECT group_id, name, color "
|
||||
"FROM public.groups_of_trainees "
|
||||
QString queryStr = QString("SELECT group_id, name "
|
||||
"FROM public.groups "
|
||||
"ORDER BY group_id ASC");
|
||||
|
||||
QSqlQuery query(*db);
|
||||
@@ -141,7 +143,6 @@ QList<Group> DataBaseLMS::selectAllGroups()
|
||||
Group group;
|
||||
group.setID(query.value(0).toInt());
|
||||
group.setName(query.value(1).toString());
|
||||
group.setColor((Group::ColorGroup)query.value(2).toInt());
|
||||
|
||||
listGroups.append(group);
|
||||
}
|
||||
@@ -150,10 +151,10 @@ QList<Group> DataBaseLMS::selectAllGroups()
|
||||
return listGroups;
|
||||
}
|
||||
|
||||
bool DataBaseLMS::insertInstructor(Instructor instructor)
|
||||
int DataBaseLMS::insertInstructor(Instructor instructor)
|
||||
{
|
||||
QString queryStr = QString("INSERT INTO public.instructors (name, login, password, is_admin, archived, logged_in) "
|
||||
"VALUES ('%1', '%2', '%3', %4, %5, %6)").arg(
|
||||
"VALUES ('%1', '%2', '%3', %4, %5, %6) RETURNING instructor_id").arg(
|
||||
instructor.getName(),
|
||||
instructor.getLogin(),
|
||||
instructor.getPassword(),
|
||||
@@ -164,18 +165,18 @@ bool DataBaseLMS::insertInstructor(Instructor instructor)
|
||||
return queryExec(queryStr);
|
||||
}
|
||||
|
||||
bool DataBaseLMS::deleteInstructor(int instructor_id)
|
||||
int DataBaseLMS::deleteInstructor(int instructor_id)
|
||||
{
|
||||
QString queryStr = QString("DELETE FROM public.instructors WHERE instructor_id = %1").arg(QString::number(instructor_id));
|
||||
QString queryStr = QString("DELETE FROM public.instructors WHERE instructor_id = %1 RETURNING instructors.instructor_id").arg(QString::number(instructor_id));
|
||||
|
||||
return queryExec(queryStr);
|
||||
}
|
||||
|
||||
bool DataBaseLMS::updateInstructor(Instructor instructor)
|
||||
int DataBaseLMS::updateInstructor(Instructor instructor)
|
||||
{
|
||||
QString queryStr = QString("UPDATE public.instructors "
|
||||
"SET name = '%1', login = '%2', password = '%3', is_admin = %4, archived = %5, logged_in = %6 "
|
||||
"WHERE instructor_id = %7").arg(
|
||||
"WHERE instructor_id = %7 RETURNING instructors.instructor_id").arg(
|
||||
instructor.getName(),
|
||||
instructor.getLogin(),
|
||||
instructor.getPassword(),
|
||||
@@ -187,87 +188,81 @@ bool DataBaseLMS::updateInstructor(Instructor instructor)
|
||||
return queryExec(queryStr);
|
||||
}
|
||||
|
||||
bool DataBaseLMS::insertGroup(Group group)
|
||||
int DataBaseLMS::insertGroup(Group group)
|
||||
{
|
||||
QString queryStr = QString("INSERT INTO public.groups_of_trainees (name, color) "
|
||||
"VALUES ('%1', %2)").arg(
|
||||
group.getName(),
|
||||
QString::number((int)group.getColor()));
|
||||
QString queryStr = QString("INSERT INTO public.groups (name) "
|
||||
"VALUES ('%1') RETURNING groups.group_id").arg(
|
||||
group.getName());
|
||||
|
||||
return queryExec(queryStr);
|
||||
}
|
||||
|
||||
bool DataBaseLMS::deleteGroup(int group_id)
|
||||
int DataBaseLMS::deleteGroup(int group_id)
|
||||
{
|
||||
QString queryStr = QString("DELETE FROM public.groups_of_trainees WHERE group_id = %1").arg(QString::number(group_id));
|
||||
QString queryStr = QString("DELETE FROM public.groups WHERE group_id = %1 RETURNING groups.group_id").arg(QString::number(group_id));
|
||||
|
||||
return queryExec(queryStr);
|
||||
}
|
||||
|
||||
bool DataBaseLMS::updateGroup(Group group)
|
||||
int DataBaseLMS::updateGroup(Group group)
|
||||
{
|
||||
QString queryStr = QString("UPDATE public.groups_of_trainees SET name = '%1', color = %2 WHERE group_id = %3").arg(
|
||||
QString queryStr = QString("UPDATE public.groups SET name = '%1' WHERE group_id = %2 RETURNING groups.group_id").arg(
|
||||
group.getName(),
|
||||
QString::number((int)group.getColor()),
|
||||
QString::number(group.getID()) );
|
||||
|
||||
return queryExec(queryStr);
|
||||
}
|
||||
|
||||
bool DataBaseLMS::insertTrainee(Trainee trainee)
|
||||
int DataBaseLMS::insertTrainee(Trainee trainee)
|
||||
{
|
||||
QString queryStr = QString("INSERT INTO public.trainees (name, login, password, archived, logged_in, group_trainees, computer) "
|
||||
"VALUES ('%1', '%2', '%3', %4, %5, "
|
||||
"(SELECT group_id FROM public.groups_of_trainees WHERE name = '%6'), "
|
||||
"(SELECT computer_id FROM public.computers WHERE name = '%7') "
|
||||
")").arg(
|
||||
QString queryStr = QString("INSERT INTO public.trainees (name, login, password, archived, logged_in, group_trainee) "
|
||||
"VALUES ('%1', '%2', '%3', %4, %5, %6) RETURNING trainees.trainee_id").arg(
|
||||
trainee.getName(),
|
||||
trainee.getLogin(),
|
||||
trainee.getPassword(),
|
||||
trainee.getArchived() ? "true" : "false",
|
||||
trainee.getLoggedIn() ? "true" : "false",
|
||||
trainee.getGroup(),
|
||||
trainee.getComputer());
|
||||
QString::number(trainee.getGroup().getID()));
|
||||
|
||||
return queryExec(queryStr);
|
||||
}
|
||||
|
||||
bool DataBaseLMS::deleteTrainee(int trainee_id)
|
||||
int DataBaseLMS::deleteTrainee(int trainee_id)
|
||||
{
|
||||
QString queryStr = QString("DELETE FROM public.trainees WHERE trainee_id = %1").arg(QString::number(trainee_id));
|
||||
QString queryStr = QString("DELETE FROM public.trainees WHERE trainee_id = %1 RETURNING trainees.trainee_id").arg(QString::number(trainee_id));
|
||||
|
||||
return queryExec(queryStr);
|
||||
}
|
||||
|
||||
bool DataBaseLMS::updateTrainee(Trainee trainee)
|
||||
int DataBaseLMS::updateTrainee(Trainee trainee)
|
||||
{
|
||||
QString computer_id = (trainee.getComputer().getID() == 0 ? QStringLiteral("null") : QString::number(trainee.getComputer().getID()));
|
||||
|
||||
QString queryStr = QString("UPDATE public.trainees "
|
||||
"SET name = '%1', login = '%2', password = '%3', archived = %4, logged_in = %5, "
|
||||
"group_trainees = "
|
||||
"(SELECT group_id FROM public.groups_of_trainees WHERE name = '%6'), "
|
||||
"computer = "
|
||||
"(SELECT computer_id FROM public.computers WHERE name = '%7') "
|
||||
"WHERE trainee_id = %8").arg(
|
||||
"group_trainee = %6, "
|
||||
"computer_trainee = %7 "
|
||||
"WHERE trainee_id = %8 RETURNING trainees.trainee_id").arg(
|
||||
trainee.getName(),
|
||||
trainee.getLogin(),
|
||||
trainee.getPassword(),
|
||||
trainee.getArchived() ? "true" : "false",
|
||||
trainee.getLoggedIn() ? "true" : "false",
|
||||
trainee.getGroup(),
|
||||
trainee.getComputer(),
|
||||
QString::number(trainee.getGroup().getID()),
|
||||
computer_id,
|
||||
QString::number(trainee.getID()) );
|
||||
|
||||
return queryExec(queryStr);
|
||||
}
|
||||
|
||||
QStringList DataBaseLMS::selectTasksOfTrainee(int trainee_id)
|
||||
QList<Task> DataBaseLMS::selectTasksOfTrainee(int trainee_id)
|
||||
{
|
||||
QStringList tasks;
|
||||
QList<Task> tasks;
|
||||
|
||||
QString queryStr = QString("SELECT tasks.task_id, tasks.name "
|
||||
"FROM public.trainees "
|
||||
"JOIN public.trainee_tasks ON trainee_tasks.trainee_id = trainees.trainee_id "
|
||||
"JOIN public.tasks ON tasks.task_id = trainee_tasks.task_id "
|
||||
"JOIN public.trainees_tasks ON trainees_tasks.trainee_id = trainees.trainee_id "
|
||||
"JOIN public.tasks ON tasks.task_id = trainees_tasks.task_id "
|
||||
"WHERE trainees.trainee_id = %1 "
|
||||
"ORDER BY tasks.name ASC").arg(
|
||||
trainee_id);
|
||||
@@ -281,23 +276,31 @@ QStringList DataBaseLMS::selectTasksOfTrainee(int trainee_id)
|
||||
{
|
||||
while (query.next())
|
||||
{//Задача
|
||||
tasks.append(query.value(1).toString());
|
||||
Task task;
|
||||
task.setID(query.value(0).toInt());
|
||||
task.setName(query.value(1).toString());
|
||||
tasks.append(task);
|
||||
}
|
||||
}
|
||||
|
||||
return tasks;
|
||||
}
|
||||
|
||||
bool DataBaseLMS::queryExec(QString queryStr)
|
||||
int DataBaseLMS::queryExec(QString queryStr)
|
||||
{
|
||||
QSqlQuery query(*db);
|
||||
if(!query.exec(queryStr))
|
||||
{
|
||||
messageWarningErrorQuery(queryStr);
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
{
|
||||
if(query.next())
|
||||
return query.value(0).toInt();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DataBaseLMS::messageWarningErrorQuery(QString queryStr)
|
||||
|
||||
@@ -23,22 +23,22 @@ public:
|
||||
QList<Trainee> selectAllTrainees();
|
||||
QList<Group> selectAllGroups();
|
||||
|
||||
bool insertInstructor(Instructor instructor);
|
||||
bool deleteInstructor(int instructor_id);
|
||||
bool updateInstructor(Instructor instructor);
|
||||
int insertInstructor(Instructor instructor);
|
||||
int deleteInstructor(int instructor_id);
|
||||
int updateInstructor(Instructor instructor);
|
||||
|
||||
bool insertGroup(Group group);
|
||||
bool deleteGroup(int group_id);
|
||||
bool updateGroup(Group group);
|
||||
int insertGroup(Group group);
|
||||
int deleteGroup(int group_id);
|
||||
int updateGroup(Group group);
|
||||
|
||||
bool insertTrainee(Trainee trainee);
|
||||
bool deleteTrainee(int trainee_id);
|
||||
bool updateTrainee(Trainee trainee);
|
||||
int insertTrainee(Trainee trainee);
|
||||
int deleteTrainee(int trainee_id);
|
||||
int updateTrainee(Trainee trainee);
|
||||
|
||||
QStringList selectTasksOfTrainee(int trainee_id);
|
||||
QList<Task> selectTasksOfTrainee(int trainee_id);
|
||||
|
||||
private:
|
||||
bool queryExec(QString queryStr);
|
||||
int queryExec(QString queryStr);
|
||||
void messageWarningErrorQuery(QString queryStr);
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
#include "group.h"
|
||||
|
||||
Group::Group():
|
||||
group_id(),
|
||||
name(),
|
||||
color()
|
||||
BasicEntity()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Group::Group(int id, QString name):
|
||||
BasicEntity(id, name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,45 +1,13 @@
|
||||
#ifndef GROUP_H
|
||||
#define GROUP_H
|
||||
|
||||
#include <QString>
|
||||
#include <QColor>
|
||||
#include "DataBaseLMS_global.h"
|
||||
#include "basicentity.h"
|
||||
|
||||
class DATABASELMS_EXPORT Group
|
||||
class DATABASELMS_EXPORT Group: public BasicEntity
|
||||
{
|
||||
public:
|
||||
enum ColorGroup
|
||||
{
|
||||
color0,
|
||||
color1,
|
||||
color2,
|
||||
color3,
|
||||
color4,
|
||||
color5,
|
||||
color6,
|
||||
color7,
|
||||
color8,
|
||||
color9,
|
||||
colorAther,
|
||||
countColor
|
||||
};
|
||||
|
||||
public:
|
||||
Group();
|
||||
|
||||
void setID(int group_id){this->group_id = group_id;}
|
||||
int getID(){return group_id;}
|
||||
|
||||
void setName(QString name){this->name = name;}
|
||||
QString getName(){return name;}
|
||||
|
||||
void setColor(ColorGroup color){this->color = color;}
|
||||
ColorGroup getColor(){return color;}
|
||||
|
||||
private:
|
||||
int group_id;
|
||||
QString name;
|
||||
ColorGroup color;
|
||||
Group(int id, QString name);
|
||||
};
|
||||
|
||||
#endif // GROUP_H
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
#include "instructor.h"
|
||||
|
||||
Instructor::Instructor():
|
||||
instructor_id(),
|
||||
name(),
|
||||
login(),
|
||||
password(),
|
||||
isAdmin(false),
|
||||
archived(false),
|
||||
loggedIn(false)
|
||||
User(),
|
||||
isAdmin()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,43 +1,18 @@
|
||||
#ifndef INSTRUCTOR_H
|
||||
#define INSTRUCTOR_H
|
||||
|
||||
#include <QString>
|
||||
#include "DataBaseLMS_global.h"
|
||||
#include "user.h"
|
||||
|
||||
class DATABASELMS_EXPORT Instructor
|
||||
class DATABASELMS_EXPORT Instructor: public User
|
||||
{
|
||||
public:
|
||||
Instructor();
|
||||
|
||||
void setID(int instructor_id){this->instructor_id = instructor_id;}
|
||||
int getID(){return instructor_id;}
|
||||
|
||||
void setName(QString name){this->name = name;}
|
||||
QString getName(){return name;}
|
||||
|
||||
void setLogin(QString login){this->login = login;}
|
||||
QString getLogin(){return login;}
|
||||
|
||||
void setPassword(QString password){this->password = password;}
|
||||
QString getPassword(){return password;}
|
||||
|
||||
void setIsAdmin(bool isAdmin){this->isAdmin = isAdmin;}
|
||||
bool getIsAdmin(){return isAdmin;}
|
||||
|
||||
void setArchived(bool archived){this->archived = archived;}
|
||||
bool getArchived(){return archived;}
|
||||
|
||||
void setLoggedIn(bool loggedIn){this->loggedIn = loggedIn;}
|
||||
bool getLoggedIn(){return loggedIn;}
|
||||
|
||||
private:
|
||||
int instructor_id;
|
||||
QString name;
|
||||
QString login;
|
||||
QString password;
|
||||
bool isAdmin;
|
||||
bool archived;
|
||||
bool loggedIn;
|
||||
};
|
||||
|
||||
#endif // INSTRUCTOR_H
|
||||
|
||||
7
DB_LMS/DataBaseLMS/task.cpp
Normal file
7
DB_LMS/DataBaseLMS/task.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "task.h"
|
||||
|
||||
Task::Task():
|
||||
BasicEntity()
|
||||
{
|
||||
|
||||
}
|
||||
12
DB_LMS/DataBaseLMS/task.h
Normal file
12
DB_LMS/DataBaseLMS/task.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#ifndef TASK_H
|
||||
#define TASK_H
|
||||
|
||||
#include "basicentity.h"
|
||||
|
||||
class DATABASELMS_EXPORT Task: public BasicEntity
|
||||
{
|
||||
public:
|
||||
Task();
|
||||
};
|
||||
|
||||
#endif // TASK_H
|
||||
@@ -1,14 +1,8 @@
|
||||
#include "trainee.h"
|
||||
|
||||
Trainee::Trainee():
|
||||
trainee_id(),
|
||||
name(),
|
||||
login(),
|
||||
password(),
|
||||
archived(false),
|
||||
loggedIn(false),
|
||||
User(),
|
||||
group(),
|
||||
learnClass(),
|
||||
computer(),
|
||||
tasks()
|
||||
{
|
||||
|
||||
@@ -1,62 +1,31 @@
|
||||
#ifndef TRAINEE_H
|
||||
#define TRAINEE_H
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include "DataBaseLMS_global.h"
|
||||
|
||||
class DATABASELMS_EXPORT Trainee
|
||||
#include "user.h"
|
||||
#include "group.h"
|
||||
#include "computer.h"
|
||||
#include "task.h"
|
||||
|
||||
class DATABASELMS_EXPORT Trainee: public User
|
||||
{
|
||||
public:
|
||||
Trainee();
|
||||
|
||||
void setID(int trainee_id){this->trainee_id = trainee_id;}
|
||||
int getID(){return trainee_id;}
|
||||
void setGroup(Group group){this->group = group;}
|
||||
Group getGroup(){return group;}
|
||||
|
||||
void setName(QString name){this->name = name;}
|
||||
QString getName(){return name;}
|
||||
void setComputer(Computer computer){this->computer = computer;}
|
||||
Computer getComputer(){return computer;}
|
||||
|
||||
void setLogin(QString login){this->login = login;}
|
||||
QString getLogin(){return login;}
|
||||
|
||||
void setPassword(QString password){this->password = password;}
|
||||
QString getPassword(){return password;}
|
||||
|
||||
void setLearnClass(QString learnClass){this->learnClass = learnClass;}
|
||||
QString getLearnClass(){return learnClass;}
|
||||
|
||||
void setComputer(QString computer){this->computer = computer;}
|
||||
QString getComputer(){return computer;}
|
||||
|
||||
void setIpAddress(QString ipAddress){this->ipAddress = ipAddress;}
|
||||
QString getIpAddress(){return ipAddress;}
|
||||
|
||||
void setGroup(QString group){this->group = group;}
|
||||
QString getGroup(){return group;}
|
||||
|
||||
void setArchived(bool archived){this->archived = archived;}
|
||||
bool getArchived(){return archived;}
|
||||
|
||||
void setLoggedIn(bool loggedIn){this->loggedIn = loggedIn;}
|
||||
bool getLoggedIn(){return loggedIn;}
|
||||
|
||||
void setTasks(QStringList tasks){this->tasks = tasks;}
|
||||
QStringList getTasks(){return tasks;}
|
||||
void setTasks(QList<Task> tasks){this->tasks = tasks;}
|
||||
QList<Task> getTasks(){return tasks;}
|
||||
|
||||
private:
|
||||
int trainee_id;
|
||||
QString name;
|
||||
QString login;
|
||||
QString password;
|
||||
bool archived;
|
||||
bool loggedIn;
|
||||
QString group;
|
||||
|
||||
QString learnClass;
|
||||
QString computer;
|
||||
QString ipAddress;
|
||||
|
||||
QStringList tasks;
|
||||
Group group;
|
||||
Computer computer;
|
||||
QList<Task> tasks;
|
||||
};
|
||||
|
||||
#endif // TRAINEE_H
|
||||
|
||||
11
DB_LMS/DataBaseLMS/user.cpp
Normal file
11
DB_LMS/DataBaseLMS/user.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "user.h"
|
||||
|
||||
User::User():
|
||||
BasicEntity(),
|
||||
login(),
|
||||
password(),
|
||||
archived(),
|
||||
loggedIn()
|
||||
{
|
||||
|
||||
}
|
||||
30
DB_LMS/DataBaseLMS/user.h
Normal file
30
DB_LMS/DataBaseLMS/user.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef USER_H
|
||||
#define USER_H
|
||||
|
||||
#include "basicentity.h"
|
||||
|
||||
class User: public BasicEntity
|
||||
{
|
||||
public:
|
||||
User();
|
||||
|
||||
void setLogin(QString login){this->login = login;}
|
||||
QString getLogin(){return login;}
|
||||
|
||||
void setPassword(QString password){this->password = password;}
|
||||
QString getPassword(){return password;}
|
||||
|
||||
void setArchived(bool archived){this->archived = archived;}
|
||||
bool getArchived(){return archived;}
|
||||
|
||||
void setLoggedIn(bool loggedIn){this->loggedIn = loggedIn;}
|
||||
bool getLoggedIn(){return loggedIn;}
|
||||
|
||||
private:
|
||||
QString login;
|
||||
QString password;
|
||||
bool archived;
|
||||
bool loggedIn;
|
||||
};
|
||||
|
||||
#endif // USER_H
|
||||
Reference in New Issue
Block a user