From 778b48ccb87d4e182fd644e26f21da1c22dcb687 Mon Sep 17 00:00:00 2001 From: tienthieusac Date: Fri, 8 Jun 2018 02:26:03 +0700 Subject: [PATCH] Up file --- BTL_KTLT/Admin.h | 106 +++++ BTL_KTLT/Course.cpp | 197 +++++++++ BTL_KTLT/Course.h | 62 +++ BTL_KTLT/DBHelper.cpp | 262 ++++++++++++ BTL_KTLT/DBHelper.h | 25 ++ BTL_KTLT/Helper.h | 96 +++++ BTL_KTLT/Main.cpp | 57 +++ BTL_KTLT/Process.cpp | 768 ++++++++++++++++++++++++++++++++++++ BTL_KTLT/Process.h | 18 + BTL_KTLT/Student.cpp | 212 ++++++++++ BTL_KTLT/Student.h | 127 ++++++ BTL_KTLT/Teacher.cpp | 145 +++++++ BTL_KTLT/Teacher.h | 56 +++ BTL_KTLT/User.cpp | 49 +++ BTL_KTLT/User.h | 49 +++ BTL_KTLT/course.csv | 29 ++ BTL_KTLT/student.csv | 30 ++ BTL_KTLT/student_course.csv | 33 ++ BTL_KTLT/teacher.csv | 50 +++ BTL_KTLT/user.csv | 81 ++++ 20 files changed, 2452 insertions(+) create mode 100644 BTL_KTLT/Admin.h create mode 100644 BTL_KTLT/Course.cpp create mode 100644 BTL_KTLT/Course.h create mode 100644 BTL_KTLT/DBHelper.cpp create mode 100644 BTL_KTLT/DBHelper.h create mode 100644 BTL_KTLT/Helper.h create mode 100644 BTL_KTLT/Main.cpp create mode 100644 BTL_KTLT/Process.cpp create mode 100644 BTL_KTLT/Process.h create mode 100644 BTL_KTLT/Student.cpp create mode 100644 BTL_KTLT/Student.h create mode 100644 BTL_KTLT/Teacher.cpp create mode 100644 BTL_KTLT/Teacher.h create mode 100644 BTL_KTLT/User.cpp create mode 100644 BTL_KTLT/User.h create mode 100644 BTL_KTLT/course.csv create mode 100644 BTL_KTLT/student.csv create mode 100644 BTL_KTLT/student_course.csv create mode 100644 BTL_KTLT/teacher.csv create mode 100644 BTL_KTLT/user.csv diff --git a/BTL_KTLT/Admin.h b/BTL_KTLT/Admin.h new file mode 100644 index 0000000..5baf4cb --- /dev/null +++ b/BTL_KTLT/Admin.h @@ -0,0 +1,106 @@ +#ifndef _ADMIN_ +#define _ADMIN_ + +#include +#include +#include +#include +#include "Helper.h" +#include "User.h" + +using namespace std; + +class Admin : public User { +public: + Admin() {}; + ~Admin() {}; + bool addUser(User user, UserList &db_user_list) { + if (db_user_list.findUserByUsername(user.username) != -1) { + return 0; + } + else { + db_user_list.addToList(user); + return 1; + } + } + bool removeUser(string username, UserList &db_user_list, StudentList &db_st_list, TeacherList &db_tc_list) { + int index = db_user_list.findUserByUsername(username); + if (index == -1 || db_user_list.list[index].role == "admin") { + return 0; + } + else { + string s = db_user_list.list[index].role; + db_user_list.removeFromList(index); + if (s == "student") { + stringstream ss; + ss.str(username); + int id; + ss >> id; + for (int i = 0; i < db_st_list.size; i++) { + if (db_st_list.list[i].st_number == id) { + db_st_list.removeFromList(i); + return 1; + } + } + } + else { + for (int i = 0; i < db_tc_list.size; i++) { + if (db_tc_list.list[i].tc_identify == username) { + db_tc_list.removeFromList(i); + return 1; + } + } + } + } + } + + bool addStudent(StudentList &db_st_list, UserList &db_user_list) { + Student st; + User student; + student.role = "student"; + cout << "Input number, name, birthday, \"hometown\": (separate by comma)" << endl; + string s; + getline(cin, s, ','); + student.username = student.password = s; + istringstream(s) >> st.st_number; + getline(cin, s, ','); + st.st_name = s; + getline(cin, s, ','); + st.st_birthday = s; + getline(cin, s); + st.st_home_town = s; + if (addUser(student, db_user_list)) { + db_st_list.addToList(st); + return 1; + } + else { + return 0; + } + } + bool addTeacher(TeacherList &db_tc_list, UserList &db_user_list) { + Teacher tc; + User teacher; + teacher.role = "teacher"; + cout << "Input identify, name, birthday, \"phone number\", \"hometown\": (separate by comma)" << endl; + string s; + getline(cin, s, ','); + tc.tc_identify = teacher.username = teacher.password = s; + getline(cin, s, ','); + tc.tc_name = s; + getline(cin, s, ','); + tc.tc_birthday = s; + getline(cin, s, ','); + tc.tc_phone_number = s; + getline(cin, s); + tc.tc_home_town = s; + if (addUser(teacher, db_user_list)) { + db_tc_list.addToList(tc); + return 1; + } + else { + return 0; + } + } +}; + +#endif // !_ADMIN_ diff --git a/BTL_KTLT/Course.cpp b/BTL_KTLT/Course.cpp new file mode 100644 index 0000000..aebef2a --- /dev/null +++ b/BTL_KTLT/Course.cpp @@ -0,0 +1,197 @@ +#include "Course.h" +#include +#include +#include +#include +using namespace std; + +string toUpperCase(string&input) { + for (string::iterator i = input.begin(); i != input.end(); i++) { + *i = toupper(*i); + } + return input; +} + +inline bool operator==(Course &lhs, Course &rhs) { + return lhs.course_id == rhs.course_id; +} +inline bool operator==(Course &lhs, string &rhs) { + return lhs.course_id == rhs; +} +inline bool operator==(string &lhs, Course &rhs) { + return lhs == rhs.course_id; +} +inline bool operator!=(Course &lhs, Course &rhs) { + return !(lhs.course_id == rhs.course_id); +} +inline bool operator!=(Course &lhs, string &rhs) { + return !(lhs.course_id == rhs); +} +inline bool operator!=(string &lhs, Course &rhs) { + return !(lhs == rhs.course_id); +} + +bool CourseList::addToCourseList(Course newCourse){ + newCourse.total_st = 0; + if (this->isCourseExist(newCourse.course_id) == true) + return false; + else{ + this->addToList(newCourse); + return true; + } + +} + +void Course::printCourseInfo(){ + + cout << setfill('-') << setw(50) << "-" << "Course" << setfill('-') << setw(50) << "-" << setfill(' ') << endl; + cout + << left << setw(10) << "Course Id" + << left << setw(25) << "Falcuty" + << left << setw(15) << "Subject Id" + << left << setw(25) << "Subject Name" + + << left << setw(6) << "Credit" << endl; + cout << setfill('-') << setw(110) << "-" << setfill(' ') << endl; + + cout + << left << setw(10) << this->course_id + << left << setw(25) << this->falcuty + << left << setw(15) << this->sub_id + << left << setw(25) << this->sub_name + + << left << setw(6) << this->credit << endl; + +} + +Course* CourseList::findCourseById(string id) { + for (size_t i = 0; i < size; i++) { + if (list[i].course_id == id) { + return &list[i]; + } + } + return NULL; +} +CourseList* CourseList::findCourseByName(string name) { + CourseList* cList = new CourseList(); + for (size_t i = 0; i < size; i++) { + string s = this->list[i].sub_name; + toUpperCase(s); + toUpperCase(name); + int found = s.find(name); + if (found != string::npos) { + cList->addToList(list[i]); + } + } + return cList; +} + +CourseList* CourseList::findAllCourseById(arrayList id_list) { + CourseList* cList = new CourseList(); + for (size_t i = 0; i < this->size; i++) { + string s = this->list[i].course_id; + for (size_t j = 0; j < id_list.size; j++) { + string s1 = id_list.list[j]; + toUpperCase(s); + toUpperCase(s1); + if (s == s1) { + cList->addToList(list[i]); + break; + } + } + } + return cList; +} +CourseList* CourseList::findAllCourseByName(arrayList name_list) { + CourseList* cList = new CourseList(); + for (size_t i = 0; i < this->size; i++) { + string s = this->list[i].sub_name; + for (size_t j = 0; j < name_list.size; j++) { + string s1 = name_list.list[j]; + toUpperCase(s); + toUpperCase(s1); + int found = s.find(s1); + if (found != string::npos) { + cList->addToList(list[i]); + break; + } + } + } + return cList; +} +void CourseList::addStudentToCourse(string course_id) { + for (size_t i = 0; i < this->size; i++) { + if (this->list[i].course_id == course_id) { + this->list[i].total_st++; + this->list[i].isCourseFull(); + break; + } + } +} +void CourseList::removeStudentToCourse(string course_id) { + for (size_t i = 0; i < this->size; i++) { + if (this->list[i].course_id == course_id && this->list[i].total_st > 0) { + this->list[i].total_st--; + break; + } + } +} +void CourseList::printCourse() { + cout << setfill('-') << setw(50) << "-" << "Course" << setfill('-') << setw(50) << "-" << setfill(' ') << endl; + cout << left << setw(5) << "STT" + << left << setw(10) << "Course Id" + << left << setw(25) << "Falcuty" + << left << setw(15) << "Subject Id" + << left << setw(25) << "Subject Name" + << left << setw(15) << "Student/Slot" + << left << setw(6) << "Credit" << endl; + cout << setfill('-') << setw(110) << "-" << setfill(' ') << endl; + for (size_t i = 0; i < this->size; i++) { + ostringstream buffer; + buffer << this->list[i].total_st << "/" << this->list[i].max_st; + cout << left << setw(5) << i + 1 + << left << setw(10) << this->list[i].course_id + << left << setw(25) << this->list[i].falcuty + << left << setw(15) << this->list[i].sub_id + << left << setw(25) << this->list[i].sub_name + << left << setw(15) << buffer.str() + << left << setw(6) << this->list[i].credit << endl; + } +} +CourseList* CourseList::findCourseByFacuty(string fal) { + CourseList* cList = new CourseList(); + for (size_t i = 0; i < size; i++) { + string s = this->list[i].falcuty; + toUpperCase(s); + toUpperCase(fal); + if (s.find(fal) != string::npos) { + cList->addToList(list[i]); + } + } + return cList; +} +CourseList* CourseList::findAllCourseByFalcuty(arrayList fal_list) { + CourseList* cList = new CourseList(); + for (size_t i = 0; i < this->size; i++) { + string s = this->list[i].falcuty; + for (size_t j = 0; j < fal_list.size; j++) { + string s1 = fal_list.list[j]; + toUpperCase(s); + toUpperCase(s1); + int found = s.find(s1); + if (found != string::npos) { + cList->addToList(list[i]); + break; + } + } + } + return cList; +} +bool CourseList::isCourseExist(string id) { + Course* tmp = new Course(); + tmp = findCourseById(id); + if (tmp == NULL) { + return false; + } + else return true; +} \ No newline at end of file diff --git a/BTL_KTLT/Course.h b/BTL_KTLT/Course.h new file mode 100644 index 0000000..0f4ec61 --- /dev/null +++ b/BTL_KTLT/Course.h @@ -0,0 +1,62 @@ +#ifndef _COURSE_ +#define _COURSE_ + +#include +#include "Helper.h" +using namespace std; + +string toUpperCase(string&input); + +struct Course{ + string course_id; + string sub_id; + string falcuty; + string sub_name; + int total_st; + int max_st; + int credit; + + Course() {}; + Course(string sub_id, string sub_name, string falcuty) { + this->sub_id = sub_id; + this->sub_name = sub_name; + this->falcuty = falcuty; + }; + ~Course() {}; + + void isCourseFull() { + if (total_st > max_st) { + this->max_st++; + } + } + void CreateNewCourse(string sub_id, string sub_name, string falcuty, int total_st, int max_st, int credit){ + this->sub_id = sub_id; + this->sub_name = sub_name; + this->falcuty = falcuty; + this->total_st = total_st; + this->max_st = max_st; + this->credit = credit; + } + void printCourseInfo(); // dung de ghi ra thong tin mot course ma teacher vua mo +}; + +//----------------------THIS IS FOR COURSE LIST-------------------- +class CourseList : public arrayList { +public: + CourseList() {}; + ~CourseList() {}; + + Course* findCourseById(string id); + CourseList* findCourseByName(string name); + CourseList* findAllCourseById(arrayList id_list); + CourseList* findAllCourseByName(arrayList name_list); + CourseList* findCourseByFacuty(string fal); + CourseList* findAllCourseByFalcuty(arrayList fal_list); + bool isCourseExist(string id); + bool addToCourseList(Course newCourse); // add a opened course to courseList ( course.csv ) + void addStudentToCourse(string course_id); + void removeStudentToCourse(string course_id); + void printCourse(); +}; +#endif // !_COURSE_ + diff --git a/BTL_KTLT/DBHelper.cpp b/BTL_KTLT/DBHelper.cpp new file mode 100644 index 0000000..57c398d --- /dev/null +++ b/BTL_KTLT/DBHelper.cpp @@ -0,0 +1,262 @@ +#include "DBHelper.h" + +bool loadUsers(UserList &user_list) { + ifstream file; + file.open("user.csv", ios::in); + if (file.is_open() == NULL) { + return false; + } + else { + string line; + while (getline(file, line)) { + User data; + string str; + stringstream ss; + ss.str(line); + + getline(ss, str, ','); + data.username = str; + + getline(ss, str, ','); + data.password = str; + + getline(ss, str, ','); + data.role = str; + + user_list.addToList(data); + } + file.close(); + return true; + } +} +bool loadCourse(CourseList &courseList) { + ifstream file; + file.open("course.csv", ios::in); + if (file.is_open() == NULL) { + return false; + } + else { + string line; + while (getline(file, line)) { + Course data; + string str; + stringstream ss; + ss.str(line); + + getline(ss, str, ','); + data.course_id = str; + + getline(ss, str, ','); + data.falcuty = str; + + getline(ss, str, ','); + data.sub_id = str; + + getline(ss, str, ','); + data.sub_name = str; + + getline(ss, str, ','); + istringstream(str) >> data.max_st; + + getline(ss, str, ','); + istringstream(str) >> data.total_st; + + getline(ss, str, ','); + istringstream(str) >> data.credit; + + courseList.addToList(data); + } + file.close(); + return true; + } +} +bool loadStudentCourse(StudentCourseList &st_course_list) { + ifstream file; + file.open("student_course.csv", ios::in); + if (file.is_open() == NULL) { + return false; + } + else { + string line; + while (getline(file, line)) { + studentCourse data; + string str, str1, str2, str3; + stringstream ss, sstr1, sstr2, sstr3; + ss.str(line); + + getline(ss, str, ';'); + getline(ss, str1, ';'); + getline(ss, str2, ';'); + getline(ss, str3); + + istringstream(str) >> data.st_num; + + sstr1.str(str1); + while (getline(sstr1, str1, ',')) { + data.st_course.addToList(str1); + } + + sstr2.str(str2); + while (getline(sstr2, str2, ',')) { + int num; + istringstream(str2) >> num; + data.st_point.addToList(num); + } + + double st_gpa; + istringstream(str3) >> st_gpa; + + st_course_list.addToList(data); + } + file.close(); + return true; + } +} +bool loadStudentInfo(StudentList &st_list) { + ifstream file; + file.open("student.csv", ios::in); + if (file.is_open() == NULL) { + return false; + } + else { + string line; + while (getline(file, line)) { + Student data; + string str; + stringstream ss; + ss.str(line); + + getline(ss, str, ','); + istringstream(str) >> data.st_number; + + getline(ss, str, ','); + data.st_name = str; + + getline(ss, str, ','); + data.st_birthday = str; + + getline(ss, str); + data.st_home_town = str; + + st_list.addToList(data); + } + file.close(); + return true; + } +} + +bool loadTeacherInfo(TeacherList& tc_list) { + ifstream file; + file.open("teacher.csv", ios::in); + if (file.is_open() == NULL) { + return false; + } + else { + string line; + while (getline(file, line)) { + Teacher data; + string str; + stringstream ss; + ss.str(line); + + getline(ss, str, ','); + data.tc_identify = str; + + getline(ss, str, ','); + data.tc_name = str; + + getline(ss, str, ','); + data.tc_birthday = str; + + getline(ss, str, ','); + data.tc_phone_number = str; + + getline(ss, str); + data.tc_home_town = str; + + tc_list.addToList(data); + } + file.close(); + return true; + } +} + +void writeToCouresFile(CourseList &courseList) { + ofstream file; + file.open("course.csv", ios::trunc); + for (size_t i = 0; i +#include +#include +#include +#include "User.h" +#include "Student.h" +#include "Teacher.h" + +using namespace std; + +bool loadUsers(UserList &user_list); +bool loadCourse(CourseList &courseList); +bool loadStudentCourse(StudentCourseList &st_course_list); +bool loadStudentInfo(StudentList &st_list); +bool loadTeacherInfo(TeacherList &tc_list); +void writeToCouresFile(CourseList &courseList); +void writeToStudentFile(StudentList &st_list); +void writeToTeacherFile(TeacherList &tc_list); //h +void writeToStudentCourseFile(StudentCourseList &st_course_list); +void writeToUserFile(UserList &user_list); +#endif // !_DBHELPER_ + diff --git a/BTL_KTLT/Helper.h b/BTL_KTLT/Helper.h new file mode 100644 index 0000000..bcd2b64 --- /dev/null +++ b/BTL_KTLT/Helper.h @@ -0,0 +1,96 @@ +#ifndef _HELPER_ +#define _HELPER_ +#include +using namespace std; + +#define MAX_USER 100 +using namespace std; +template +class arrayList { +public: + T* list; + size_t size; + size_t arrayCapacity; +public: + arrayList() { + arrayCapacity = MAX_USER; + this->list = new T[MAX_USER]; + size = 0; + } + arrayList(int capacity) { + arrayCapacity = capacity; + this->list = new T[capacity]; + size = 0; + } + ~arrayList() { + } + void removeFromList(int index); + void removeFromList_(T data); + void addToList(T newData); + void modifyListSize(); + bool isEmpty() { + if (size == 0) { + return true; + } + else return false; + } + bool isExist(T data, int&index) { + for (size_t i = 0; i < size; i++) { + if (list[i] == data) { + index = i; + return true; + } + } + index = -1; + return false; + } + + arrayList& operator=(arrayList &r) { + if (this == &r)return *this; + this->arrayCapacity = r.arrayCapacity; + this->size = r.size; + memcpy(this->list, r.list, size * sizeof(string)); + return *this; + } +}; + +template +void arrayList::modifyListSize() { + this->arrayCapacity = this->size + 100; + T* newList = new T[arrayCapacity]; + memmove(newList, this->list, sizeof(T)*size); + this->list = newList; +} + +/// This function addd data at the end of array +template +void arrayList::addToList(T newData) { + if (size < arrayCapacity) { + this->list[size] = newData; + this->size++; + } + if (arrayCapacity - size > 150 || arrayCapacity - size < 10) { + modifyListSize(); + } +} + +template +void arrayList::removeFromList(int index) { + memmove(this->list + index, this->list + index + 1, sizeof(T)*size); + size--; + if (arrayCapacity - size > 100) { + modifyListSize(); + } +} +template +void arrayList::removeFromList_(T data) { + int index; + this->isExist(data, index); + memmove(this->list + index, this->list + index + 1, sizeof(T)*size); + size--; + if (arrayCapacity - size > 100) { + modifyListSize(); + } +} + +#endif // _HELPER_ diff --git a/BTL_KTLT/Main.cpp b/BTL_KTLT/Main.cpp new file mode 100644 index 0000000..8609c91 --- /dev/null +++ b/BTL_KTLT/Main.cpp @@ -0,0 +1,57 @@ +#include +#include "User.h" +#include "Student.h" +#include "Teacher.h" +#include "process.h" +#include "DBHelper.h" +UserList db_user_list; +CourseList db_course_list; +StudentList db_st_list; +TeacherList db_tc_list; +StudentCourseList db_st_course_list; + +using namespace std; + +void main() { + loadUsers(db_user_list); + loadCourse(db_course_list); + loadStudentCourse(db_st_course_list); + loadStudentInfo(db_st_list); + loadTeacherInfo(db_tc_list); + User random_user; + while (startProgram(random_user, db_user_list)) { + system("cls"); + if (random_user.role == "student") { + Student st; + st = random_user; + db_st_list.getStudentInfo(st); + if (studentMenu(st, db_st_course_list, db_course_list, db_user_list) == false) { + break; + } + } + else if (random_user.role == "teacher") { + Teacher tc; + tc = random_user; + db_tc_list.getTeacherInfo(tc); + + if (teacherMenu(tc, db_st_course_list, db_course_list, db_user_list) == false){ + break; + } + } + else if (random_user.role == "admin") { + Admin ad; + ad.username = random_user.username; + ad.password = random_user.password; + ad.role = random_user.role; + if (adminMenu(ad, db_st_list, db_tc_list, db_user_list) == false) { + break; + } + } + } + writeToCouresFile(db_course_list); + writeToStudentCourseFile(db_st_course_list); + writeToStudentFile(db_st_list); + writeToTeacherFile(db_tc_list); + writeToUserFile(db_user_list); + return; +} \ No newline at end of file diff --git a/BTL_KTLT/Process.cpp b/BTL_KTLT/Process.cpp new file mode 100644 index 0000000..2c958de --- /dev/null +++ b/BTL_KTLT/Process.cpp @@ -0,0 +1,768 @@ +#include "Process.h" +#include "Student.h" +#include "Teacher.h" +#include "DBHelper.h" +#include "Admin.h" +#include +#include +#include +#include + +using namespace std; + +bool startProgram(User& random_user, UserList user_list) { + cout << "\t\t\t" << "+++++++++++++++++++++++++++++++++++++|\n\n"; + cout << "\t\t\t" << "| Welcome to student manager site |\n\n"; + cout << "\t\t\t" << "+++++++++++++++++++++++++++++++++++++|\n\n\n"; + while (true) { + + cout << "Username (Type q to exit): "; + cin >> random_user.username; + cout << "Password (Type q to exit): "; + cin >> random_user.password; + cin.ignore(INT_MAX, '\n'); + if (random_user.username == "q" && random_user.password == "q") { + return false; + } + if (user_list.authentication(random_user)) { + return true; + } + else { + cout << "===================" << endl; + cout << "Login Failed" << endl; + bool rep = true; + do { + char option; + cout << "Continue? (Y/N) "; + cin >> option; + cin.ignore(INT_MAX, '\n'); + switch (option) { + case 'Y':rep = false; break; + case 'N':return false; + default: { + cout << "Error: option must be Y or N " << endl; + break; + } + } + system("cls"); + } while (rep); + } + } +} +bool studentMenu(Student& st, StudentCourseList db_st_course_list, CourseList db_course_list, UserList user_list) { + while (st.isLogin() == true) { + cout << setfill('-') << setw(50) << "-" << "Student: " << st.st_number << setw(50) << "-" << endl; + cout << setfill(' ') << setw(30) << left << "1. Change Password [cp]" << setw(30) << left << "2. View my courses [vc]" << setw(30) << left << "3. Search courses[sc]" << setw(30) << left << "4. Join course [jc]" << endl; + cout << setw(30) << left << "5. Cancel course [xc]" << setw(30) << left << "6. Log out [lo]" << setw(30) << left << "7. Help [h]" << endl; + cout << "Your command (press [e] to quit program): "; + string command; + stringstream ss; + string agv; + arrayList agvList; + getline(cin, command); + ss.str(command); + do{ + ss >> agv; + if (ss.fail() || agv == "") { + break; + } + else agvList.addToList(agv); + } while (true); + if (agvList.list[0] == "e" && agvList.size == 1) return false; + if (studentProcess(st, user_list, db_st_course_list, db_course_list, agvList) == true) { + + } + else { + cout << "Error: command not found" << endl; + } + } + return true; +} +bool teacherMenu(Teacher& tc, StudentCourseList& db_st_course_list, CourseList& db_course_list, UserList user_list){ + + while (tc.isLogin() == true){ + + cout << setfill('-') << setw(30) << "-" << "Lecturer: " << tc.tc_name << setw(50) << "-" << endl; + + cout << "1. Change Password [cp (new password) ]\n"; + cout << "2. Open a course [oc]\n"; + cout << "3. Grading student's course [gc]\n"; + //cout << "4. Modify grade [mg]\n"; + cout << "4. Log out [lo]\n"; + cout << "5. Help [h]" << endl; + cout << "Your command (press [e] to quit program): "; + string command; + stringstream ss; + string agv; + arrayList agvList; + getline(cin, command); + ss.str(command); + do{ + ss >> agv; + if (ss.fail() || agv == "") { + break; + } + else agvList.addToList(agv); + } while (true); + if (agvList.list[0] == "e" && agvList.size == 1) return false; + if (teacherProcess(tc, user_list, db_st_course_list, db_course_list, agvList) == true) { + + } + else { + cout << "Error: command not found" << endl; + } + } + //system("cls"); // xoa console menu sau moi lan xong 1 thao tac + return true; +} + +bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_course_list, CourseList db_course_list, arrayList agvList) { + if (agvList.list[0] == "cp") { + if (agvList.size == 2) { + string newPassword = agvList.list[1]; + st.changePassword(newPassword); + user_list.updateList(st); + return true; + } + else if (agvList.size == 1){ + string newPassword; + cout << "Your new password: "; + cin >> newPassword; + cin.ignore(INT_MAX, '\n'); + st.changePassword(newPassword); + user_list.updateList(st); + cout << "CHANGE PASSWORD SUCCESSFULLY" << endl; + return true; + } + } + else if (agvList.list[0] == "vc") { + system("cls"); + studentCourse enrolledCourse; + st.getStudentCourse(db_st_course_list, enrolledCourse); + st.showStudentCourse(&db_course_list, enrolledCourse); + return true; + } + else if (agvList.list[0] == "sc") { + if (agvList.list[1] == "-n") { + if (agvList.size > 2) { + agvList.removeFromList(0); + agvList.removeFromList(0); + CourseList* cList = db_course_list.findAllCourseByName(agvList); + if (cList->size == 0) { + cout << "Error: Failed to find data" << endl; + } + else { + system("cls"); + cList->printCourse(); + } + } + else if (agvList.size == 2) { + cout << "Course to search: "; + string course_name; + getline(cin, course_name); + CourseList* cList = db_course_list.findCourseByName(course_name); + if (cList->size == 0) { + cout << "Error: Failed to find data" << endl; + } + else { + system("cls"); + cList->printCourse(); + } + } + return true; + } + else if (agvList.list[1] == "-f") { + if (agvList.size > 2) { + agvList.removeFromList(0); + agvList.removeFromList(0); + CourseList* cList = db_course_list.findAllCourseByFalcuty(agvList); + cList->printCourse(); + } + else if (agvList.size == 2) { + cout << "Falcuty to search: "; + string fal_name; + getline(cin, fal_name); + CourseList* cList = db_course_list.findCourseByFacuty(fal_name); + cList->printCourse(); + } + return true; + } + } + else if (agvList.list[0] == "jc") { + studentCourse enrolledCourse; + st.getStudentCourse(db_st_course_list, enrolledCourse); + if (agvList.size > 1) { + agvList.removeFromList(0); + if (st.joinCourse(enrolledCourse, agvList, db_st_course_list, db_course_list) == false) { + if (agvList.size != 0) { + cout << "Error: Failed to join in "; + for (size_t i = 0; i < agvList.size; i++) { + cout << "'" << agvList.list[i] << "'"; + } + cout << ". You has already joined the course or it is not opened." << endl; + } + } + else { + cout << "Your have successfully joined the courses." << endl; + } + } + else if (agvList.size == 1) { + string courseId; + arrayList join_course; + cout << "Course to join: "; + cin >> courseId; + cin.ignore(INT_MAX, '\n'); + join_course.addToList(courseId); + if (st.joinCourse(enrolledCourse, join_course, db_st_course_list, db_course_list) == false) { + cout << "Error: Failed to join in "; + for (size_t i = 0; i < join_course.size; i++) { + cout << join_course.list[i] << " | "; + } + cout << ". You has already joined the course or it is not opened." << endl; + } + else { + cout << "Your have successfully joined the courses." << endl; + } + } + return true; + } + else if (agvList.list[0] == "xc") { + studentCourse enrolledCourse; + st.getStudentCourse(db_st_course_list, enrolledCourse); + if (agvList.size > 1) { + agvList.removeFromList(0); + for (size_t i = 0; i < agvList.size; i++) { + if (enrolledCourse.hasEnrolled(agvList.list[i]) == false) { + cout << "Error: You have not joined " << agvList.list[i] << endl; + cout << endl; + } + else { + cout << "You have canceled join " << agvList.list[i] << endl; + } + } + st.cancelCourse(enrolledCourse, agvList, db_st_course_list, db_course_list); + } + else if (agvList.size == 1) { + string courseId; + arrayList cancel_course; + cout << "Course to cancel: "; + cin >> courseId; + cin.ignore(INT_MAX, '\n'); + cancel_course.addToList(courseId); + for (size_t i = 0; i < agvList.size; i++) { + if (enrolledCourse.hasEnrolled(cancel_course.list[i]) == false) { + cout << "Error: You have not joined " << agvList.list[i] << endl; + cout << endl; + } + else { + cout << "You have canceled join " << agvList.list[i] << endl; + } + } + st.cancelCourse(enrolledCourse, cancel_course, db_st_course_list, db_course_list); + } + return true; + } + else if (agvList.list[0] == "lo") { + st.logout(); + system("cls"); + return true; + } + else if (agvList.list[0] == "h") { + if (agvList.size == 1) { + system("cls"); + cout << setw(40) << left << "Description " << setw(10) << left << "Command" << setw(10) << left << "Argument list" << endl; + cout << setw(100) << setfill('-') << "-" << setfill(' ') << endl; + cout << setw(40) << left << "Change password" << setw(10) << left << "cp" << setw(10) << left << " (optional)" << endl; + cout << setw(40) << left << "View all course" << setw(10) << left << "vc" << setw(10) << left << "none" << endl; + cout << setw(40) << left << "Search coures by keyword" << setw(10) << left << "sc -n" << setw(10) << left << " (optional)" << endl; + cout << setw(40) << left << "Search coures by falcuty" << setw(10) << left << "sc -f" << setw(10) << left << " (optional)" << endl; + cout << setw(40) << left << "Cancel course" << setw(10) << left << "xc" << setw(10) << left << " (optional)" << endl; + cout << setw(40) << left << "Join course" << setw(10) << left << "jc" << setw(10) << left << " (optional)" << endl; + cout << setw(100) << setfill('=') << "=" << setfill(' ') << endl; + cout << "Press any key to exit." << endl; + getchar(); + system("cls"); + return true; + } + } + return false; +} +bool teacherProcess(Teacher& tc, UserList& user_list, StudentCourseList& db_st_course_list, CourseList& db_course_list, arrayList agvList) { + +#pragma region ChangePass + if (agvList.list[0] == "cp"){ + string newPassword; + if (agvList.size == 2){ + newPassword = agvList.list[1]; + } + else if (agvList.size == 1){ + cout << "Input your new password: "; + cin >> newPassword; + cin.ignore(INT_MAX, '\n'); + } + tc.changePassword(newPassword); + user_list.updateList(tc); + cout << "CHANGE PASSWORD SUCCESSFULLY\n"; + return true; + } +#pragma endregion + +#pragma region OpenCourse + else if (agvList.list[0] == "oc"){ + CourseList* temp = new CourseList(); + temp = db_course_list.findCourseByFacuty(tc.tc_name); + if (temp->size > 5){ + cout << "You has open 5 courses for this term so you cannot open more course.\n"; + return true; + } + else{ + string newCourse_sub_id; //ms viet tat mon hoc + string newCourse_class_id; //nhom lop + string newCourse_id; //ms mon hoc + string newCourse_name; //ten mon hoc + int newCourse_max; //so luong sv toi da + int newCourse_ncredit; //tin chi + do{ + cout << "Input new sub_course ID you want to open: "; + cin >> newCourse_sub_id; + cin.ignore(INT_MAX, '\n'); + cout << "Input class group: "; + cin >> newCourse_class_id; + cin.ignore(INT_MAX, '\n'); + //newCourse_sub_id=toUpperCase(newCourse_sub_id); + //newCourse_class_id = toUpperCase(newCourse_class_id); + newCourse_id = newCourse_sub_id + "_" + newCourse_class_id; + if (db_course_list.isCourseExist(newCourse_id)){ + cout << "You can not open an existed course. Try again! \n"; + } + } while (db_course_list.isCourseExist(newCourse_id)); + cout << "Input new course details.\n"; + cout << "Input course name: "; getline(cin, newCourse_name); + + do{ + cout << "Input student number limitation (at least 10) : "; cin >> newCourse_max; + cin.clear(); + cin.ignore(INT_MAX, '\n'); + if (newCourse_max < 10 || cin.bad() || newCourse_max != (int)newCourse_max){ + cout << "Invalid input.Try again!\n"; + } + } while (cin.bad() || newCourse_max < 10 || newCourse_max != (int)newCourse_max); + do{ + cout << "Input course's credit number (1-6): "; cin >> newCourse_ncredit; + cin.clear(); + cin.ignore(INT_MAX, '\n'); + + if (!cin.good() || newCourse_ncredit<1 || newCourse_ncredit>6 || newCourse_ncredit != (int)newCourse_ncredit){ + cout << "Invalid input.Try again!\n"; + } + } while (cin.bad() || newCourse_ncredit < 1 || newCourse_ncredit != (int)newCourse_ncredit); + + Course newCourse(newCourse_sub_id, newCourse_name, tc.tc_name); + newCourse.course_id = newCourse_id; + newCourse.total_st = 0; + newCourse.max_st = newCourse_max; + newCourse.credit = newCourse_ncredit; + + + cout << "SUCESSFULLY OPEN A NEW COURSE : \n"; + newCourse.printCourseInfo(); + + cout << "Date created: " << endl; + std::time_t t = std::time(0); // get time now + std::tm* now = std::localtime(&t); + std::cout << (now->tm_year + 1900) << '-' << (now->tm_mon + 1) << '-' << now->tm_mday << "\n"; + cin.ignore(INT_MAX, '\n'); + db_course_list.addToCourseList(newCourse); + return true; + + }//else right + + }//end br + +#pragma endregion + +#pragma region Grading + + else if (agvList.list[0] == "gc"){ + CourseList* tc_open_course = new CourseList(); + tc_open_course = tc.teacherCourse(db_course_list); //lay danh sach nhung course ma teacher da mo + StudentCourseList* data = new StudentCourseList(); + cout << "\nYour opened course: \n"; + tc.showTeacherCouser(tc_open_course); + if (tc_open_course->size == 0){ + cout << "Try opening a course in main menu ! \n"; + return true; + } + int option; + cout << "\n\nChose course to grade or press 0 to exit: "; + cin >> option; + cin.ignore(INT_MAX, '\n'); + if (option == 0){ + return true; + } + else if (option != 0){ + for (size_t i = 0; i < tc_open_course->size; i++){ + if (option == i + 1){ + data = db_st_course_list.findStudentJoinCourse(tc_open_course->list[i].course_id); //lay danh sach sinh vien + diem ma sinh vien tham gia course; + cout << endl; + cout << setw(40) << right << "__Danh Sach Sinh Vien Da Dang Ky__\n" << endl; + cout << setw(5) << left << "STT"; + cout << setw(30) << left << "MSSV"; + cout << setw(20) << right << "Diem\n"; + cout << setfill('-'); + cout << setw(55) << "-" << endl; + cout << setfill(' '); + for (size_t j = 0; j < data->size; j++){ + cout << setw(5) << left << j + 1; + cout << setw(30) << left << data->list[j].st_num; + cout << setw(20) << right << data->list[j].st_point.list[0] << endl; + } + tc.gradingCourse(*data); + db_st_course_list.updatePoint(*data); + + cout << "Successfully modify student's grade!\n"; + cout << "Changes preview: \n"; + //*data = db_st_course_list.findStudentJoinCourse(tc_open_course->list[i].course_id); //lay danh sach sinh vien + diem ma sinh vien tham gia course; + cout << endl; + //cout << setw(40) << right << "__Danh Sach Sinh Vien Da Dang Ky__\n" << endl; + cout << setw(5) << left << "STT"; + cout << setw(30) << left << "MSSV"; + cout << setw(20) << right << "Diem\n"; + cout << setfill('-'); + cout << setw(55) << "-" << endl; + cout << setfill(' '); + for (size_t j = 0; j < data->size; j++){ + cout << setw(5) << left << j + 1; + cout << setw(30) << left << data->list[j].st_num; + cout << setw(20) << right << data->list[j].st_point.list[0] << endl; + } + } + } + return true; + } + + } //end else if + +#pragma endregion + +#pragma region logout + else if (agvList.list[0] == "lo") { + tc.logout(); + system("cls"); + return true; + } +#pragma endregion + +#pragma region help + else if (agvList.list[0] == "h") { + if (agvList.size == 1) { + system("cls"); + cout << setw(40) << left << "Description " << setw(10) << left << "Command" << setw(10) << left << "Argument list" << endl; + cout << setw(100) << setfill('-') << "-" << setfill(' ') << endl; + cout << setw(40) << left << "Change password" << setw(10) << left << "cp" << setw(10) << left << " (optional)" << endl; + cout << setw(40) << left << "Opent a course" << setw(10) << left << "oc" << setw(10) << left << "none" << endl; + cout << setw(40) << left << "Grading a course" << setw(10) << left << "gc" << setw(10) << left << " (optional)" << endl; + //cout << setw(40) << left << "Modify grade" << setw(10) << left << "mg" << setw(10) << left << " (optional)" << endl; + cout << setw(100) << setfill('=') << "=" << setfill(' ') << endl; + cout << "Press any key to exit." << endl; + getchar(); + system("cls"); + return true; + } + } +#pragma endregion + +} + +#pragma region Tien +void to_upper(string &s) { + for (int i = 0; i < s.length(); i++) { + s[i] = toupper(s[i]); + } +} + +bool adminMenu(Admin& ad, StudentList& db_st_list, TeacherList& db_tc_list, UserList& user_list) +{ + while (ad.isLogin() == true) { + cout << setw(40) << setfill('-') << "-" << "ADMIN" << setw(40) << setfill('-') << "-" << endl; + cout << setw(40) << setfill(' ') << left << "Change password" << "[cp]" << endl; + cout << setw(40) << setfill(' ') << left << "Show teacher" << "[t]" << endl; + cout << setw(40) << setfill(' ') << left << "Show student" << "[s]" << endl; + cout << setw(40) << setfill(' ') << left << "Add Teacher" << "[at]" << endl; + cout << setw(40) << setfill(' ') << left << "Add Student" << "[as]" << endl; + cout << setw(40) << setfill(' ') << left << "Remove User" << "[ru]" << endl; + cout << setw(40) << setfill(' ') << left << "Search Teacher by name" << "[st]" << endl; + cout << setw(40) << setfill(' ') << left << "Search Student by name" << "[ss]" << endl; + cout << setw(40) << setfill(' ') << left << "Log out" << "[lo]" << endl; + cout << setw(40) << setfill(' ') << left << "Help" << "[h]" << endl; + cout << "Your command (press [e] to quit program): "; + string command; + stringstream ss; + string agv; + arrayList agvList; + getline(cin, command); + ss.str(command); + do { + ss >> agv; + if (ss.fail() || agv == "") { + break; + } + else agvList.addToList(agv); + } while (true); + if (agvList.list[0] == "e" && agvList.size == 1) return false; + if (adminProcess(ad, user_list, db_st_list, db_tc_list, agvList) == true) { + + } + else { + cout << "Error: command not found" << endl; + } + } + return true; +} + +bool adminProcess(Admin& ad, UserList& user_list, StudentList& db_st_list, TeacherList& db_tc_list, arrayList agvList) { + if (agvList.list[0] == "cp") { + if (agvList.size == 2) { + string newPassword = agvList.list[1]; + ad.changePassword(newPassword); + user_list.updateList(ad); + return true; + } + else if (agvList.size == 1) { + string newPassword; + cout << "Your new password: "; + cin >> newPassword; + cin.ignore(INT_MAX, '\n'); + ad.changePassword(newPassword); + user_list.updateList(ad); + cout << "CHANGE PASSWORD SUCCESSFULLY" << endl; + return true; + } + } + else if (agvList.list[0] == "as") + { + if (ad.addStudent(db_st_list, user_list)) { + cout << "Add Student successful!" << endl; + } + else { + cout << "Add Student unsuccessful! May be the same username have exist." << endl; + } + return true; + } + else if (agvList.list[0] == "at") + { + if (ad.addTeacher(db_tc_list, user_list)) { + cout << "Add Teacher successful!" << endl; + } + else { + cout << "Add Teacher unsuccessful! May be the same username have exist." << endl; + } + return true; + } + else if (agvList.list[0] == "ss") { + if (agvList.size > 1) { + agvList.removeFromList(0); + for (int i = 0; i < agvList.size; i++) { + to_upper(agvList.list[i]); + } + StudentList sList = db_st_list.findStudentByNameKeyWord(agvList.list, agvList.size); + if (sList.size == 0) { + cout << "Error: Failed to find data" << endl; + } + else { + system("cls"); + sList.print(); + } + } + else if (agvList.size == 1) { + cout << "Students to search: "; + string command; + stringstream ss; + string st_name; + arrayList st_list; + getline(cin, command); + ss.str(command); + do { + ss >> st_name; + if (ss.fail() || st_name == "") { + break; + } + else { + to_upper(st_name); + st_list.addToList(st_name); + } + } while (true); + StudentList sList = db_st_list.findStudentByNameKeyWord(st_list.list, st_list.size); + if (sList.size == 0) { + cout << "Error: Failed to find data" << endl; + } + else { + system("cls"); + sList.print(); + } + } + return true; + } + else if (agvList.list[0] == "st") { + if (agvList.size > 1) { + agvList.removeFromList(0); + for (int i = 0; i < agvList.size; i++) { + to_upper(agvList.list[i]); + } + TeacherList tList = db_tc_list.findTeacherByNameKeyword(agvList.list, agvList.size); + if (tList.size == 0) { + cout << "Error: Failed to find data" << endl; + } + else { + system("cls"); + tList.print(); + } + } + else if (agvList.size == 1) { + cout << "Teachers to search: "; + string command; + stringstream ss; + string tc_name; + arrayList tc_list; + getline(cin, command); + ss.str(command); + do { + ss >> tc_name; + if (ss.fail() || tc_name == "") { + break; + } + else { + to_upper(tc_name); + tc_list.addToList(tc_name); + } + } while (true); + TeacherList tList = db_tc_list.findTeacherByNameKeyword(tc_list.list, tc_list.size); + if (tList.size == 0) { + cout << "Error: Failed to find data" << endl; + } + else { + system("cls"); + tList.print(); + } + } + return true; + } + else if (agvList.list[0] == "ru") { + if (agvList.size == 1) { + cout << "Input list of usernames to remove:" << endl; + string input; + stringstream ss; + string username; + arrayList removeList; + getline(cin, input); + ss.str(input); + do { + ss >> username; + if (ss.fail() || username == "") { + break; + } + else removeList.addToList(username); + } while (true); + arrayList remove_unsuccess; + for (int i = 1; i < removeList.size; i++) { + if (ad.removeUser(removeList.list[i], user_list, db_st_list, db_tc_list) == 1) { + + } + else { + remove_unsuccess.addToList(removeList.list[i]); + } + } + if (remove_unsuccess.size == 0) { + cout << "Remove all user successful!" << endl; + } + else { + cout << "Some user remove unsuccessful! That is:" << endl; + for (int j = 0; j < remove_unsuccess.size; j++) { + cout << j + 1 << ".\t" << remove_unsuccess.list[j] << endl; + } + cout << "Other user remove successful!" << endl; + } + return true; + } + else + { + arrayList remove_unsuccess; + for (int i = 1; i < agvList.size; i++) { + if (ad.removeUser(agvList.list[i], user_list, db_st_list, db_tc_list) == 1) { + + } + else { + remove_unsuccess.addToList(agvList.list[i]); + } + } + if (remove_unsuccess.size == 0) { + cout << "Remove all user successful!" << endl; + } + else { + cout << "Some user remove unsuccessful! That is:" << endl; + for (int j = 0; j < remove_unsuccess.size; j++) { + cout << j + 1 << ".\t" << remove_unsuccess.list[j] << endl; + } + cout << "Other user remove successful!" << endl; + } + return true; + } + } + else if (agvList.list[0] == "h") { + if (agvList.size == 1) { + system("cls"); + cout << setw(40) << setfill('-') << "-" << "HELP (ADMIN)" << setw(40) << setfill('-') << "-" << endl << endl; + cout << setw(40) << setfill(' ') << left << "Change password" << "[cp]" << endl; + cout << "Input to change. Or input then input ." << endl << endl; + cout << setw(40) << setfill(' ') << left << "Show teacher" << "[t]" << endl; + cout << "Show all teacher in database." << endl << endl; + cout << setw(40) << setfill(' ') << left << "Show student" << "[s]" << endl; + cout << "Show all student in database." << endl << endl; + cout << setw(40) << setfill(' ') << left << "Add Teacher" << "[at]" << endl; + cout << "Input then input teacher's informations." << endl << endl; + cout << setw(40) << setfill(' ') << left << "Add Student" << "[as]" << endl; + cout << "Input then input student's informations." << endl << endl; + cout << setw(40) << setfill(' ') << left << "Remove User" << "[ru]" << endl; + cout << "Input then input list of usernames. Or input to search. Or input then input ." << endl; + cout << "Input as this format (separate by comma):" << endl << endl; + cout << setw(40) << setfill(' ') << left << "Search Student by name" << "[ss] " << endl; + cout << "Input to search. Or input then input ." << endl; + cout << "Input as this format (separate by comma):" << endl << endl; + cout << setw(40) << setfill(' ') << left << "Log out" << "[lo]" << endl; + cout << "Input to log out. (Then you can log in as another user)." << endl << endl; + cout << "Input anything to return." << endl; + getchar(); + cin.clear(); + cin.ignore(INT_MAX, '\n'); + system("cls"); + return true; + } + } + else if (agvList.list[0] == "t") { + db_tc_list.print(); + cout << "Input anything to return." << endl; + getchar(); + system("cls"); + cin.clear(); + cin.ignore(INT_MAX, '\n'); + return true; + } + else if (agvList.list[0] == "s") { + db_st_list.print(); + cout << "Input anything to return." << endl; + getchar(); + system("cls"); + cin.clear(); + cin.ignore(INT_MAX, '\n'); + return true; + } + else if (agvList.list[0] == "lo") { + ad.logout(); + system("cls"); + return true; + } + return false; +} +#pragma endregion \ No newline at end of file diff --git a/BTL_KTLT/Process.h b/BTL_KTLT/Process.h new file mode 100644 index 0000000..fc868c7 --- /dev/null +++ b/BTL_KTLT/Process.h @@ -0,0 +1,18 @@ +#ifndef _PROCESS_H_ +#define _PROCESS_H_ +#include "User.h" +#include "Student.h" +#include "Teacher.h" +#include "Admin.h" +using namespace std; + +bool startProgram(User& random_user, UserList user_list); + +bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_course_list, CourseList db_course_list, arrayList agvList); +bool studentMenu(Student& st, StudentCourseList db_st_course_list, CourseList db_course_list, UserList user_list); +bool teacherMenu(Teacher& tc, StudentCourseList& db_st_course_list, CourseList& db_course_list, UserList user_list); +bool teacherProcess(Teacher& tc, UserList& user_list, StudentCourseList&db_st_course_list, CourseList& db_course_list, arrayList agvList); +bool adminMenu(Admin& ad, StudentList& db_st_list, TeacherList& db_tc_list, UserList& user_list); +bool adminProcess(Admin& ad, UserList& user_list, StudentList& db_st_list, TeacherList& db_tc_list, arrayList agvList); +#endif // !_PROCESS_H_ + diff --git a/BTL_KTLT/Student.cpp b/BTL_KTLT/Student.cpp new file mode 100644 index 0000000..2df9361 --- /dev/null +++ b/BTL_KTLT/Student.cpp @@ -0,0 +1,212 @@ +#include "Student.h" +using namespace std; + +bool Student::getStudentCourse(StudentCourseList db_st_course_list, studentCourse& enrolledCourse) { + for (size_t i = 0; i < db_st_course_list.size; i++) { + if (db_st_course_list.list[i].st_num == this->st_number) { + enrolledCourse = db_st_course_list.list[i]; + return true; + } + } + return false; +} +bool Student::modifyBaseStudentCourse(StudentCourseList& db_st_course_list, studentCourse enrolledCourse) { + for (size_t i = 0; i < db_st_course_list.size; i++) { + if (db_st_course_list.list[i].st_num == this->st_number) { + if (enrolledCourse.isExist()){ + db_st_course_list.list[i] = enrolledCourse; + } + else db_st_course_list.removeFromList_(enrolledCourse); + return true; + } + } + return false; +} +void Student::showStudentCourse(CourseList* db_courseList, studentCourse enrolledCourse) { + if (enrolledCourse.isExist()) { + CourseList* st_course_detail = db_courseList->findAllCourseById(enrolledCourse.st_course); + cout << setfill('-') << setw(115) << "-" << setfill(' ') << endl; + cout << left << setw(5) << "STT" + << left << setw(30) << "Giao vien huong dan" + << left << setw(20) << "Ma so khoa hoc" + << left << setw(15) << "Ma mon hoc" + << left << setw(30) << "Ten mon hoc" + << left << setw(10) << "Diem" + << left << setw(10) << "Tin chi" << endl; + cout << setfill('-') << setw(50) << setfill(' ') << endl; + for (size_t i = 0; i < enrolledCourse.st_course.size; i++) { + cout << left << setw(5) << i + 1 + << left << setw(30) << st_course_detail->list[i].falcuty + << left << setw(20) << st_course_detail->list[i].course_id + << left << setw(15) << st_course_detail->list[i].sub_id + << left << setw(30) << st_course_detail->list[i].sub_name + << left << setw(10) << enrolledCourse.st_point.list[i] + << left << setw(10) << st_course_detail->list[i].credit << endl; + } + cout << endl; + cout << "Your GPA: " << enrolledCourse.getGPA() << endl; + } + else cout << "You haven't enroll in any course" << endl; +}; +bool Student::joinCourse(studentCourse enrolledCourse, arrayList&courseId, StudentCourseList& db_st_course_list, CourseList& db_course_list) { + if (st_number == enrolledCourse.st_num) { + arrayList error_course; + for (size_t i = 0; i < courseId.size; i++) { + if (db_course_list.isCourseExist(courseId.list[i])) { + if (enrolledCourse.addCourse(courseId.list[i])) { + db_course_list.addStudentToCourse(courseId.list[i]); + courseId.removeFromList(i); + } + } + } + modifyBaseStudentCourse(db_st_course_list, enrolledCourse); + return true; + } + else return false; +}; +bool Student::cancelCourse(studentCourse enrolledCourse, arrayList courseId, StudentCourseList& db_st_course_list, CourseList& db_course_list) { + if (enrolledCourse.isExist()) { + for (size_t i = 0; i < courseId.size; i++){ + enrolledCourse.st_course.removeFromList_(courseId.list[i]); + db_course_list.removeStudentToCourse(courseId.list[i]); + } + modifyBaseStudentCourse(db_st_course_list, enrolledCourse); + return true; + } + else return false; +}; +CourseList* Student::searchForCourseByName(arrayList cList, CourseList db_course_list) { + CourseList* course_list = NULL; + for (size_t i = 0; i < db_course_list.size; i++) { + for (size_t j = 0; j < cList.size; j++) { + course_list = db_course_list.findAllCourseById(cList); + } + } + return course_list; +} +inline bool operator==(Student &lhs, Student &rhs) { + return lhs.st_number == rhs.st_number; +} +inline bool operator==(Student &lhs, int &rhs) { + return lhs.st_number == rhs; +} +inline bool operator==(int &lhs, Student &rhs) { + return lhs == rhs.st_number; +} +inline bool operator!=(Student &lhs, Student &rhs) { + return !(lhs.st_number == rhs.st_number); +} +inline bool operator!=(Student &lhs, int &rhs) { + return !(lhs.st_number == rhs); +} +inline bool operator!=(int &lhs, Student &rhs) { + return !(lhs == rhs.st_number); +} + +inline bool operator==(studentCourse &lhs, studentCourse&rhs) { + return lhs.st_num = rhs.st_num; +} +//-----------------STUDENT_LIST------------------------ +StudentList StudentList::findStudentByNameKeyWord(string keyword[], size_t n) { + StudentList* stList = new StudentList(); + for (size_t i = 0; i < size; i++) { + for (size_t j = 0; j < n; j++) { + if (list[i].st_name.find(keyword[j]) != string::npos) { + Student data = list[i]; + stList->addToList(data); + break; + } + } + } + return *stList; +} + +void StudentList::removeStudentByNameKeyWord(string keyword[], size_t n) { + for (size_t i = 0; i < size; i++) { + for (size_t j = 0; j < n; j++) { + if (list[i].st_name.find(keyword[j]) != string::npos) { + removeFromList(i); + break; + } + } + } +} +void StudentList::updateStudentList(Student data) { + for (size_t i = 0; i < size; i++) { + if (data.st_number == this->list[i].st_number) { + this->list[i] = data; + } + } +} + +bool StudentList::getStudentInfo(Student& st) { + int st_num; + istringstream(st.username) >> st_num; + + for (size_t i = 0; i < size; i++) { + if (st_num == this->list[i].st_number) { + st.st_number = this->list[i].st_number; + st.st_name = this->list[i].st_name; + st.st_birthday = this->list[i].st_birthday; + st.st_home_town = this->list[i].st_home_town; + return true; + } + } + return false; +} + +//Tim sinh vien va diem cua sinh vien tham gia mot khoa hoc nhat dinh. +StudentCourseList* StudentCourseList::findStudentJoinCourse(string courseID){ + StudentCourseList* data = new StudentCourseList(); + int a = 0; + for (size_t i = 0; i < this->size; i++){ + for (size_t j = 0; j < this->list[i].st_course.size; j++){ + if (this->list[i].st_course.list[j].compare(courseID) == 0){ + //data->addToList(this->list[i]); + data->list[a].st_num = this->list[i].st_num; + data->list[a].st_point.list[0] = this->list[i].st_point.list[j]; + data->list[a].st_course.list[0] = this->list[i].st_course.list[j]; + data->size++; + a++; + } + } + } + return data; +} +//Ghi diem vao file student_course. +void StudentCourseList::updatePoint(/*StudentCourseList& db_st_cl*/ StudentCourseList st_join_course){ + //for (size_t i = 0; i < st_join_course.size; i++){ + int i = 0; + for (size_t j = 0; j < this->size; j++){ + for (int k = 0; k < this->list[j].st_course.size; k++){ + if (st_join_course.list[i].st_course.list[0].compare(this->list[j].st_course.list[k]) == 0){ + this->list[j].st_point.list[k] = st_join_course.list[i].st_point.list[0]; + i++; + } + } + } + //} +} + +//Xem khoa hoc da dc cham diem chua. +bool StudentCourseList::isGrade(){ + for (int i = 0; i < this->size; i++){ + if (this->list[i].st_point.list[0] != -1) + return true; + } + return false; +} + +void StudentList::print() +{ + cout << setw(10) << "ID" << setw(30) << "Name" << setw(15) << "Birthday" << setw(50) << "Hometown" << endl; + for (int i = 0; i < this->size; i++) + { + cout + << setw(10) << this->list[i].st_number + << setw(30) << this->list[i].st_name + << setw(15) << this->list[i].st_birthday + << setw(50) << this->list[i].st_home_town + << endl; + } +} \ No newline at end of file diff --git a/BTL_KTLT/Student.h b/BTL_KTLT/Student.h new file mode 100644 index 0000000..fdf2bd2 --- /dev/null +++ b/BTL_KTLT/Student.h @@ -0,0 +1,127 @@ +#ifndef _STUDENT_ +#define _STUDENT_ +#include +#include +#include +#include +#include "Course.h" +#include "Helper.h" +#include "User.h" +using namespace std; +typedef struct studentCourse { +private: + double gpa; +public: + int st_num; + arrayList st_course; + arrayList st_point; + + studentCourse() { + this->st_num = 0; + this->gpa = 13.0; + } + bool isExist() { + if (st_course.size == 0) { + return false; + } + return true; + } + int getCourseNum() { + return this->st_course.size; + } + bool hasEnrolled(string courseId) { + for (size_t i = 0; i < this->getCourseNum(); i++) { + if (this->st_course.list[i] == courseId)return true; + } + return false; + } + bool addCourse(string courseId) { + if (hasEnrolled(courseId) == false) { + this->st_course.addToList(courseId); + this->st_point.addToList(-1); + return true; + } + return false; + } + double getGPA() { return this->gpa; } + bool setGPA(User &user, double newGPA) { + if (user.role == "teacher") { + this->gpa = newGPA; + return true; + } + else return false; + } + bool isGPAsumarized() { + if (this->gpa == 13.0)return false; + else return true; + } + + studentCourse& operator=(studentCourse&data) { + this->st_num = data.st_num; + this->st_course = data.st_course; + this->st_point = data.st_point; + this->gpa = data.getGPA(); + return *this; + } +}; +class StudentCourseList :public arrayList { +public: + StudentCourseList() {}; + ~StudentCourseList() {}; + StudentCourseList* findStudentJoinCourse(string courseID); //tim nhung sinh vien tham gia 1 course nhat dinh (de lay diem) + void updatePoint(/*StudentCourseList& db_st_cl, */StudentCourseList st_join_course); //cap nhat diem vao database + bool isGrade(); //xem course hoc da cham diem chua ( StudentCourseList.st_point.list[0->size] full =-1) + + studentCourse findStudentCourse(int st_num) { + studentCourse data; + for (size_t i = 0; i < this->size; i++) { + if (this->list[i].st_num == st_num) { + data = this->list[i]; + } + } + return data; + } + +}; +class Student : public User{ +public: + int st_number;// id for student's course + string st_name; + string st_birthday; + string st_home_town; + + Student(int num) { + this->st_number = num; + }; + Student() {} + ~Student() {}; + bool getStudentCourse(StudentCourseList db_st_course_list, studentCourse& enrolledCourse); + bool modifyBaseStudentCourse(StudentCourseList& db_st_course_list, studentCourse enrolledCourse); + void showStudentCourse(CourseList* db_courseList, studentCourse enrolledCourse); + bool joinCourse(studentCourse enrolledCourse, arrayList&courseId, StudentCourseList& db_st_course_list, CourseList& db_course_list); + bool cancelCourse(studentCourse enrolledCourse, arrayList courseId, StudentCourseList& db_st_course_list, CourseList& db_course_list); + + CourseList* searchForCourseByName(arrayList cList, CourseList db_course_list); + + Student& operator=(User u) { + this->username = u.username; + this->password = u.password; + this->role = u.role; + return *this; + } + +}; +//-------------------------THIS IS FOR STUDENT LIST---------------------------- +class StudentList : public arrayList{ +public: + StudentList() {}; + ~StudentList() {}; + + StudentList findStudentByNameKeyWord(string keyword[], size_t n); + bool getStudentInfo(Student& st); + void removeStudentByNameKeyWord(string keyword[], size_t n); + void updateStudentList(Student data); + void print(); +}; +#endif // !_STUDENT_ + diff --git a/BTL_KTLT/Teacher.cpp b/BTL_KTLT/Teacher.cpp new file mode 100644 index 0000000..e50d293 --- /dev/null +++ b/BTL_KTLT/Teacher.cpp @@ -0,0 +1,145 @@ +#include "Teacher.h" +using namespace std; + + + +CourseList* Teacher::teacherCourse(CourseList db_course_list){ + return db_course_list.findCourseByFacuty(this->tc_name); +} + + +bool Teacher::gradingCourse(StudentCourseList& st_join_course){ + if (st_join_course.isGrade()){ + int index; + do{ + + double spoint; + cout << "Input student's index to modify grade (press 0) to exit: "; + cin >> index; + cin.ignore(INT_MAX, '\n'); + if (index == 0) break; + cout << "Input new grade for " << st_join_course.list[index].st_num << " : "; + cin >> spoint; + cin.ignore(INT_MAX, '\n'); + st_join_course.list[index].st_point.list[0] = spoint; + + } while (index != 0||cin.bad()); + } + else{ + cout << "Tong ket diem: \n"; + for (int i = 0; i> spoint; + cin.ignore(INT_MAX, '\n'); + st_join_course.list[i].st_point.list[0] = spoint; + } + } + + return true; +} + + + +void Teacher::showTeacherCouser(CourseList* tc_course){ + if (tc_course->size>0){ + cout << setfill('-') << setw(115) << "-" << setfill(' ') << endl; + cout << left << setw(5) << "STT" + << left << setw(20) << "Ma so khoa hoc" + << left << setw(15) << "Ma mon hoc" + << left << setw(30) << "Ten mon hoc" + << left << setw(10) << "Tin chi" + << left << setw(10) << "So luong sinh vien" + << endl; + cout << setfill('-') << setw(50) << setfill(' ') << endl; + for (size_t i = 0; isize; i++) { + cout << left << setw(5) << i + 1 + << left << setw(20) << tc_course->list[i].course_id + << left << setw(15) << tc_course->list[i].sub_id + << left << setw(30) << tc_course->list[i].sub_name + << left << setw(10) << tc_course->list[i].credit + << left << setw(10) << tc_course->list[i].total_st + << endl; + } + } + else cout << "You haven't opened in any course" << endl; +} + + +bool Teacher::openCourse(CourseList& db_course_list, Course newCourse){ + if (db_course_list.isCourseExist(newCourse.course_id)) return false; + else { + //Course newCourse; + db_course_list.addToCourseList(newCourse); + } + +} + + +///Teacher_List_Modify + +TeacherList TeacherList::findTeacherByNameKeyword(string keyword[], size_t n){ + TeacherList* tList = new TeacherList(); + for (size_t i = 0; i < this->size; i++) { + for (size_t j = 0; j < n; j++) { + if (list[i].tc_name.find(keyword[j]) != string::npos) { + Teacher data = list[i]; + tList->addToList(data); + break; + } + } + } + return *tList; +} + +bool TeacherList::getTeacherInfo(Teacher& tc){ + + for (size_t i = 0; i < size; i++) { + + if (tc.username.compare(this->list[i].tc_identify) == 0) + { + tc.tc_identify = this->list[i].tc_identify; + tc.tc_name = this->list[i].tc_name; + tc.tc_birthday = this->list[i].tc_birthday; + tc.tc_phone_number = this->list[i].tc_phone_number; + tc.tc_home_town = this->list[i].tc_home_town; + return true; + } + } + return false; + +} + +void TeacherList::removeTeacherByNameKeyword(string keyword[], size_t n){ + for (size_t i = 0; i < size; i++) { + for (size_t j = 0; j < n; j++) { + if (list[i].tc_name.find(keyword[j]) != string::npos) { + removeFromList(i); + break; + } + } + } +} + +void TeacherList::updateTeacherList(Teacher data){ + for (size_t i = 0; i < size; i++) { + if (data.tc_identify == this->list[i].tc_identify) { + this->list[i] = data; + } + } +} + +void TeacherList::print() +{ + cout << setw(10) << "ID" << setw(30) << "Name" << setw(15) << "Birthday" << setw(15) << "Phone Number" << setw(50) << "Hometown" << endl; + for (int i = 0; i < this->size; i++) + { + cout + << setw(10) << this->list[i].tc_identify + << setw(30) << this->list[i].tc_name + << setw(15) << this->list[i].tc_birthday + << setw(15) << this->list[i].tc_phone_number + << setw(50) << this->list[i].tc_home_town + << endl; + } +} \ No newline at end of file diff --git a/BTL_KTLT/Teacher.h b/BTL_KTLT/Teacher.h new file mode 100644 index 0000000..b6942ac --- /dev/null +++ b/BTL_KTLT/Teacher.h @@ -0,0 +1,56 @@ +#ifndef _TEACHER_ +#define _TEACHER_ + +#include +#include +#include +#include "Helper.h" +#include "User.h" +#include "Course.h" +#include "Student.h" + +using namespace std; + + +class Teacher :public User{ +public: + string tc_identify; + string tc_name; + string tc_birthday; + string tc_phone_number; + string tc_home_town; + CourseList* teacherCourse(CourseList db_courseList); //nhung khoa hoc ma teacher da mo + Teacher(){}; + Teacher(string id){ + this->tc_identify = id; + } + ~Teacher(){}; + + bool openCourse(CourseList& db_courseList, Course newCourse); //mo mot khoa hoc + bool gradingCourse(StudentCourseList& st_join_course); //tong ket diem va sua diem + + void showTeacherCouser(CourseList* tc_course);//Xuat thong tin nhung khoa hoc ma teacher da mo + Teacher& operator=(User u){ + this->username = u.username; + this->password = u.password; + this->role = u.role; + return *this; + } +}; + +//-------------------------LECTURERS LIST------------------------- + +class TeacherList :public arrayList{ +public: + TeacherList(){}; + ~TeacherList(){}; + + TeacherList findTeacherByNameKeyword(string keyword[], size_t n); + bool getTeacherInfo(Teacher& st); + void removeTeacherByNameKeyword(string keyword[], size_t n); + void updateTeacherList(Teacher data); + void print(); +}; + + +#endif \ No newline at end of file diff --git a/BTL_KTLT/User.cpp b/BTL_KTLT/User.cpp new file mode 100644 index 0000000..fd3b15a --- /dev/null +++ b/BTL_KTLT/User.cpp @@ -0,0 +1,49 @@ +#include "User.h" + +using namespace std; + +inline bool operator==(User &lhs, User &rhs) { + return lhs.username == rhs.username; +} +inline bool operator==(User &lhs, string &rhs) { + return lhs.username == rhs; +} +inline bool operator==(string &lhs, User &rhs) { + return lhs == rhs.username; +} +inline bool operator!=(User &lhs, User &rhs) { + return !(lhs.username == rhs.username); +} +inline bool operator!=(User &lhs, string &rhs) { + return !(lhs.username == rhs); +} +inline bool operator!=(string &lhs, User &rhs) { + return !(lhs == rhs.username); +} +//-----------------------USER_LIST-------------------- +int UserList::findUserByUsername(string username) { + for (size_t i = 0; i < size; i++) { + if (this->list[i] == username)return i; + } + return -1; +} + +bool UserList::authentication(User& random_user) { + int index = findUserByUsername(random_user.username); + if (index != -1) { + if (random_user.password == this->list[index].password) { + random_user.role = this->list[index].role; + return true; + } + else return false; + } + else return false; +} +void UserList::updateList(User& user) { + int index = findUserByUsername(user.username); + if (index == -1); + else { + this->list[index].username = user.username; + this->list[index].password = user.password; + } +} diff --git a/BTL_KTLT/User.h b/BTL_KTLT/User.h new file mode 100644 index 0000000..f264b59 --- /dev/null +++ b/BTL_KTLT/User.h @@ -0,0 +1,49 @@ +#ifndef _USER_ +#define _USER_ +#include +#include "Helper.h" +using namespace std; + +class User { +public: + string username; // id + string password; + string role; +public: + User() {} + User(string username, string password) { + this->username = username; + this->password = password; + } + ~User() {}; + + void logout() { + this->username = ""; + this->password = ""; + this->role = ""; + } + bool isLogin() { + if (this->username == "")return false; + else return true; + } + void changePassword(string newPassword) { + this->password = newPassword; + } +}; + +///--------------THIS IS FOR USER LIST---------------- +class UserList :public arrayList { +public: + UserList() {}; + ~UserList() {}; + + inline User& operator[](int index) { + return this->list[index]; + } + + int findUserByUsername(string username); + bool authentication(User& random_user); + void updateList(User& user); +}; + +#endif // !_USER_ diff --git a/BTL_KTLT/course.csv b/BTL_KTLT/course.csv new file mode 100644 index 0000000..2aa23de --- /dev/null +++ b/BTL_KTLT/course.csv @@ -0,0 +1,29 @@ +a2001,NGUYEN MINH DUC,a2,Giai tich 1,100,89,5 +a2002,HOANG LONG THANG,a2,Giai tich 1,100,80,5 +a2003,PHAM LAN CHINH,a2,Giai tich 1,100,99,5 +a2004,PHAM LAN CHINH,a2,Giai tich 1,100,75,5 +a2005,NGUYEN CONG THUC,a2,Giai tich 1,100,95,5 +a2006,VU THI MAI,a2,Giai tich 1,50,49,5 +a2007,HOANG LONG THANG,a2,Giai tich 1,50,45,5 +a2008,NGUYEN THI NHUNG,a2,Giai tich 1,50,40,5 +a2009,NGUYEN THI NHUNG,a2,Giai tich 1,50,30,5 +a2010,NGUYEN MINH DUC,a2,Giai tich 1,50,40,5 +b2001,NGUYEN MINH DUC,b2,Giai tich 2,75,60,4 +b2002,TRAN HUNG NGUYEN,b2,Giai tich 2,75,74,4 +b2003,NINH VAN GIANG,b2,Giai tich 2,75,74,4 +b2004,NGUYEN THANH NHON,b2,Giai tich 2,50,49,4 +b2005,TRIEU THI YEN NHI,b2,Giai tich 2,50,30,4 +c1001,TRAN THUY LINH,c1,Vat ly 1,120,100,3 +c1002,DUONG THANH CONG,c1,Vat ly 1,120,90,3 +c1003,TRAN HUNG NGUYEN,c1,Vat ly 1,60,53,3 +c1004,DO THI MAI,c1,Vat ly 1,60,59,3 +c1005,DUONG THANH CONG,c1,Vat ly 1,60,60,3 +d3001,LA THI NGAT,d3,Vat ly 2,60,60,4 +d3002,LA THI NGAT,d3,Vat ly 2,60,60,4 +d3003,ONG THI THU,d3,Vat ly 2,60,60,4 +d3004,PHAM THI HIEN,d3,Vat ly 2,50,19,4 +d3_005,PHAM LAN CHINH,d3,Vat ly 2,50,20,4 +sub_L02,NGUYEN THI NGOC,sub,Hung,20,0,2 +sub1_L03,NGUYEN THI NGOC,sub1,Natsu,39,3,2 +sub3_L01,NGUYEN THI NGOC,sub3,Natsu2,44,0,4 +sub4_L02,NGUYEN THI NGOC,sub4,natsu,33,0,3 diff --git a/BTL_KTLT/student.csv b/BTL_KTLT/student.csv new file mode 100644 index 0000000..1f10e25 --- /dev/null +++ b/BTL_KTLT/student.csv @@ -0,0 +1,30 @@ +1712350,NONG THI HANH,1987-09-07,"Huyen Luc Nam, Bac Giang" +1712351,TRAN XUAN SON,1985-10-22,"Huyen Pho Yen, Thai Nguyen" +1712352,PHAM THI TRANG,1987-03-22,"Huyen Dong Hy, Thai Nguyen" +1712353,TRAN THI NGOC ANH,1985-06-20,"Huyen Phu Binh, Thai Nguyen" +1712354,MA THI THU UYEN,1991-11-22,"Huyen Tran Yen, Yen Bai" +1712355,DAO THI DUYEN,1988-05-27,"Huyen Phu Binh, Thai Nguyen" +1712356,NONG THI SEN,1986-10-26,"Huyen Pho Yen, Thai Nguyen" +1712357,LY THI THUYEN,1989-04-06,"Huyen Pho Yen, Thai Nguyen" +1712358,DO THI HUE,1985-06-13,"Thi xa Song Cong, Thai Nguyen" +1712359,DANG THE ANH,1989-03-27,"Thanh pho Thai Nguyen, Thai Nguyen" +1712360,NGUYEN HONG HANH,1989-01-24,"Huyen Phu Luong, Thai Nguyen" +1712361,HOANG THI DINH,1991-02-02,"Huyen Phu Binh, Thai Nguyen" +1712371,NGO THI LE HANG,1991-03-20,"Huyen Quynh Nhai, Son La" +1712372,KHONG HUONG GIANG,1985-12-11,"Huyen Thuong Xuan, Thanh Hoa" +1712373,DIEP THI HONG THUY,1985-08-19,"Thanh pho Bac Ninh, Bac Ninh" +1712374,NGUYEN VAN DUY,1989-03-11,"Huyen Cam Thuy, Thanh Hoa" +1712375,VU NHU QUYNH,1987-03-27,"Huyen Phu Luong, Thai Nguyen" +1712376,PHUNG KHU PU,1987-07-18,"Huyen Dinh Hoa, Thai Nguyen" +1712377,MA THI YEN NHI,1988-07-07,"Huyen Binh Lieu, Quang Ninh" +1712378,DINH THUY NGAN,1988-01-05,"Huyen Pho Yen, Thai Nguyen" +1712379,BANG THI DUYEN,1985-12-17,"Thanh pho Thai Nguyen, Thai Nguyen" +1712486,NGUYEN THI NGOC KHANH,1987-12-17,"Huyen Pho Yen, Thai Nguyen" +1712487,NGUYEN QUYNH TRANG,1989-02-05,"Huyen Dai Tu, Thai Nguyen" +1712488,DOI THI DIEU TIEN,1986-02-06,"Huyen Dai Tu, Thai Nguyen" +1712489,HOANG HUYEN TRANG,1988-03-19,"Thanh pho Thai Nguyen, Thai Nguyen" +1712490,DO DINH DUY,1990-11-17,"Thi xa Song Cong, Thai Nguyen" +1712491,NGUYEN HOANG HIEU,1989-02-24,"Huyen Lam Thao, Phu Tho" +1712492,NGUYEN THI NHI,1988-01-27,"Thanh pho Thai Nguyen, Thai Nguyen" +1712493,NGO QUANG DUONG,1986-02-20,"Huyen Phu Luong, Thai Nguyen" +1712494,MO THI THANH KIM HUE,1991-01-16,"Thi xa Song Cong, Thai Nguyen" diff --git a/BTL_KTLT/student_course.csv b/BTL_KTLT/student_course.csv new file mode 100644 index 0000000..e3e7623 --- /dev/null +++ b/BTL_KTLT/student_course.csv @@ -0,0 +1,33 @@ +1712350;c1003,b2002;9,8;13 +1712351;b2004,d3003;20,0;13 +1712352;b2003,c1005,c1004,sub1_L03;8,9,10,-1;13 +1712353;b2002,d3004,d3005;-1,0,0;13 +1712354;b2001,c1002,b2005;6,7,7;13 +1712355;c1005,b2005,b2001;9,8,8;13 +1712356;a2008,a2009,b2002;4,8,-1;13 +1712357;c1003,b2002,a2003;10,9,9;13 +1712358;a2002,b2003,c1003;5,4,6;13 +1712359;d3002,b2002,c1005;8,6,7;13 +1712360;d3005,a2005,d3002;3,8,9;13 +1712361;d3004,b2003,d3003;4,2,-1;13 +1712371;d3002,d3004,b2002;3,-1,5;13 +1712372;b2005,a2007,d3001;2,6,9;13 +1712373;c1005,b2002,c1001;3,5,4;13 +1712374;a2004,b2001,c1004;6,2,7;13 +1712375;a2001,d3001,b2003,sub1_L03;7,4,5,-1;13 +1712376;a2001,d3002,b2001;8,8,7;13 +1712377;a2010,a2001,d3001;5,9,6;13 +1712378;a2001,d3002,a2010;9,8,7;13 +1712379;b2005,a2009,c1005;6,7,8;13 +1712486;a2005,c1003,c1001;10,6,9;13 +1712487;b2004,c1005,c1002;20,4,-1;13 +1712488;b2003,a2001,c1002;8,9,8;13 +1712489;b2002,d3002,c1002;2,3,6;13 +1712490;a2006,c1002,d3005;0,0,0;13 +1712491;c1004,c1001,b2002;2,3,5;13 +1712492;c1003,a2001,c1002;8,4,6;13 +1712493;a2007,d3004,d3001;9,3,-1;13 +1712494;b2001,a2006,d3005;10,8,9;13 +1712494;b2001,a2006,d3005;10,8,9;13 +1712494;b2001,a2006,d3005;10,8,9;13 +1712494;b2001,a2006,d3005;10,8,9;13 diff --git a/BTL_KTLT/teacher.csv b/BTL_KTLT/teacher.csv new file mode 100644 index 0000000..9158d77 --- /dev/null +++ b/BTL_KTLT/teacher.csv @@ -0,0 +1,50 @@ +S0951,BUI QUOC TRUNG,1989-10-09,"01268024528","Huyen Bac Quang, Ha Giang" +S0952,NGUYEN THI NGOC,1991-05-02,"01262228406","Huyen Phong Tho, Lai Chau" +S0953,TRAN HUNG NGUYEN,1987-02-24,"01676288131","Huyen Dinh Hoa, Thai Nguyen" +S0954,NGUYEN TAN DUNG,1989-04-10,"0968562100","Huyen Tien Du, Bac Ninh" +S0955,DO THI THUONG,1990-02-08,"01264232833","Huyen Viet Yen, Bac Giang" +S0956,NGUYEN THI NHUNG,1987-01-14,"01249854229","Huyen Na Ri, Bac Kan" +S0957,NGUYEN THI LOAN,1990-07-10,"01235747029","Thi xa Song Cong, Thai Nguyen" +S0958,LE THI NGOC TRANG,1990-08-24,"01243175018","Huyen Pho Yen, Thai Nguyen" +S0959,TRAN CONG MINH,1990-11-23,"01686151088","Huyen Pho Yen, Thai Nguyen" +S0960,NGUYEN THI NGOC ANH,1988-04-13,"01672997174","Huyen Dong Hy, Thai Nguyen" +S0961,LA THI NGAT,1991-10-25,"01237300992","Huyen Phu Binh, Thai Nguyen" +S0962,PHAM THI MINH CHAM,1988-12-17,"01651757943","Huyen Yen Son, Tuyen Quang" +S0963,NGUYEN THI TUOI,1985-02-16,"0965570211","Thanh pho Lang Son, Lang Son" +S0964,LE MINH HUNG,1986-03-18,"01685174289","Thi xa Song Cong, Thai Nguyen" +S0965,ONG THI THU,1988-10-03,"01234640825","Huyen Son Dong, Bac Giang" +S0966,NGUYEN THI KHANH HUYEN,1985-06-18,"01688673221","Huyen Phu Binh, Thai Nguyen" +S0967,NGUYEN THANH NHON,1990-09-28,"01651137554","Thanh pho Thai Nguyen, Thai Nguyen" +S0968,NGUYEN THI HONG,1988-10-23,"0981689837","Huyen Chi Lang, Lang Son" +S0969,THIEU THI DUNG,1986-12-14,"01658590942","Huyen Bao Lam, Cao Bang" +S0970,NGUYEN HUU THANG,1988-04-15,"0966094621","Huyen Pho Yen, Thai Nguyen" +S0971,TA THI HOAI THUONG,1989-12-21,"01671984944","Huyen Muong Te, Lai Chau" +S0972,MAI VIET ANH,1990-02-02,"0987525935","Huyen Mai Son, Son La" +S0973,KHUC THI THANH XUYEN,1991-12-20,"01269605742","Thanh pho Thai Nguyen, Thai Nguyen" +S0974,VU THI MAI,1988-08-03,"0983964837","Thanh pho Thai Nguyen, Thai Nguyen" +S0975,NGUYEN VAN TU,1991-05-15,"01651078560","Thanh pho Thai Nguyen, Thai Nguyen" +S0976,NINH VAN GIANG,1990-02-06,"01682298994","Thanh pho Thai Nguyen, Thai Nguyen" +S0977,TRIEU THI YEN NHI,1988-06-22,"0965488514","Huyen Cho Moi, Bac Kan" +S0978,NGUYEN THI BUNG,1987-04-13,"01681130368","Thanh pho Lao Cai, Lao Cai" +S0979,NGUYEN TRONG TON,1985-03-03,"01651968803","Huyen Quang Xuong, Thanh Hoa" +S0980,TRAN THUY LINH,1987-11-12,"01683529386","Huyen Dinh Hoa, Thai Nguyen" +S0981,TRAN VAN THE,1988-03-20,"01677867647","Huyen Dong Hy, Thai Nguyen" +S0982,NGUYEN MINH DUC,1989-01-04,"01248224532","Huyen Vo Nhai, Thai Nguyen" +S0983,NGUYEN CONG THUC,1985-11-14,"01677048699","Thanh pho Yen Bai, Yen Bai" +S0984,CAO XUAN VU,1990-01-11,"01263131000","Thi xa Song Cong, Thai Nguyen" +S0985,PHAM LAN CHINH,1985-01-04,"0987285420","Huyen Pho Yen, Thai Nguyen" +S0986,NGUYEN QUANG HUY,1988-12-12,"01658548002","Huyen Dinh Hoa, Thai Nguyen" +S0987,TRAN HIEN CHUNG,1990-09-21,"01232341463","Huyen Dai Tu, Thai Nguyen" +S0988,LE THI QUYNH TRANG,1990-10-21,"01244931089","Huyen Phu Binh, Thai Nguyen" +S0989,CHU BA THANH,1987-10-04,"0967479093","Huyen Pho Yen, Thai Nguyen" +S0990,HOANG LONG THANG,1985-01-24,"01261757930","Huyen Tan Yen, Bac Giang" +S0991,DUONG THANH CONG,1990-01-21,"01659655144","Thanh pho Thai Nguyen, Thai Nguyen" +S0992,DANG DUC DAI,1991-04-19,"01674865304","Huyen Dong Hy, Thai Nguyen" +S0993,DO THI MAI,1990-12-17,"01672218926","Huyen Si Ma Cai, Lao Cai" +S0994,CHAU THI NGUYET,1987-03-08,"01262412050","Thi xa Song Cong, Thai Nguyen" +S0995,TRIEU THI THAO,1985-12-04,"01263314285","Thi xa Song Cong, Thai Nguyen" +S0996,NGUYEN THI HOANG ANH,1990-02-25,"0984679722","Huyen Pho Yen, Thai Nguyen" +S0997,DANG THI HUONG,1987-12-05,"01657457229","Huyen Dong Hy, Thai Nguyen" +S0998,PHAM THI HIEN,1986-10-12,"01265612176","Huyen Bach Thong, Bac Kan" +S0999,TRUONG THI HANH,1991-12-20,"01657495907","Huyen Phu Luong, Thai Nguyen" +S1000,NGUYEN THI NGOC ANH,1991-08-22,"01657462318","Thanh pho Thai Nguyen, Thai Nguyen" diff --git a/BTL_KTLT/user.csv b/BTL_KTLT/user.csv new file mode 100644 index 0000000..28c16c4 --- /dev/null +++ b/BTL_KTLT/user.csv @@ -0,0 +1,81 @@ +1712350,123456,student +1712351,1712351,student +1712352,1712352,student +1712353,1712353,student +1712354,1712354,student +1712355,abc123,student +1712356,1712356,student +1712357,1712357,student +1712358,1712358,student +1712359,1712359,student +1712360,1712360,student +1712361,1712361,student +1712371,1712371,student +1712372,haidang,student +1712373,1712373,student +1712374,1712374,student +1712375,1712375,student +1712376,1712376,student +1712377,1712377,student +1712378,1712378,student +1712379,1712379,student +1712486,1712486,student +1712487,1712487,student +1712488,1712488,student +1712489,1712489,student +1712490,1712490,student +1712491,1712491,student +1712492,1712492,student +1712493,1712493,student +1712494,1712494,student +S0951,Sabcd,teacher +S0952,S0952,teacher +S0953,S0953,teacher +S0954,S0954,teacher +S0955,S0955,teacher +S0956,S0956,teacher +S0957,S0957,teacher +S0958,hahu,teacher +S0959,S0959,teacher +S0960,S0960,teacher +S0961,S0961,teacher +S0962,S0962,teacher +S0963,S0963,teacher +S0964,S0964,teacher +S0965,S0965,teacher +S0966,S0966,teacher +S0967,S0967,teacher +S0968,S0968,teacher +S0969,S0969,teacher +S0970,S0970,teacher +S0971,S0971,teacher +S0972,S0972,teacher +S0973,S0973,teacher +S0974,S0974,teacher +S0975,S0975,teacher +S0976,S0976,teacher +S0977,S0977,teacher +S0978,S0978,teacher +S0979,S0979,teacher +S0980,S0980,teacher +S0981,S0981,teacher +S0982,S0982,teacher +S0983,S0983,teacher +S0984,S0984,teacher +S0985,S0985,teacher +S0986,S0986,teacher +S0987,S0987,teacher +S0988,S0988,teacher +S0989,S0989,teacher +S0990,S0990,teacher +S0991,S0991,teacher +S0992,S0992,teacher +S0993,S0993,teacher +S0994,S0994,teacher +S0995,S0995,teacher +S0996,S0996,teacher +S0997,S0997,teacher +S0998,S0998,teacher +S0999,S0999,teacher +S1000,S1000,teacher +admin,a,admin \ No newline at end of file