diff --git a/Admin.cpp b/Admin.cpp new file mode 100644 index 0000000..f65b44c --- /dev/null +++ b/Admin.cpp @@ -0,0 +1,288 @@ +#include "Admin.h" + +using namespace std; + +//Loai bo khoang trang khoi string +inline string remove_space(string str) { + str.erase(remove(str.begin(), str.end(), ' '), str.end()); + return str; +} + +//Kiem tra string co chua dau phay "," khong +inline bool check_comma(string np) { + for (int i = 0; i < np.length(); i++) { + if (np[i] == ',') return false; + } + return true; +} + +//Kiem tra nam nhuan +inline bool isleapyear(unsigned short year) { + return (!(year % 4) && (year % 100) || !(year % 400)); +} + +//Kiem tra ngay thang nam hop le +inline bool valid_date(unsigned short year, unsigned short month, unsigned short day) { + unsigned short monthlen[] = { 31,28,31,30,31,30,31,31,30,31,30,31 }; + if (!year || !month || !day || month>12) + return 0; + if (isleapyear(year) && month == 2) + monthlen[1]++; + if (day>monthlen[month - 1]) + return 0; + return 1; +} + +//Ham nhap ten +inline bool input_name(string &name) { + string s; + cout << "Input name:" << endl; + getline(cin, s); + if (check_comma(s) == 0) { + return 0; + } + to_upper(s); + for (unsigned int i = 0; i < s.length(); i++) { + if (isalpha(s[i]) == 0) { + return 0; + } + } + name = s; + return 1; +} + +//Ham nhap ngay thang nam sinh +inline bool input_birthday(string &birthday) { + string s; + stringstream ss, ss2; + char c; + cout << "Input date of birth: (YYYY-MM-DD)" << endl; + getline(cin, s); + if (check_comma(s) == 0) { + return 0; + } + s = remove_space(s); + unsigned short d, m, y; + ss.str(s); + ss >> y; + if (ss.fail()) { + return 0; + } + ss >> c; + ss >> m; + if (ss.fail()) { + return 0; + } + ss >> c; + ss >> d; + if (ss.fail()) { + return 0; + } + if (valid_date(y, m, d) == 0) { + return 0; + } + ss2 << y << '-'; + if (m < 10) { + ss2 << '0'; + } + ss2 << m << '-'; + if (d < 10) { + ss2 << '0'; + } + ss2 << d; + ss2 >> s; + birthday = s; + return 1; +} + +//Ham nhap que quan +inline bool input_hometown(string &hometown) { + string s; + cout << "Input hometown:" << endl; + getline(cin, s); + if (check_comma(s) == 0) { + return 0; + } + hometown = "\"" + s + "\""; + return 1; +} + +//Ham them nguoi dung vao user.csv +bool Admin::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; + } +} + +//Ham xoa tat ca du lieu cua nguoi dung khoi database +bool Admin::removeUser(string username, UserList &db_user_list, StudentList &db_st_list, TeacherList &db_tc_list, CourseList &db_course_list, StudentCourseList &db_st_course_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; + if (s == "student") { + stringstream ss; + ss.str(username); + int id; + ss >> id; + for (size_t i = 0; i < db_st_list.size; i++) { + if (db_st_list.list[i].st_number == id) { + studentCourse enrolled_course; + CourseList* db_courseList = new CourseList(); + db_st_list.list[i].getStudentCourse(db_st_course_list, enrolled_course, db_courseList); + for (size_t j = 0; j < enrolled_course.st_course.size; j++) { + for (size_t k = 0; k < db_course_list.size; k++) { + if (db_course_list.list[k].course_id == enrolled_course.st_course.list[j]) { + db_course_list.list[k].total_st--; + } + } + } + db_st_list.removeFromList(i); + break; + } + } + for (size_t i = 0; i < db_st_course_list.size; i++) { + if (db_st_course_list.list[i].st_num == id) { + db_st_course_list.removeFromList(i); + break; + } + } + } + else { + for (size_t i = 0; i < db_tc_list.size; i++) { + if (db_tc_list.list[i].tc_identify == username) { + CourseList* tc_open_course = new CourseList(); + tc_open_course = db_tc_list.list[i].teacherCourse(db_course_list); + for (size_t j = 0; j < tc_open_course->size; j++) { + for (size_t k = 0; k < db_st_course_list.size; k++) { + for (size_t l = 0; l < db_st_course_list.list[k].st_course.size; l++) { + if (db_st_course_list.list[k].st_course.list[l] == tc_open_course->list[j].course_id) { + if (db_st_course_list.list[k].st_course.size > 1) { + db_st_course_list.list[k].st_course.removeFromList(l); + db_st_course_list.list[k].st_point.removeFromList(l); + for (size_t m = 0; m < db_st_list.size; m++) { + if (db_st_list.list[m].st_number == db_st_course_list.list[k].st_num) { + studentCourse enrolled_course; + CourseList* db_courseList = new CourseList(); + db_st_list.list[m].getStudentCourse(db_st_course_list, enrolled_course, db_courseList); + db_st_list.list[m].modifyBaseStudentCourse(db_st_course_list, enrolled_course); + } + } + } + else { + db_st_course_list.removeFromList(k); + k--; + } + break; + } + } + } + for (size_t n = 0; n < db_course_list.size; n++) { + if (db_course_list.list[n].course_id == tc_open_course->list[j].course_id) { + db_course_list.removeFromList(n); + break; + } + } + } + db_tc_list.removeFromList(i); + break; + } + } + } + db_user_list.removeFromList(index); + return 1; + } +} + +//Ham them student +bool Admin::addStudent(StudentList &db_st_list, UserList &db_user_list) { + Student st; + User student; + string s; + stringstream ss, ss2; + student.role = "student"; + cout << "Input number:" << endl; + getline(cin, s); + if (check_comma(s) == 0) { + return 0; + } + s = remove_space(s); + ss.str(s); + ss >> st.st_number; + if (ss.fail()) { + return 0; + } + if (st.st_number < 0) { + return 0; + } + ss2 << st.st_number; + ss2 >> s; + student.username = s; + student.password = s; + if (input_name(st.st_name) == 0) { + return 0; + } + if (input_birthday(st.st_birthday) == 0) { + return 0; + } + if (input_hometown(st.st_home_town) == 0) { + return 0; + } + if (addUser(student, db_user_list) == 1) { + db_st_list.addToList(st); + return 1; + } + else { + return 0; + } +} + +//Ham them teacher +bool Admin::addTeacher(TeacherList &db_tc_list, UserList &db_user_list) { + Teacher tc; + User teacher; + string s; + teacher.role = "teacher"; + cout << "Input identify:" << endl; + getline(cin, s); + if (check_comma(s) == 0) { + return 0; + } + s = remove_space(s); + if (s == "q") { + return 0; + } + tc.tc_identify = s; + teacher.username = s; + teacher.password = s; + if (input_name(tc.tc_name) == 0) { + return 0; + } + if (input_birthday(tc.tc_birthday) == 0) { + return 0; + } + cout << "Input phone:" << endl; + getline(cin, s); + for (unsigned int i = 0; i < s.length(); i++) { + if (isdigit(s[i]) == 0) { + return 0; + } + } + tc.tc_phone_number = "\"" + s + "\""; + if (input_hometown(tc.tc_home_town) == 0) { + return 0; + } + if (addUser(teacher, db_user_list)) { + db_tc_list.addToList(tc); + return 1; + } + else { + return 0; + } +} \ No newline at end of file diff --git a/Admin.h b/Admin.h index abe6e31..0191929 100644 --- a/Admin.h +++ b/Admin.h @@ -8,6 +8,8 @@ #include #include "Helper.h" #include "User.h" +#include "Student.h" +#include "Teacher.h" using namespace std; @@ -21,124 +23,10 @@ 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, CourseList &db_course_list, StudentCourseList &db_st_course_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; - if (s == "student") { - stringstream ss; - ss.str(username); - int id; - ss >> id; - for (size_t i = 0; i < db_st_list.size; i++) { - if (db_st_list.list[i].st_number == id) { - db_st_list.removeFromList(i); - break; - } - } - for (size_t i = 0; i < db_st_course_list.size; i++) { - if (db_st_course_list.list[i].st_num == id) { - db_st_course_list.removeFromList(i); - break; - } - } - } - else { - string name; - for (size_t i = 0; i < db_tc_list.size; i++) { - if (db_tc_list.list[i].tc_identify == username) { - name = db_tc_list.list[i].tc_name; - db_tc_list.removeFromList(i); - break; - } - } - for (size_t i = 0; i < db_course_list.size; i++) { - while (db_course_list.list[i].falcuty == name) { - db_course_list.removeFromList(i); - } - } - } - db_user_list.removeFromList(index); - 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, ','); - if (s == "q") { - return 0; - } - student.username = student.password = s; - istringstream iss; - iss.str(s); - iss >> st.st_number; - if (iss.fail()) { - cin.clear(); - cin.ignore(INT_MAX, '\n'); - return 0; - } - getline(cin, s, ','); - to_upper(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, ','); - if (s == "q") { - return 0; - } - tc.tc_identify = teacher.username = teacher.password = s; - getline(cin, s, ','); - to_upper(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; - } - } + bool addUser(User user, UserList &db_user_list); + bool removeUser(string username, UserList &db_user_list, StudentList &db_st_list, TeacherList &db_tc_list, CourseList &db_course_list, StudentCourseList &db_st_course_list); + bool addStudent(StudentList &db_st_list, UserList &db_user_list); + bool addTeacher(TeacherList &db_tc_list, UserList &db_user_list); }; -#endif // !_ADMIN_ +#endif // !_ADMIN_ \ No newline at end of file diff --git a/Bak/course.csv b/Bak/course.csv index 2aa23de..753a578 100644 --- a/Bak/course.csv +++ b/Bak/course.csv @@ -1,29 +1,20 @@ -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 +a1,S0951,BUI QUOC TRUNG,a,Giai tich 1,15,15,3 +a2,S0951,BUI QUOC TRUNG,a,Giai tich 1,15,15,3 +a3,S0952,NGUYEN THI NGOC,a,Giai tich 1,15,10,3 +a4,S0951,BUI QUOC TRUNG,a,Giai tich 2,12,10,3 +a5,S0952,NGUYEN THI NGOC,a,Giai tich 2,12,10,3 +b1,S0953,TRAN HUNG NGUYEN,b,Vat ly 1,15,14,4 +b2,S0954,NGUYEN TAN DUNG,b,Vat ly 1,15,14,4 +b3,S0953,TRAN HUNG NGUYEN,b,Vat ly 1,15,12,4 +b4,S0954,NGUYEN TAN DUNG,b,Vat ly 2,12,10,4 +b5,S0953,TRAN HUNG NGUYEN,b,Vat ly 2,12,10,4 +c1,S0956,NGUYEN THI NHUNG,c,GDTC 1,18,15,0 +c2,S0955,DO THI THUONG,c,GDTC 1,18,15,0 +c3,S0955,DO THI THUONG,c,GDTC 2,15,10,0 +c4,S0956,NGUYEN THI NHUNG,c,GDTC 2,15,10,0 +c5,S0956,NGUYEN THI NHUNG,c,GDTC 3,12,10,0 +d1,S0958,LE THI NGOC TRANG,d,Anh van 1,18,15,2 +d2,S0957,NGUYEN THI LOAN,d,Anh van 1,18,15,2 +d3,S0958,LE THI NGOC TRANG,d,Anh van 2,15,10,2 +d4,S0957,NGUYEN THI LOAN,d,Anh van 2,15,10,2 +d5,S0957,NGUYEN THI LOAN,d,Anh van 3,12,10,2 diff --git a/Bak/student.csv b/Bak/student.csv index 1f10e25..cfb2ca6 100644 --- a/Bak/student.csv +++ b/Bak/student.csv @@ -1,30 +1,40 @@ -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" +1712351,NONG THI SEN,1986-10-26,"Huyen Pho Yen, Thai Nguyen" +1712352,LY THI THUYEN,1989-04-06,"Huyen Pho Yen, Thai Nguyen" +1712353,DO THI HUE,1985-06-13,"Thi xa Song Cong, Thai Nguyen" +1712354,DANG THE ANH,1989-03-27,"Thanh pho Thai Nguyen, Thai Nguyen" +1712355,NGUYEN HONG HANH,1989-01-24,"Huyen Phu Luong, Thai Nguyen" +1712356,HOANG THI DINH,1991-02-02,"Huyen Phu Binh, Thai Nguyen" +1712357,NGO THI LE HANG,1991-03-20,"Huyen Quynh Nhai, Son La" +1712358,KHONG HUONG GIANG,1985-12-11,"Huyen Thuong Xuan, Thanh Hoa" +1712359,DIEP THI HONG THUY,1985-08-19,"Thanh pho Bac Ninh, Bac Ninh" +1712360,NGUYEN VAN DUY,1989-03-11,"Huyen Cam Thuy, Thanh Hoa" +1712361,VU NHU QUYNH,1987-03-27,"Huyen Phu Luong, Thai Nguyen" +1712362,PHUNG KHU PU,1987-07-18,"Huyen Dinh Hoa, Thai Nguyen" +1712363,MA THI YEN NHI,1988-07-07,"Huyen Binh Lieu, Quang Ninh" +1712364,DINH THUY NGAN,1988-01-05,"Huyen Pho Yen, Thai Nguyen" +1712365,BANG THI DUYEN,1985-12-17,"Thanh pho Thai Nguyen, Thai Nguyen" +1712366,NGUYEN THI NGOC KHANH,1987-12-17,"Huyen Pho Yen, Thai Nguyen" +1712367,NGUYEN QUYNH TRANG,1989-02-05,"Huyen Dai Tu, Thai Nguyen" +1712368,DOI THI DIEU TIEN,1986-02-06,"Huyen Dai Tu, Thai Nguyen" +1712369,HOANG HUYEN TRANG,1988-03-19,"Thanh pho Thai Nguyen, Thai Nguyen" +1712370,DO DINH DUY,1990-11-17,"Thi xa Song Cong, Thai Nguyen" +1712371,NGUYEN HOANG HIEU,1989-02-24,"Huyen Lam Thao, Phu Tho" +1712372,NGUYEN THI NHI,1988-01-27,"Thanh pho Thai Nguyen, Thai Nguyen" +1712373,NGO QUANG DUONG,1986-02-20,"Huyen Phu Luong, Thai Nguyen" +1712374,MO THI THANH KIM HUE,1991-01-16,"Thi xa Song Cong, Thai Nguyen" +1712375,MONG THI THU,1990-09-13,"Thanh pho Thai Nguyen, Thai Nguyen" +1712376,HOANG THI THU HANG,1985-10-17,"Huyen Dinh Hoa, Thai Nguyen" +1712377,DANG THU HANH,1991-04-17,"Huyen Dong Hy, Thai Nguyen" +1712378,DIEP THI LINH,1985-11-02,"Huyen Pho Yen, Thai Nguyen" +1712379,HAN MINH HANG,1985-10-07,"Huyen Dai Tu, Thai Nguyen" +1712380,NGUYEN DIEU LINH,1987-10-08,"Huyen Dai Tu, Thai Nguyen" +1712381,LY MAI DUONG,1987-05-21,"Thanh pho Thai Nguyen, Thai Nguyen" +1712382,DANG THI LINH,1986-04-19,"Thanh pho Thai Nguyen, Thai Nguyen" +1712383,NGUYEN DOAN THAI HUNG,1991-05-17,"Thi xa Song Cong, Thai Nguyen" +1712384,HOANG THI THANH PHUONG,1988-08-17,"Huyen Dong Hy, Thai Nguyen" +1712385,TO TRUNG HIEU,1987-03-14,"Huyen Pho Yen, Thai Nguyen" +1712386,NGUYEN THI HUONG,1989-02-27,"Huyen Phu Binh, Thai Nguyen" +1712387,NINH THI HAI YEN,1985-06-18,"Huyen Yen Thuy, Hoa Binh" +1712388,TA THI THU YEN,1990-07-12,"Huyen Bach Thong, Bac Kan" +1712389,NGUYEN HA LINH HUE,1987-10-16,"Huyen Kim Boi, Hoa Binh" +1712390,NGUYEN HONG HANH,1985-01-12,"Huyen Dong Hy, Thai Nguyen" diff --git a/Bak/student_course.csv b/Bak/student_course.csv index e3e7623..73d7507 100644 --- a/Bak/student_course.csv +++ b/Bak/student_course.csv @@ -1,33 +1,40 @@ -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 +1712351;a1,a4,c1,b1,b4,d1;1.5,-1,3,8.5,-1,9;13 +1712352;a1,a4,c1,b1,b4,d1;1.5,-1,1.5,3.5,-1,4.5;13 +1712353;a1,a4,c1,b1,b4,d1;5.5,-1,7,0.5,-1,0;13 +1712354;a1,a4,c1,b1,b4,d1;8.5,-1,0,1.5,-1,3.5;13 +1712355;a1,a4,c1,b1,b4,d1;6.5,-1,8.5,0.5,-1,9;13 +1712356;a1,a4,c1,b1,b4,d1;8,-1,6,6.5,-1,5.5;13 +1712357;a1,a4,c1,b1,b4,d1;8,-1,1.5,3.5,-1,2;13 +1712358;a1,a4,c1,b1,b4,d1;0,-1,0.5,4.5,-1,3.5;13 +1712359;a1,a4,c1,b1,b4,d1;7.5,-1,7,4.5,-1,1.5;13 +1712360;a1,a4,c1,b1,b4,d1;6.5,-1,4.5,8.5,-1,9;13 +1712361;a1,a5,c1,b1,b5,d1;4,-1,7.5,7,-1,2;13 +1712362;a1,a5,c1,b1,b5,d1;1,-1,4.5,10,-1,1.5;13 +1712363;a1,a5,c1,b1,b5,d1;3,-1,10,9,-1,3;13 +1712364;a1,a5,c1,b1,b5,d1;1.5,-1,4.5,1.5,-1,8.5;13 +1712365;a1,a5,c1,b2,b5,d1;2,-1,2,2.5,-1,2.5;13 +1712366;a2,a5,c2,b2,b5,d2;6,-1,9.5,5,-1,2.5;13 +1712367;a2,a5,c2,b2,b5,d2;5,-1,5,5,-1,7;13 +1712368;a2,a5,c2,b2,b5,d2;6.5,-1,7.5,8.5,-1,4;13 +1712369;a2,a5,c2,b2,b5,d2;6,-1,3.5,5,-1,10;13 +1712370;a2,a5,c2,b2,b5,d2;4,-1,1.5,6,-1,5.5;13 +1712371;a2,c3,c2,b2,d3,d2;9,2.5,2.5,0.5,6.5,3;13 +1712372;a2,c3,c2,b2,d3,d2;8,2.5,6,9,1.5,0;13 +1712373;a2,c3,c2,b2,d3,d2;1,1,6.5,4.5,6.5,5;13 +1712374;a2,c3,c2,b2,d3,d2;0.5,7,5,2,3,8.5;13 +1712375;a2,c3,c2,b2,d3,d2;1,1,4,3.5,2,9.5;13 +1712376;a2,c3,c2,b2,d3,d2;1.5,5.5,9.5,0,10,4;13 +1712377;a2,c3,c2,b2,d3,d2;8,9,1.5,4,5.5,9;13 +1712378;a2,c3,c2,b2,d3,d2;5,9.5,0.5,8.5,6,2.5;13 +1712379;a2,c3,c2,b3,d3,d2;6,7.5,5,4.5,9,4;13 +1712380;a2,c3,c2,b3,d3,d2;0,1.5,10,0.5,7.5,5.5;13 +1712381;a3,c4,c5,b3,d4,d5;3,7.5,-1,8,8,3.5;13 +1712382;a3,c4,c5,b3,d4,d5;0.5,9,-1,6.5,6.5,1.5;13 +1712383;a3,c4,c5,b3,d4,d5;9.5,8.5,-1,6.5,2,7.5;13 +1712384;a3,c4,c5,b3,d4,d5;7.5,9,-1,10,5,6;13 +1712385;a3,c4,c5,b3,d4,d5;2,9.5,-1,2,0.5,2;13 +1712386;a3,c4,c5,b3,d4,d5;8.5,2.5,-1,7,4,6.5;13 +1712387;a3,c4,c5,b3,d4,d5;10,3,-1,5,6,6;13 +1712388;a3,c4,c5,b3,d4,d5;4.5,2,-1,8,4.5,2;13 +1712389;a3,c4,c5,b3,d4,d5;3.5,9.5,-1,0.5,8,5;13 +1712390;a3,c4,c5,b3,d4,d5;4,9.5,-1,4,8,8;13 diff --git a/Bak/teacher.csv b/Bak/teacher.csv index 9158d77..e3d718e 100644 --- a/Bak/teacher.csv +++ b/Bak/teacher.csv @@ -6,45 +6,3 @@ 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/Bak/user.csv b/Bak/user.csv index 28c16c4..a65a7b4 100644 --- a/Bak/user.csv +++ b/Bak/user.csv @@ -1,17 +1,34 @@ -1712350,123456,student +admin,a,admin +S0951,S0951,teacher +S0952,S0952,teacher +S0953,S0953,teacher +S0954,S0954,teacher +S0955,S0955,teacher +S0956,S0956,teacher +S0957,S0957,teacher +S0958,S0958,teacher 1712351,1712351,student 1712352,1712352,student 1712353,1712353,student 1712354,1712354,student -1712355,abc123,student +1712355,1712355,student 1712356,1712356,student 1712357,1712357,student 1712358,1712358,student 1712359,1712359,student 1712360,1712360,student 1712361,1712361,student +1712362,1712362,student +1712363,1712363,student +1712364,1712364,student +1712365,1712365,student +1712366,1712366,student +1712367,1712367,student +1712368,1712368,student +1712369,1712369,student +1712370,1712370,student 1712371,1712371,student -1712372,haidang,student +1712372,1712372,student 1712373,1712373,student 1712374,1712374,student 1712375,1712375,student @@ -19,63 +36,14 @@ 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 +1712380,1712380,student +1712381,1712381,student +1712382,1712382,student +1712383,1712383,student +1712384,1712384,student +1712385,1712385,student +1712386,1712386,student +1712387,1712387,student +1712388,1712388,student +1712389,1712389,student +1712390,1712390,student diff --git a/Course.cpp b/Course.cpp index aebef2a..a6649fc 100644 --- a/Course.cpp +++ b/Course.cpp @@ -33,7 +33,14 @@ inline bool operator!=(string &lhs, Course &rhs) { bool CourseList::addToCourseList(Course newCourse){ newCourse.total_st = 0; - if (this->isCourseExist(newCourse.course_id) == true) + /*if (this->isCourseExist(newCourse.course_id) == true) + return false; + else{ + this->addToList(newCourse); + return true; + }*/ + Course dummy; + if (this->isCourseExist(newCourse.course_id, dummy) == true) return false; else{ this->addToList(newCourse); @@ -44,21 +51,23 @@ bool CourseList::addToCourseList(Course newCourse){ void Course::printCourseInfo(){ - cout << setfill('-') << setw(50) << "-" << "Course" << setfill('-') << setw(50) << "-" << setfill(' ') << endl; + cout << setfill('-') << setw(50) << "-" << "New Course" << setfill('-') << setw(55) << "-" << setfill(' ') << endl; cout - << left << setw(10) << "Course Id" + << left << setw(20) << "Course Id" + << left << setw(10) << "Fal ID" << left << setw(25) << "Falcuty" - << left << setw(15) << "Subject Id" - << left << setw(25) << "Subject Name" + << left << setw(15) << "Sub_Id" + << left << setw(35) << "Subject Name" << left << setw(6) << "Credit" << endl; cout << setfill('-') << setw(110) << "-" << setfill(' ') << endl; cout - << left << setw(10) << this->course_id + << left << setw(20) << this->course_id + << left << setw(10) <fal_id << left << setw(25) << this->falcuty << left << setw(15) << this->sub_id - << left << setw(25) << this->sub_name + << left << setw(35) << this->sub_name << left << setw(6) << this->credit << endl; @@ -141,7 +150,7 @@ void CourseList::printCourse() { cout << left << setw(5) << "STT" << left << setw(10) << "Course Id" << left << setw(25) << "Falcuty" - << left << setw(15) << "Subject Id" + << left << setw(15) << "Sub_id" << left << setw(25) << "Subject Name" << left << setw(15) << "Student/Slot" << left << setw(6) << "Credit" << endl; @@ -187,11 +196,45 @@ CourseList* CourseList::findAllCourseByFalcuty(arrayList fal_list) { } return cList; } -bool CourseList::isCourseExist(string id) { + +CourseList* CourseList::findCourseByFacutyId(string fal_id) { + CourseList* cList = new CourseList(); + for (size_t i = 0; i < size; i++) { + string s = this->list[i].fal_id; + toUpperCase(s); + toUpperCase(fal_id); + if (s.find(fal_id) != string::npos) { + cList->addToList(list[i]); + } + } + return cList; +} +CourseList* CourseList::findAllCourseByFalcutyId(arrayList falid_list) { + CourseList* cList = new CourseList(); + for (size_t i = 0; i < this->size; i++) { + string s = this->list[i].fal_id; + for (size_t j = 0; j < falid_list.size; j++) { + string s1 = falid_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&out_data) { Course* tmp = new Course(); - tmp = findCourseById(id); + tmp = findCourseById(id); if (tmp == NULL) { return false; } - else return true; + else + { + out_data = *tmp; + return true; + } } \ No newline at end of file diff --git a/Course.h b/Course.h index 0f4ec61..212ca36 100644 --- a/Course.h +++ b/Course.h @@ -5,11 +5,10 @@ #include "Helper.h" using namespace std; -string toUpperCase(string&input); - struct Course{ string course_id; string sub_id; + string fal_id; string falcuty; string sub_name; int total_st; @@ -17,10 +16,11 @@ struct Course{ int credit; Course() {}; - Course(string sub_id, string sub_name, string falcuty) { + Course(string sub_id, string sub_name, string falcuty, string fal_id) { this->sub_id = sub_id; this->sub_name = sub_name; this->falcuty = falcuty; + this->fal_id = fal_id; }; ~Course() {}; @@ -29,10 +29,11 @@ struct Course{ this->max_st++; } } - void CreateNewCourse(string sub_id, string sub_name, string falcuty, int total_st, int max_st, int credit){ + void CreateNewCourse(string sub_id, string sub_name, string falcuty, string fal_id, int total_st, int max_st, int credit){ this->sub_id = sub_id; this->sub_name = sub_name; this->falcuty = falcuty; + this->fal_id = fal_id; this->total_st = total_st; this->max_st = max_st; this->credit = credit; @@ -52,7 +53,9 @@ public: CourseList* findAllCourseByName(arrayList name_list); CourseList* findCourseByFacuty(string fal); CourseList* findAllCourseByFalcuty(arrayList fal_list); - bool isCourseExist(string id); + CourseList* findCourseByFacutyId(string fal_id); + CourseList* findAllCourseByFalcutyId(arrayList falid_list); + bool isCourseExist(string,Course&); bool addToCourseList(Course newCourse); // add a opened course to courseList ( course.csv ) void addStudentToCourse(string course_id); void removeStudentToCourse(string course_id); diff --git a/DBHelper.cpp b/DBHelper.cpp index 57c398d..4d352e5 100644 --- a/DBHelper.cpp +++ b/DBHelper.cpp @@ -46,6 +46,9 @@ bool loadCourse(CourseList &courseList) { getline(ss, str, ','); data.course_id = str; + getline(ss, str, ','); + data.fal_id = str; + getline(ss, str, ','); data.falcuty = str; @@ -98,7 +101,7 @@ bool loadStudentCourse(StudentCourseList &st_course_list) { sstr2.str(str2); while (getline(sstr2, str2, ',')) { - int num; + double num; istringstream(str2) >> num; data.st_point.addToList(num); } @@ -144,8 +147,7 @@ bool loadStudentInfo(StudentList &st_list) { return true; } } - -bool loadTeacherInfo(TeacherList& tc_list) { +bool loadTeacherInfo(TeacherList& tc_list){ ifstream file; file.open("teacher.csv", ios::in); if (file.is_open() == NULL) { @@ -180,12 +182,12 @@ bool loadTeacherInfo(TeacherList& tc_list) { return true; } } - void writeToCouresFile(CourseList &courseList) { ofstream file; - file.open("course.csv", ios::trunc); + file.open("course.csv", ios::out); for (size_t i = 0; i& operator=(arrayList &r) { if (this == &r)return *this; this->arrayCapacity = r.arrayCapacity; @@ -86,11 +93,15 @@ 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 (index == this->size - 1) { + size--; + } + else if (index != -1) { + memmove(this->list + index, this->list + index + 1, sizeof(T)*size); + size--; + } if (arrayCapacity - size > 100) { modifyListSize(); } } - -#endif // _HELPER_ +#endif // _HELPER_ \ No newline at end of file diff --git a/Process.cpp b/Process.cpp index 00971ef..37aaaa5 100644 --- a/Process.cpp +++ b/Process.cpp @@ -1,20 +1,24 @@ -#include "Process.h" +#include "process.h" #include "Student.h" #include "Teacher.h" #include "DBHelper.h" -#include "Admin.h" #include #include #include +#include using namespace std; +CourseList* ctemp = new CourseList(); +CourseList* ttemp = new CourseList(); 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 << "\t\t\t\t" << "|++++++++++++++++++++++++++++++++++++|\n\n"; + cout << "\t\t\t\t" << "| Welcome to student manager site |\n\n"; + cout << "\t\t\t\t" << "|++++++++++++++++++++++++++++++++++++|\n\n\n"; + cout << "Username (Type q to exit): "; cin >> random_user.username; cout << "Password (Type q to exit): "; @@ -48,12 +52,21 @@ bool startProgram(User& random_user, UserList user_list) { } } } -bool studentMenu(Student& st, StudentCourseList db_st_course_list, CourseList db_course_list, UserList user_list) { +bool studentMenu(Student& st, StudentCourseList&db_st_course_list, CourseList&db_course_list, UserList&user_list) { while (st.isLogin() == true) { + cout << "\t\t\t\t" << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; + cout << "\t\t\t\t" << "|\t\tSTUDENT SITE\t\t | \n"; + cout << "\t\t\t\t" << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n"; + 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): "; + cout << setw(40) << setfill(' ') << left << "1. Change password" << "[cp]" << endl; + cout << setw(40) << setfill(' ') << left << "2. View my courses" << "[vc]" << endl; + cout << setw(40) << setfill(' ') << left << "3. Search courses" << "[sc] [-n,-f]" << endl; + cout << setw(40) << setfill(' ') << left << "4. Join course" << "[jc]" << endl; + cout << setw(40) << setfill(' ') << left << "5. Cancel course" << "[xc]" << endl; + cout << setw(40) << setfill(' ') << left << "6. Log out" << "[lo]" << endl; + cout << setw(40) << setfill(' ') << left << "7. Help" << "[h]" << endl; + cout << "\nYour command (press [e] to quit program): "; string command; stringstream ss; string agv; @@ -63,13 +76,14 @@ bool studentMenu(Student& st, StudentCourseList db_st_course_list, CourseList db do{ ss >> agv; if (ss.fail() || agv == "") { + system("cls"); 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) { - + system("cls"); } else { cout << "Error: command not found" << endl; @@ -78,18 +92,19 @@ bool studentMenu(Student& st, StudentCourseList db_st_course_list, CourseList db 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): "; + cout << "\t\t\t\t" << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"; + cout << "\t\t\t\t" << "|\t\tTEACHER SITE\t\t | \n"; + cout << "\t\t\t\t" << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n"; + cout << "Lecturer: " << tc.tc_name << "[" << tc.tc_identify << "]\n"; + cout << setfill('=') << setw(100) << "=" << endl; + cout << setw(40) << setfill(' ') << left << "1. Change password" << "[cp (new password)]" << endl; + cout << setw(40) << setfill(' ') << left << "2. View my opened courses" << "[vc]" << endl; + cout << setw(40) << setfill(' ') << left << "3. Open a course" << "[oc]" << endl; + cout << setw(40) << setfill(' ') << left << "4. Grading student's course" << "[gc]" << endl; + cout << setw(40) << setfill(' ') << left << "5. Log out" << "[lo]" << endl; + cout << setw(40) << setfill(' ') << left << "6. Help" << "[h]" << endl; + cout << "\nYour command (press [e] to quit program): "; string command; stringstream ss; string agv; @@ -99,46 +114,32 @@ bool teacherMenu(Teacher& tc, StudentCourseList& db_st_course_list, CourseList& do{ ss >> agv; if (ss.fail() || agv == "") { + system("cls"); 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) { - + system("cls"); } else { - cout << "Error: command not found" << endl; + cout << "\nError: command not found\n" << 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) { +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; - } + return cp(st, agvList, user_list); } else if (agvList.list[0] == "vc") { system("cls"); studentCourse enrolledCourse; - st.getStudentCourse(db_st_course_list, enrolledCourse); + st.getStudentCourse(db_st_course_list, enrolledCourse, &db_course_list); st.showStudentCourse(&db_course_list, enrolledCourse); + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } else if (agvList.list[0] == "sc") { @@ -152,6 +153,7 @@ bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_cou } else { system("cls"); + ctemp = cList; cList->printCourse(); } } @@ -165,9 +167,12 @@ bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_cou } else { system("cls"); + ctemp = cList; cList->printCourse(); } } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } else if (agvList.list[1] == "-f") { @@ -175,21 +180,30 @@ bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_cou agvList.removeFromList(0); agvList.removeFromList(0); CourseList* cList = db_course_list.findAllCourseByFalcuty(agvList); + ttemp = cList; 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); + ttemp = cList; cList->printCourse(); + + } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } } else if (agvList.list[0] == "jc") { studentCourse enrolledCourse; - st.getStudentCourse(db_st_course_list, enrolledCourse); + if (st.getStudentCourse(db_st_course_list, enrolledCourse, &db_course_list) == false) { + enrolledCourse.st_num = st.st_number; + } if (agvList.size > 1) { agvList.removeFromList(0); if (st.joinCourse(enrolledCourse, agvList, db_st_course_list, db_course_list) == false) { @@ -198,14 +212,34 @@ bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_cou 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; + if (agvList.isEmpty() == true) { + cout << "Your have successfully joined the courses." << endl; + } + else { + cout << "Error: Failed to join in "; + for (size_t i = 0; i < agvList.size; i++) { + cout << "'" << agvList.list[i] << "'"; + } + cout << endl; + } } } else if (agvList.size == 1) { + + if (ctemp->size!=0){ + cout << "Search history: \n"; + ctemp->printCourse(); + } + else if (ttemp->size!=0){ + cout << "Search history: \n"; + ttemp->printCourse(); + } + else{ + db_course_list.printCourse(); + } string courseId; arrayList join_course; cout << "Course to join: "; @@ -215,28 +249,55 @@ bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_cou 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 << "'" << join_course.list[i] << "'"; } - cout << ". You has already joined the course or it is not opened." << endl; + cout << endl; } else { - cout << "Your have successfully joined the courses." << endl; + if (join_course.isEmpty() == true) { + cout << "Your have successfully joined the courses." << endl; + } + else { + cout << "Error: Failed to join in "; + for (size_t i = 0; i < join_course.size; i++) { + cout << "'" << join_course.list[i] << "'"; + } + cout << endl; + } } } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } else if (agvList.list[0] == "xc") { studentCourse enrolledCourse; - st.getStudentCourse(db_st_course_list, enrolledCourse); + studentCourse tmp_enrolledCourse; + st.getStudentCourse(db_st_course_list, enrolledCourse, &db_course_list); + tmp_enrolledCourse = enrolledCourse; + st.showStudentCourse(&db_course_list, enrolledCourse); + cout << setfill('_') << setw(120) << "_" << endl; + cout << setfill(' ');//reset + if (agvList.size > 1) { agvList.removeFromList(0); for (size_t i = 0; i < agvList.size; i++) { - if (enrolledCourse.hasEnrolled(agvList.list[i]) == false) { + if (tmp_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; + int index = 0; + tmp_enrolledCourse.st_course.isExist(agvList.list[i], index); + + if (tmp_enrolledCourse.st_point.list[index] != -1) { + cout << "You are graded in \"" << agvList.list[i] << "\" so you can not cancel it." << endl; + } + else { + cout << "You have canceled join " << agvList.list[i] << endl; + tmp_enrolledCourse.st_course.removeFromList(index); + tmp_enrolledCourse.st_point.removeFromList(index); + } } } st.cancelCourse(enrolledCourse, agvList, db_st_course_list, db_course_list); @@ -248,17 +309,24 @@ bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_cou cin >> courseId; cin.ignore(INT_MAX, '\n'); cancel_course.addToList(courseId); - for (size_t i = 0; i < agvList.size; i++) { + for (size_t i = 0; i < cancel_course.size; i++) { if (enrolledCourse.hasEnrolled(cancel_course.list[i]) == false) { - cout << "Error: You have not joined " << agvList.list[i] << endl; + cout << "Error: You have not joined " << cancel_course.list[i] << endl; cout << endl; } else { - cout << "You have canceled join " << agvList.list[i] << endl; + int index = 0; + enrolledCourse.st_course.isExist(cancel_course.list[i], index); + if (enrolledCourse.st_point.list[index] != -1) { + cout << "You are graded in \"" << cancel_course.list[i] << "\" so you can not cancel it." << endl; + } + else cout << "You have canceled join " << cancel_course.list[i] << endl; } } st.cancelCourse(enrolledCourse, cancel_course, db_st_course_list, db_course_list); } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } else if (agvList.list[0] == "lo") { @@ -278,9 +346,8 @@ bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_cou 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"); + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } } @@ -288,97 +355,20 @@ bool studentProcess(Student&st, UserList& user_list, StudentCourseList&db_st_cou } bool teacherProcess(Teacher& tc, UserList& user_list, StudentCourseList& db_st_course_list, CourseList& db_course_list, arrayList agvList) { -#pragma region ChangePass + //Change Pass 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; + return cp(tc, agvList, user_list); } -#pragma endregion - -#pragma region OpenCourse + + // View course + else if (agvList.list[0] == "vc"){ + return tc.viewCourse(tc, db_st_course_list, db_course_list); + } + + //Open new course 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 + return tc.openNewCourse(tc, db_st_course_list, db_course_list); + } #pragma region Grading @@ -386,58 +376,53 @@ bool teacherProcess(Teacher& tc, UserList& user_list, StudentCourseList& db_st_c 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); + + tc.showTeacherCouser(*tc_open_course,db_st_course_list); if (tc_open_course->size == 0){ - cout << "Try opening a course in main menu ! \n"; + cout << "Try opening a course in main menu.\n"; + cout << "PRESS ENTER TO GO BACK"; + cin.get(); return true; } - int option; - cout << "\n\nChose course to grade or press 0 to exit: "; - cin >> option; - cin.ignore(INT_MAX, '\n'); + float option; + do{ + cout << "\nChose course to grade or press 0 to exit: "; + cin >> option; + cin.clear(); + cin.ignore(INT_MAX, '\n'); + if (option<0 || option>tc_open_course->size || cin.bad() || option != (int)option){ + cout << "Wrong input, try again!\n"; + continue; + } + } while (option<0 || option>tc_open_course->size || cin.bad() || option != (int)option); + if (option == 0){ return true; } else if (option != 0){ + int flag = 1; 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; + if (data->size == 0){ + cout << "There are no students applied to this course, try again later!\n"; + flag = 0; + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); + + return true; + } - 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; + if (flag == 1){ + tc.gradingCourse(*data); + db_st_course_list.updatePoint(*data); + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); + return true; } } } - return true; + } } //end else if @@ -459,9 +444,9 @@ bool teacherProcess(Teacher& tc, UserList& user_list, StudentCourseList& db_st_c 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 your opened course" << setw(10) << left << "vc" << setw(10) << left << "none" << 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(40) << left << "Grading a course" << setw(10) << left << "gc" << setw(10) <> agv; if (ss.fail() || agv == "") { + system("cls"); 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, db_course_list, db_st_course_list, agvList) == true) { - + system("cls"); } else { cout << "Error: command not found" << endl; @@ -515,44 +502,35 @@ bool adminMenu(Admin& ad, StudentList& db_st_list, TeacherList& db_tc_list, User } bool adminProcess(Admin& ad, UserList& user_list, StudentList& db_st_list, TeacherList& db_tc_list, CourseList &db_course_list, StudentCourseList &db_st_course_list, arrayList agvList) { + //Doi mat khau 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; - } + return cp(ad, agvList, user_list); } - else if (agvList.list[0] == "as") - { - if (ad.addStudent(db_st_list, user_list)) { - cout << "Add Student successful!" << endl; + //Them student + else if (agvList.list[0] == "as") { + if (ad.addStudent(db_st_list, user_list) == 1) { + cout << "Add Student \"" << user_list.list[user_list.size - 1].username << "\" successful!" << endl; } else { cout << "Add Student unsuccessful!\nMay be error in your input or the same username have exist." << endl; } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } - else if (agvList.list[0] == "at") - { - if (ad.addTeacher(db_tc_list, user_list)) { - cout << "Add Teacher successful!" << endl; + //Them teacher + else if (agvList.list[0] == "at") { + if (ad.addTeacher(db_tc_list, user_list) == 1) { + cout << "Add Teacher \"" << user_list.list[user_list.size - 1].username << "\" successful!" << endl; } else { - cout << "Add Teacher unsuccessful! May be the same username have exist." << endl; + cout << "Add Teacher unsuccessful!\nMay be error in your input or the same username have exist." << endl; } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } + //Tim kiem student else if (agvList.list[0] == "ss") { if (agvList.size > 1) { agvList.removeFromList(0); @@ -595,8 +573,11 @@ bool adminProcess(Admin& ad, UserList& user_list, StudentList& db_st_list, Teach sList.print(); } } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } + //Tim kiem teacher else if (agvList.list[0] == "st") { if (agvList.size > 1) { agvList.removeFromList(0); @@ -639,11 +620,14 @@ bool adminProcess(Admin& ad, UserList& user_list, StudentList& db_st_list, Teach tList.print(); } } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } + //Xoa user else if (agvList.list[0] == "ru") { if (agvList.size == 1) { - cout << "Input list of usernames to remove:" << endl; + cout << "Input list of usernames you want to remove (separate by space):" << endl; string input; stringstream ss; string username; @@ -667,41 +651,45 @@ bool adminProcess(Admin& ad, UserList& user_list, StudentList& db_st_list, Teach } } if (remove_unsuccess.size == 0) { - cout << "Remove all user successful!" << endl; + cout << "Remove all user you in your list successful!" << endl; } else { - cout << "Some user remove unsuccessful! That is:" << endl; + cout << "Some user in your list remove unsuccessful! List:" << endl; for (size_t j = 0; j < remove_unsuccess.size; j++) { cout << j + 1 << ".\t" << remove_unsuccess.list[j] << endl; } - cout << "Other user remove successful!" << endl; + cout << "Other user in your list remove successful!" << endl; } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } - else - { + else { arrayList remove_unsuccess; for (size_t i = 1; i < agvList.size; i++) { if (ad.removeUser(agvList.list[i], user_list, db_st_list, db_tc_list, db_course_list, db_st_course_list) == 1) { - + } else { remove_unsuccess.addToList(agvList.list[i]); } } if (remove_unsuccess.size == 0) { - cout << "Remove all user successful!" << endl; + cout << "Remove all user in your list successful!" << endl; } else { - cout << "Some user remove unsuccessful! That is:" << endl; + cout << "Some user in your list remove unsuccessful! List:" << endl; for (size_t j = 0; j < remove_unsuccess.size; j++) { cout << j + 1 << ".\t" << remove_unsuccess.list[j] << endl; } - cout << "Other user remove successful!" << endl; + cout << "Other user in your list remove successful!" << endl; } + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } } + //In help else if (agvList.list[0] == "h") { if (agvList.size == 1) { system("cls"); @@ -726,32 +714,26 @@ bool adminProcess(Admin& ad, UserList& user_list, StudentList& db_st_list, Teach 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"); + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } } + //In danh sach teacher 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'); + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } + //In danh sach student 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'); + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); return true; } + //Dang xuat else if (agvList.list[0] == "lo") { ad.logout(); system("cls"); @@ -759,5 +741,4 @@ bool adminProcess(Admin& ad, UserList& user_list, StudentList& db_st_list, Teach } return false; } - #pragma endregion \ No newline at end of file diff --git a/Process.h b/Process.h index c22a6a4..eddb839 100644 --- a/Process.h +++ b/Process.h @@ -9,10 +9,9 @@ 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 studentMenu(Student& st, StudentCourseList&db_st_course_list, CourseList&db_course_list, UserList&Suser_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, CourseList &db_course_list, StudentCourseList &db_st_course_list); bool adminProcess(Admin& ad, UserList& user_list, StudentList& db_st_list, TeacherList& db_tc_list, CourseList &db_course_list, StudentCourseList &db_st_course_list, arrayList agvList); -#endif // !_PROCESS_H_ - +#endif // !_PROCESS_H_ \ No newline at end of file diff --git a/Student.cpp b/Student.cpp index 2df9361..25a2ee3 100644 --- a/Student.cpp +++ b/Student.cpp @@ -1,18 +1,52 @@ #include "Student.h" using namespace std; -bool Student::getStudentCourse(StudentCourseList db_st_course_list, studentCourse& enrolledCourse) { +void Student::getSemesterCredit(studentCourse& enrolledCourse, CourseList* db_courseList) { + arrayList current_course_id; + arrayList done_course_id; + for (size_t i = 0; i < enrolledCourse.st_course.size; i++) { + if (enrolledCourse.st_point.list[i] == -1) { + current_course_id.addToList(enrolledCourse.st_course.list[i]); + } + else { + done_course_id.addToList(enrolledCourse.st_course.list[i]); + } + } + CourseList* st_course_detail = db_courseList->findAllCourseById(current_course_id); + CourseList* _st_course_detail = db_courseList->findAllCourseById(done_course_id); + int credit = 0; + int _credit = 0; + double sum = 0;// for gpa's calulation + for (size_t i = 0; i < st_course_detail->size; i++) { + credit += st_course_detail->list[i].credit; + } + enrolledCourse.curr_credit = credit; + + for (size_t i = 0; i < _st_course_detail->size; i++) { + int index; + enrolledCourse.st_course.isExist(_st_course_detail->list[i].course_id, index); + _credit += _st_course_detail->list[i].credit; + sum += _st_course_detail->list[i].credit*enrolledCourse.st_point.list[index]; + } + enrolledCourse.done_credit = _credit; + enrolledCourse.setGPA(sum / _credit); +} + +bool Student::getStudentCourse(StudentCourseList db_st_course_list, studentCourse& enrolledCourse, CourseList* db_courseList) { 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]; + getSemesterCredit(enrolledCourse, db_courseList); return true; } - } + } return false; } bool Student::modifyBaseStudentCourse(StudentCourseList& db_st_course_list, studentCourse enrolledCourse) { + bool edit = false; for (size_t i = 0; i < db_st_course_list.size; i++) { if (db_st_course_list.list[i].st_num == this->st_number) { + edit = true; if (enrolledCourse.isExist()){ db_st_course_list.list[i] = enrolledCourse; } @@ -20,6 +54,11 @@ bool Student::modifyBaseStudentCourse(StudentCourseList& db_st_course_list, stud return true; } } + if (edit == false) { + if (enrolledCourse.isExist()) { + db_st_course_list.addToList(enrolledCourse); + } + } return false; } void Student::showStudentCourse(CourseList* db_courseList, studentCourse enrolledCourse) { @@ -35,16 +74,19 @@ void Student::showStudentCourse(CourseList* db_courseList, studentCourse enrolle << left << setw(10) << "Tin chi" << endl; cout << setfill('-') << setw(50) << setfill(' ') << endl; for (size_t i = 0; i < enrolledCourse.st_course.size; i++) { + int index = 0; + enrolledCourse.st_course.isExist(st_course_detail->list[i].course_id, index); 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) << enrolledCourse.st_point.list[index] << left << setw(10) << st_course_detail->list[i].credit << endl; } cout << endl; - cout << "Your GPA: " << enrolledCourse.getGPA() << endl; + enrolledCourse.getGPA(); + cout << "Your GPA: " << setprecision(3) << enrolledCourse.getGPA() << endl; } else cout << "You haven't enroll in any course" << endl; }; @@ -52,23 +94,37 @@ bool Student::joinCourse(studentCourse enrolledCourse, arrayList&courseI 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])) { + Course* course_detail = db_course_list.findCourseById(courseId.list[i]); + if (db_course_list.isCourseExist(courseId.list[i], *course_detail)) { + if (enrolledCourse.addCourse(courseId.list[i], course_detail->credit)) { db_course_list.addStudentToCourse(courseId.list[i]); - courseId.removeFromList(i); } + else { + error_course.addToList(courseId.list[i]); + } + } + else { + error_course.addToList(courseId.list[i]); } } modifyBaseStudentCourse(db_st_course_list, enrolledCourse); + courseId = error_course; 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]); + for (size_t i = 0; i < courseId.size; i++) { + if (enrolledCourse.hasEnrolled(courseId.list[i]) == true) { + int index = 0; + enrolledCourse.st_course.isExist(courseId.list[i], index); + if (enrolledCourse.st_point.list[index] == -1) { + enrolledCourse.st_course.removeFromList_(courseId.list[i]); + enrolledCourse.st_point.removeFromList(index); + db_course_list.removeStudentToCourse(courseId.list[i]); + } + } } modifyBaseStudentCourse(db_st_course_list, enrolledCourse); return true; @@ -104,7 +160,7 @@ inline bool operator!=(int &lhs, Student &rhs) { } inline bool operator==(studentCourse &lhs, studentCourse&rhs) { - return lhs.st_num = rhs.st_num; + return lhs.st_num == rhs.st_num; } //-----------------STUDENT_LIST------------------------ StudentList StudentList::findStudentByNameKeyWord(string keyword[], size_t n) { @@ -162,7 +218,6 @@ StudentCourseList* StudentCourseList::findStudentJoinCourse(string courseID){ 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]; @@ -174,18 +229,16 @@ StudentCourseList* StudentCourseList::findStudentJoinCourse(string courseID){ 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++){ +void StudentCourseList::updatePoint( StudentCourseList st_join_course){ 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++; - } + for (size_t j = 0; j < this->size; j++){ + for (size_t 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. diff --git a/Student.h b/Student.h index fdf2bd2..374026a 100644 --- a/Student.h +++ b/Student.h @@ -13,12 +13,16 @@ private: double gpa; public: int st_num; + int curr_credit; + int done_credit;// so tin cac mon da hoc arrayList st_course; - arrayList st_point; + arrayList st_point; studentCourse() { this->st_num = 0; this->gpa = 13.0; + this->curr_credit = 0; + this->done_credit = 0; } bool isExist() { if (st_course.size == 0) { @@ -35,17 +39,18 @@ public: } return false; } - bool addCourse(string courseId) { - if (hasEnrolled(courseId) == false) { + bool addCourse(string courseId, int credit) { + if (hasEnrolled(courseId) == false && curr_credit + credit <= 20) { this->st_course.addToList(courseId); this->st_point.addToList(-1); + curr_credit += credit; return true; } return false; } double getGPA() { return this->gpa; } - bool setGPA(User &user, double newGPA) { - if (user.role == "teacher") { + bool setGPA(double newGPA) { + if (done_credit > 0) { this->gpa = newGPA; return true; } @@ -60,6 +65,8 @@ public: this->st_num = data.st_num; this->st_course = data.st_course; this->st_point = data.st_point; + this->curr_credit = data.curr_credit; + this->done_credit = data.done_credit; this->gpa = data.getGPA(); return *this; } @@ -69,9 +76,9 @@ 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 + void updatePoint(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++) { @@ -95,12 +102,12 @@ public: }; Student() {} ~Student() {}; - bool getStudentCourse(StudentCourseList db_st_course_list, studentCourse& enrolledCourse); + bool getStudentCourse(StudentCourseList db_st_course_list, studentCourse& enrolledCourse, CourseList* db_courseList); 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); - + void getSemesterCredit(studentCourse& enrolledCourse, CourseList* db_courseList); CourseList* searchForCourseByName(arrayList cList, CourseList db_course_list); Student& operator=(User u) { @@ -116,12 +123,11 @@ class StudentList : public arrayList{ public: StudentList() {}; ~StudentList() {}; + void print(); 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/Teacher.cpp b/Teacher.cpp index e50d293..6abaee7 100644 --- a/Teacher.cpp +++ b/Teacher.cpp @@ -4,77 +4,317 @@ using namespace std; CourseList* Teacher::teacherCourse(CourseList db_course_list){ - return db_course_list.findCourseByFacuty(this->tc_name); + return db_course_list.findCourseByFacutyId(this->tc_identify); +} +CourseList* Teacher::tcSumCourse(CourseList db_course_list,StudentCourseList db_st_course_list){ + CourseList* tc_sumed = new CourseList(); + CourseList* tc = teacherCourse(db_course_list); + StudentCourseList* data = new StudentCourseList(); + int i = 0; + for (i; i < tc->size; i++){ + data = db_st_course_list.findStudentJoinCourse(tc->list[i].course_id); + if (data->isGrade()){ + tc_sumed->addToList(tc->list[i]); + } + } + return tc_sumed; +} +CourseList* Teacher::tcNotSumCourse(CourseList db_course_list, StudentCourseList db_st_course_list){ + CourseList* tc_nsumed = new CourseList(); + CourseList* tc = teacherCourse(db_course_list); + StudentCourseList* data = new StudentCourseList(); + int i = 0; + for (i; i < tc->size; i++){ + data = db_st_course_list.findStudentJoinCourse(tc->list[i].course_id); + if (!(data->isGrade())){ + tc_nsumed->addToList(tc->list[i]); + } + } + return tc_nsumed; } - - bool Teacher::gradingCourse(StudentCourseList& st_join_course){ + + + int flag = 0; + cout << endl; + cout << setw(40) << right << "\nStudent List:\n" << endl; + cout << setw(5) << left << "STT"; + cout << setw(30) << left << "MSSV"; + cout << setw(20) << right << "Point\n"; + cout << setfill('-'); + cout << setw(55) << "-" << endl; + cout << setfill(' '); + for (size_t j = 0; j < st_join_course.size; j++){ + cout << setw(5) << left << j + 1; + cout << setw(30) << left << st_join_course.list[j].st_num; + cout << setw(20) << right << st_join_course.list[j].st_point.list[0] << endl; + } + if (st_join_course.isGrade()){ int index; - do{ + int a = 0; + do{ double spoint; + cout << "Input student's index to modify grade (press 0) to exit: "; cin >> index; + cin.clear(); 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; + + if (index<0 || index>st_join_course.size || cin.bad() || index != (int)index){ + cout << "Wrong input, try again!\n"; + continue; + } + if (index == 0){ + flag++; + break; + } + do{ + cout << "Input new grade for " << st_join_course.list[index - 1].st_num << " : "; + cin >> spoint; + cin.clear(); + cin.ignore(INT_MAX, '\n'); + if (spoint<-1 || spoint == 11 || spoint == 12 || spoint>13 || cin.bad()){ + cout << "Wrong input, try again!\n"; + continue; + } + st_join_course.list[index - 1].st_point.list[0] = spoint; + flag++; + } while (spoint<-1 || spoint == 11 || spoint == 12 || spoint>13 || cin.bad()); } while (index != 0||cin.bad()); } + else{ - cout << "Tong ket diem: \n"; + cout << "Sumarize ( input 11 to skip to next student, 12 to cancel,14 to finish (if you are busy) ) : \n"; + int flag1 = 0; + int n= 0; for (int i = 0; i> spoint; - cin.ignore(INT_MAX, '\n'); + do{ + cout << st_join_course.list[i].st_num << " : "; + cin >> spoint; + cin.clear(); + cin.ignore(INT_MAX, '\n'); + if (spoint == 11){ + spoint = -1; + } + else if (spoint == 12){ + for (int i = 0; i < n; i++){ + st_join_course.list[i].st_point.list[0] = -1; + } + return true; + } + else if (spoint == 14){ + flag1 = 1; + spoint = -1; + break; + } + else if (spoint<-1|| spoint>13 || cin.bad()){ + cout << "Wrong input, try again!\n"; + continue; + } + } while (spoint<-1|| spoint>13 || cin.bad()); st_join_course.list[i].st_point.list[0] = spoint; + n++; + } + } + if (flag!=1){ + cout << "\nSuccessfully 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 << "Grade\n"; + cout << setfill('-'); + cout << setw(55) << "-" << endl; + cout << setfill(' '); + for (size_t j = 0; j < st_join_course.size; j++){ + cout << setw(5) << left << j + 1; + cout << setw(30) << left << st_join_course.list[j].st_num; + cout << setw(20) << right << st_join_course.list[j].st_point.list[0] << endl; } } - return true; } - - - -void Teacher::showTeacherCouser(CourseList* tc_course){ - if (tc_course->size>0){ +void Teacher::showTeacherCouser(CourseList tc_course,StudentCourseList st_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" + << left << setw(20) << "Course ID" + << left << setw(15) << "Sub ID" + << left << setw(50) << "Course Name" + << left << setw(10) << "Credit" + << left << setw(10) << "Num of student" << endl; cout << setfill('-') << setw(50) << setfill(' ') << endl; - for (size_t i = 0; isize; i++) { + for (size_t i = 0; ilist[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 + << left << setw(20) << tc_course.list[i].course_id + << left << setw(15) << tc_course.list[i].sub_id + << left << setw(50) << 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:: openNewCourse(Teacher& tc, StudentCourseList& db_st_course_list, CourseList& db_course_list){ + cout << "\t\t______________________OPEN COURSE__________________________\n"; + CourseList* sum = new CourseList(); + CourseList* nsum = new CourseList(); + sum = tc.tcSumCourse(db_course_list, db_st_course_list); + nsum = tc.tcNotSumCourse(db_course_list, db_st_course_list); + if (nsum->size >= 5){ + cout << "You has open 5 courses for this term so you cannot open more course.\n"; + cout << "Press Enter to go back"; + cin.get(); + 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 + float newCourse_max; //so luong sv toi da + float newCourse_ncredit; //tin chi + Course dummy; + do{ + do{ + cout << "\nInput new sub_course ID you want to open (input 0 to exit): "; + cin >> newCourse_sub_id; + cin.ignore(INT_MAX, '\n'); + if (newCourse_sub_id == "0") return true; + if (!tc.checkNewPass(newCourse_sub_id)) cout << "New course details do not allow special sign character (, ! # @...).Try again\n"; + } while (!tc.checkNewPass(newCourse_sub_id)); + do{ + cout << "Input class group (input 0 to exit): "; + cin >> newCourse_class_id; + cin.ignore(INT_MAX, '\n'); + if (newCourse_class_id == "0") return true; + if (!tc.checkNewPass(newCourse_class_id)) cout << "New course details do not allow special sign character (, ! # @...).Try again\n"; + } while (!tc.checkNewPass(newCourse_class_id)); + newCourse_id = newCourse_sub_id + newCourse_class_id; + if (db_course_list.isCourseExist(newCourse_id, dummy)){ + cout << "You can not open an existed course. Try again! \n"; + } + } while (db_course_list.isCourseExist(newCourse_id, dummy)); + + cout << "Input new course details.\n"; + do{ + cout << "Input course name (input 0 to exit): "; + getline(cin, newCourse_name); + if (newCourse_name == "0") return true; + if (!tc.checkNewPass(newCourse_name)) cout << "New course details do not allow special sign character (, ! # @...).Try again\n"; + } while (!tc.checkNewPass(newCourse_name)); + + do{ + cout << "Input student number limitation (at least 10)(input 0 to exit) : "; cin >> newCourse_max; + cin.clear(); + cin.ignore(INT_MAX, '\n'); + if (newCourse_max == 0) return true; + 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) (input 0 to exit): "; cin >> newCourse_ncredit; + cin.clear(); + cin.ignore(INT_MAX, '\n'); + if (newCourse_max == 0) return true; + 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>6 || newCourse_ncredit != (int)newCourse_ncredit); + + Course newCourse(newCourse_sub_id, newCourse_name, tc.tc_name, tc.tc_identify); + newCourse.course_id = newCourse_id; + newCourse.total_st = 0; + newCourse.max_st = newCourse_max; + newCourse.credit = newCourse_ncredit; + cout << "NEW COURSE PREVIEW: \n"; + newCourse.printCourseInfo(); + char ans; + cout << "Are you sure to open this course? [Y/N] :"; + do{ + cin >> ans; + if (ans != 'Y' && ans != 'N'){ + cout << "Retype: "; + } + cin.ignore(INT_MAX, '\n'); + } while (ans != 'Y' && ans != 'N'); + if (ans == 'Y'){ + cout << "SUCESSFULLY OPEN A NEW COURSE \n"; + //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{ + + return true; + } + }//else right +} bool Teacher::openCourse(CourseList& db_course_list, Course newCourse){ - if (db_course_list.isCourseExist(newCourse.course_id)) return false; + Course dummy; + if (db_course_list.isCourseExist(newCourse.course_id,dummy)) return false; else { //Course newCourse; db_course_list.addToCourseList(newCourse); } } +bool Teacher::viewCourse(Teacher& tc, StudentCourseList& db_st_course_list, CourseList& db_course_list){ + 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(); + CourseList* tc_sum = tc.tcSumCourse(db_course_list, db_st_course_list); + CourseList* tc_nsum = tc.tcNotSumCourse(db_course_list, db_st_course_list); + if (tc_open_course->size == 0){ + cout << "YOU HAVE NOT OPEN ANY COURSE YET.\n"; + cin.get(); + return true; + } + if (tc_sum->size != 0){ + cout << "Your sumarized course: \n"; + tc.showTeacherCouser(*tc_sum, db_st_course_list); + } + else{ + cout << "Your sumarized course: \n"; + cout << "You have not sumarized any course yet.\n"; + } + if (tc_nsum->size != 0){ + cout << "\nYour unsumarized course: \n"; + tc.showTeacherCouser(*tc_nsum, db_st_course_list); + } + else{ + cout << "\nYour unsumarized course: \n"; + cout << "All course has ben sumarized.\n"; + } + //tc.showTeacherCouser(*tc_open_course,db_st_course_list); + if (tc_open_course->size == 0){ + cout << "Try opening a course in main menu.\n"; + cout << "PRESS ENTER TO GO BACK"; + cin.get(); + return true; + } + cout << "PRESS ENTER TO GO BACK"; + cin.get(); + return true; +} ///Teacher_List_Modify diff --git a/Teacher.h b/Teacher.h index b6942ac..8260ef6 100644 --- a/Teacher.h +++ b/Teacher.h @@ -20,16 +20,20 @@ public: string tc_phone_number; string tc_home_town; CourseList* teacherCourse(CourseList db_courseList); //nhung khoa hoc ma teacher da mo + CourseList* tcSumCourse(CourseList db_course_list,StudentCourseList); + CourseList* tcNotSumCourse(CourseList db_course_list, StudentCourseList); Teacher(){}; Teacher(string id){ this->tc_identify = id; } ~Teacher(){}; - + bool viewCourse(Teacher& tc, StudentCourseList& db_st_course_list, CourseList& db_course_list); + bool openNewCourse(Teacher& tc, StudentCourseList& db_st_course_list, CourseList& db_course_list); 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 + + void showTeacherCouser(CourseList tc_course,StudentCourseList st_course);//Xuat thong tin nhung khoa hoc ma teacher da mo Teacher& operator=(User u){ this->username = u.username; this->password = u.password; diff --git a/User.cpp b/User.cpp index fd3b15a..3e80723 100644 --- a/User.cpp +++ b/User.cpp @@ -47,3 +47,31 @@ void UserList::updateList(User& user) { this->list[index].password = user.password; } } + + + +bool cp(User user, arrayList agvList, UserList &user_list) { + string newPassword; + if (agvList.size != 1) { + for (int i = 1; i < agvList.size; i++) newPassword += agvList.list[i]; + } + else if (agvList.size == 1) { + cout << "Input your new password: "; + getline(cin, newPassword); + newPassword = user.removeSpaces(newPassword); + } + if (!user.checkNewPass(newPassword)) { + cout << "NEW PASSWORD MUST NOT CONTAIN ', . ? @ $ # ...' CHARATER (SYSTEM REQUIRE),TRY AGAIN LATER.\n"; + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); + return true; + } + else { + user.changePassword(newPassword); + user_list.updateList(user); + cout << "CHANGE PASSWORD SUCCESSFULLY--YOUR NEWPASS (please remember it): " << newPassword << endl; + cout << "PRESS ENTER TO GO BACK\n"; + cin.get(); + return true; + } +} \ No newline at end of file diff --git a/User.h b/User.h index f264b59..1d65f30 100644 --- a/User.h +++ b/User.h @@ -1,6 +1,9 @@ #ifndef _USER_ #define _USER_ +#include #include +#include +#include #include "Helper.h" using namespace std; @@ -26,6 +29,17 @@ public: if (this->username == "")return false; else return true; } + string removeSpaces(string str) + { + str.erase(remove(str.begin(), str.end(), ' '), str.end()); + return str; + } + bool checkNewPass(string np) { + for (int i = 0; i < np.length(); i++) { + if (np[i] == ',' || np[i] == '.' || np[i] == '?' || np[i] == '/' || np[i] == '>' || np[i] == '<' ||np[i] == '@' || np[i] == '#' || np[i] == '!') return false; + } + return true; + } void changePassword(string newPassword) { this->password = newPassword; } @@ -46,4 +60,6 @@ public: void updateList(User& user); }; +bool cp(User user, arrayList agvList, UserList &user_list); + #endif // !_USER_ diff --git a/course.csv b/course.csv index 2aa23de..753a578 100644 --- a/course.csv +++ b/course.csv @@ -1,29 +1,20 @@ -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 +a1,S0951,BUI QUOC TRUNG,a,Giai tich 1,15,15,3 +a2,S0951,BUI QUOC TRUNG,a,Giai tich 1,15,15,3 +a3,S0952,NGUYEN THI NGOC,a,Giai tich 1,15,10,3 +a4,S0951,BUI QUOC TRUNG,a,Giai tich 2,12,10,3 +a5,S0952,NGUYEN THI NGOC,a,Giai tich 2,12,10,3 +b1,S0953,TRAN HUNG NGUYEN,b,Vat ly 1,15,14,4 +b2,S0954,NGUYEN TAN DUNG,b,Vat ly 1,15,14,4 +b3,S0953,TRAN HUNG NGUYEN,b,Vat ly 1,15,12,4 +b4,S0954,NGUYEN TAN DUNG,b,Vat ly 2,12,10,4 +b5,S0953,TRAN HUNG NGUYEN,b,Vat ly 2,12,10,4 +c1,S0956,NGUYEN THI NHUNG,c,GDTC 1,18,15,0 +c2,S0955,DO THI THUONG,c,GDTC 1,18,15,0 +c3,S0955,DO THI THUONG,c,GDTC 2,15,10,0 +c4,S0956,NGUYEN THI NHUNG,c,GDTC 2,15,10,0 +c5,S0956,NGUYEN THI NHUNG,c,GDTC 3,12,10,0 +d1,S0958,LE THI NGOC TRANG,d,Anh van 1,18,15,2 +d2,S0957,NGUYEN THI LOAN,d,Anh van 1,18,15,2 +d3,S0958,LE THI NGOC TRANG,d,Anh van 2,15,10,2 +d4,S0957,NGUYEN THI LOAN,d,Anh van 2,15,10,2 +d5,S0957,NGUYEN THI LOAN,d,Anh van 3,12,10,2 diff --git a/student.csv b/student.csv index 1f10e25..cfb2ca6 100644 --- a/student.csv +++ b/student.csv @@ -1,30 +1,40 @@ -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" +1712351,NONG THI SEN,1986-10-26,"Huyen Pho Yen, Thai Nguyen" +1712352,LY THI THUYEN,1989-04-06,"Huyen Pho Yen, Thai Nguyen" +1712353,DO THI HUE,1985-06-13,"Thi xa Song Cong, Thai Nguyen" +1712354,DANG THE ANH,1989-03-27,"Thanh pho Thai Nguyen, Thai Nguyen" +1712355,NGUYEN HONG HANH,1989-01-24,"Huyen Phu Luong, Thai Nguyen" +1712356,HOANG THI DINH,1991-02-02,"Huyen Phu Binh, Thai Nguyen" +1712357,NGO THI LE HANG,1991-03-20,"Huyen Quynh Nhai, Son La" +1712358,KHONG HUONG GIANG,1985-12-11,"Huyen Thuong Xuan, Thanh Hoa" +1712359,DIEP THI HONG THUY,1985-08-19,"Thanh pho Bac Ninh, Bac Ninh" +1712360,NGUYEN VAN DUY,1989-03-11,"Huyen Cam Thuy, Thanh Hoa" +1712361,VU NHU QUYNH,1987-03-27,"Huyen Phu Luong, Thai Nguyen" +1712362,PHUNG KHU PU,1987-07-18,"Huyen Dinh Hoa, Thai Nguyen" +1712363,MA THI YEN NHI,1988-07-07,"Huyen Binh Lieu, Quang Ninh" +1712364,DINH THUY NGAN,1988-01-05,"Huyen Pho Yen, Thai Nguyen" +1712365,BANG THI DUYEN,1985-12-17,"Thanh pho Thai Nguyen, Thai Nguyen" +1712366,NGUYEN THI NGOC KHANH,1987-12-17,"Huyen Pho Yen, Thai Nguyen" +1712367,NGUYEN QUYNH TRANG,1989-02-05,"Huyen Dai Tu, Thai Nguyen" +1712368,DOI THI DIEU TIEN,1986-02-06,"Huyen Dai Tu, Thai Nguyen" +1712369,HOANG HUYEN TRANG,1988-03-19,"Thanh pho Thai Nguyen, Thai Nguyen" +1712370,DO DINH DUY,1990-11-17,"Thi xa Song Cong, Thai Nguyen" +1712371,NGUYEN HOANG HIEU,1989-02-24,"Huyen Lam Thao, Phu Tho" +1712372,NGUYEN THI NHI,1988-01-27,"Thanh pho Thai Nguyen, Thai Nguyen" +1712373,NGO QUANG DUONG,1986-02-20,"Huyen Phu Luong, Thai Nguyen" +1712374,MO THI THANH KIM HUE,1991-01-16,"Thi xa Song Cong, Thai Nguyen" +1712375,MONG THI THU,1990-09-13,"Thanh pho Thai Nguyen, Thai Nguyen" +1712376,HOANG THI THU HANG,1985-10-17,"Huyen Dinh Hoa, Thai Nguyen" +1712377,DANG THU HANH,1991-04-17,"Huyen Dong Hy, Thai Nguyen" +1712378,DIEP THI LINH,1985-11-02,"Huyen Pho Yen, Thai Nguyen" +1712379,HAN MINH HANG,1985-10-07,"Huyen Dai Tu, Thai Nguyen" +1712380,NGUYEN DIEU LINH,1987-10-08,"Huyen Dai Tu, Thai Nguyen" +1712381,LY MAI DUONG,1987-05-21,"Thanh pho Thai Nguyen, Thai Nguyen" +1712382,DANG THI LINH,1986-04-19,"Thanh pho Thai Nguyen, Thai Nguyen" +1712383,NGUYEN DOAN THAI HUNG,1991-05-17,"Thi xa Song Cong, Thai Nguyen" +1712384,HOANG THI THANH PHUONG,1988-08-17,"Huyen Dong Hy, Thai Nguyen" +1712385,TO TRUNG HIEU,1987-03-14,"Huyen Pho Yen, Thai Nguyen" +1712386,NGUYEN THI HUONG,1989-02-27,"Huyen Phu Binh, Thai Nguyen" +1712387,NINH THI HAI YEN,1985-06-18,"Huyen Yen Thuy, Hoa Binh" +1712388,TA THI THU YEN,1990-07-12,"Huyen Bach Thong, Bac Kan" +1712389,NGUYEN HA LINH HUE,1987-10-16,"Huyen Kim Boi, Hoa Binh" +1712390,NGUYEN HONG HANH,1985-01-12,"Huyen Dong Hy, Thai Nguyen" diff --git a/student_course.csv b/student_course.csv index e3e7623..73d7507 100644 --- a/student_course.csv +++ b/student_course.csv @@ -1,33 +1,40 @@ -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 +1712351;a1,a4,c1,b1,b4,d1;1.5,-1,3,8.5,-1,9;13 +1712352;a1,a4,c1,b1,b4,d1;1.5,-1,1.5,3.5,-1,4.5;13 +1712353;a1,a4,c1,b1,b4,d1;5.5,-1,7,0.5,-1,0;13 +1712354;a1,a4,c1,b1,b4,d1;8.5,-1,0,1.5,-1,3.5;13 +1712355;a1,a4,c1,b1,b4,d1;6.5,-1,8.5,0.5,-1,9;13 +1712356;a1,a4,c1,b1,b4,d1;8,-1,6,6.5,-1,5.5;13 +1712357;a1,a4,c1,b1,b4,d1;8,-1,1.5,3.5,-1,2;13 +1712358;a1,a4,c1,b1,b4,d1;0,-1,0.5,4.5,-1,3.5;13 +1712359;a1,a4,c1,b1,b4,d1;7.5,-1,7,4.5,-1,1.5;13 +1712360;a1,a4,c1,b1,b4,d1;6.5,-1,4.5,8.5,-1,9;13 +1712361;a1,a5,c1,b1,b5,d1;4,-1,7.5,7,-1,2;13 +1712362;a1,a5,c1,b1,b5,d1;1,-1,4.5,10,-1,1.5;13 +1712363;a1,a5,c1,b1,b5,d1;3,-1,10,9,-1,3;13 +1712364;a1,a5,c1,b1,b5,d1;1.5,-1,4.5,1.5,-1,8.5;13 +1712365;a1,a5,c1,b2,b5,d1;2,-1,2,2.5,-1,2.5;13 +1712366;a2,a5,c2,b2,b5,d2;6,-1,9.5,5,-1,2.5;13 +1712367;a2,a5,c2,b2,b5,d2;5,-1,5,5,-1,7;13 +1712368;a2,a5,c2,b2,b5,d2;6.5,-1,7.5,8.5,-1,4;13 +1712369;a2,a5,c2,b2,b5,d2;6,-1,3.5,5,-1,10;13 +1712370;a2,a5,c2,b2,b5,d2;4,-1,1.5,6,-1,5.5;13 +1712371;a2,c3,c2,b2,d3,d2;9,2.5,2.5,0.5,6.5,3;13 +1712372;a2,c3,c2,b2,d3,d2;8,2.5,6,9,1.5,0;13 +1712373;a2,c3,c2,b2,d3,d2;1,1,6.5,4.5,6.5,5;13 +1712374;a2,c3,c2,b2,d3,d2;0.5,7,5,2,3,8.5;13 +1712375;a2,c3,c2,b2,d3,d2;1,1,4,3.5,2,9.5;13 +1712376;a2,c3,c2,b2,d3,d2;1.5,5.5,9.5,0,10,4;13 +1712377;a2,c3,c2,b2,d3,d2;8,9,1.5,4,5.5,9;13 +1712378;a2,c3,c2,b2,d3,d2;5,9.5,0.5,8.5,6,2.5;13 +1712379;a2,c3,c2,b3,d3,d2;6,7.5,5,4.5,9,4;13 +1712380;a2,c3,c2,b3,d3,d2;0,1.5,10,0.5,7.5,5.5;13 +1712381;a3,c4,c5,b3,d4,d5;3,7.5,-1,8,8,3.5;13 +1712382;a3,c4,c5,b3,d4,d5;0.5,9,-1,6.5,6.5,1.5;13 +1712383;a3,c4,c5,b3,d4,d5;9.5,8.5,-1,6.5,2,7.5;13 +1712384;a3,c4,c5,b3,d4,d5;7.5,9,-1,10,5,6;13 +1712385;a3,c4,c5,b3,d4,d5;2,9.5,-1,2,0.5,2;13 +1712386;a3,c4,c5,b3,d4,d5;8.5,2.5,-1,7,4,6.5;13 +1712387;a3,c4,c5,b3,d4,d5;10,3,-1,5,6,6;13 +1712388;a3,c4,c5,b3,d4,d5;4.5,2,-1,8,4.5,2;13 +1712389;a3,c4,c5,b3,d4,d5;3.5,9.5,-1,0.5,8,5;13 +1712390;a3,c4,c5,b3,d4,d5;4,9.5,-1,4,8,8;13 diff --git a/teacher.csv b/teacher.csv index 9158d77..e3d718e 100644 --- a/teacher.csv +++ b/teacher.csv @@ -6,45 +6,3 @@ 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/user.csv b/user.csv index 28c16c4..a65a7b4 100644 --- a/user.csv +++ b/user.csv @@ -1,17 +1,34 @@ -1712350,123456,student +admin,a,admin +S0951,S0951,teacher +S0952,S0952,teacher +S0953,S0953,teacher +S0954,S0954,teacher +S0955,S0955,teacher +S0956,S0956,teacher +S0957,S0957,teacher +S0958,S0958,teacher 1712351,1712351,student 1712352,1712352,student 1712353,1712353,student 1712354,1712354,student -1712355,abc123,student +1712355,1712355,student 1712356,1712356,student 1712357,1712357,student 1712358,1712358,student 1712359,1712359,student 1712360,1712360,student 1712361,1712361,student +1712362,1712362,student +1712363,1712363,student +1712364,1712364,student +1712365,1712365,student +1712366,1712366,student +1712367,1712367,student +1712368,1712368,student +1712369,1712369,student +1712370,1712370,student 1712371,1712371,student -1712372,haidang,student +1712372,1712372,student 1712373,1712373,student 1712374,1712374,student 1712375,1712375,student @@ -19,63 +36,14 @@ 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 +1712380,1712380,student +1712381,1712381,student +1712382,1712382,student +1712383,1712383,student +1712384,1712384,student +1712385,1712385,student +1712386,1712386,student +1712387,1712387,student +1712388,1712388,student +1712389,1712389,student +1712390,1712390,student