SAS/Menu.cpp

431 lines
10 KiB
C++
Raw Normal View History

2022-07-04 00:31:52 +08:00
#include<iostream>
#include"Menu.h"
#include"MenuUtils.h"
#include"StudentDAO.h"
#include"GradeDAO.h"
#include"CourseDAO.h"
using namespace std;
void mainMenu(_ConnectionPtr connection) {
system("cls");
printf("1.<2E><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7>\n");
printf("2.<2E><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7>\n");
printf("3.ɾ<><C9BE>ѧ<EFBFBD><D1A7>\n");
printf("4.<2E>޸<EFBFBD>ѧ<EFBFBD><D1A7>\n");
printf("5.<2E><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ\n");
printf("6.<2E><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ļ<EFBFBD>\n");
printf("7.ѧ<><D1A7><EFBFBD>ɼ<EFBFBD><C9BC><EFBFBD><EFBFBD><EFBFBD>\n");
printf("8.<2E>γ̹<CEB3><CCB9><EFBFBD>\n");
printf("0.<2E>˳<EFBFBD>\n");
int opt = -1;
checkOptInput(opt, 0, 8);
switch (opt){
case 1:
showAllStudent(connection);
break;
case 2:
insertStudent(connection);
break;
case 3:
deleteStudent(connection);
break;
case 4:
changeStudent(connection);
break;
case 5:
importData(connection);
break;
case 6:
exportData(connection);
break;
case 7:
studentGradeMenu(connection);
break;
case 8:
courseMenu(connection);
break;
default:
exit(EXIT_SUCCESS);
}
printf("\n");
}
void studentGradeMenu(_ConnectionPtr connection) {
while (true) {
system("cls");
printf("1.<2E><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD>ɼ<EFBFBD>\n");
printf("2.<2E><>ȡѧ<C8A1><D1A7>ƽ<EFBFBD><C6BD><EFBFBD>ɼ<EFBFBD>\n");
printf("3.<2E><>ȡѧ<C8A1><D1A7><EFBFBD>ܳɼ<DCB3>\n");
printf("4.<2E><>ȡ<EFBFBD>ƽ<E0BCB6><C6BD><EFBFBD><EFBFBD>\n");
printf("5.<2E><>ȡ<EFBFBD><EFBFBD><E0BCB6><EFBFBD>߷<EFBFBD>\n");
printf("6.<2E><>ȡ<EFBFBD><EFBFBD><E0BCB6><EFBFBD>ͷ<EFBFBD>\n");
printf("7.<2E><>ȡ<EFBFBD><EFBFBD>ɼ<EFBFBD>\n");
printf("8.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD>˵<EFBFBD>\n");
printf("0.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>\n");
int opt = -1;
checkOptInput(opt, 0, 8);
printf("\n");
string stuId, courseId;
string stuClass, courseName;
double grade = -1;
int size;
vector<Grade> *v;
switch (opt) {
case 1://<2F><><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD>ɼ<EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> stuId;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseId;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(0-100)<29><>");
while (!(cin >> grade) || (opt < 0) || (opt > 100)) {
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
cin.clear();
while (cin.get() != '\n');
}
addGrade(connection, *new Grade(stuId, courseId, doubleToString(grade)));
printf("<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD>\n");
break;
case 2://<2F><>ȡѧ<C8A1><D1A7>ƽ<EFBFBD><C6BD><EFBFBD>ɼ<EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> stuId;
printf("ѧ<EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD>ɼ<EFBFBD>Ϊ<EFBFBD><EFBFBD>%.2lf\n", getOnesAvgGrade(connection, stuId));
break;
case 3://<2F><>ȡѧ<C8A1><D1A7><EFBFBD>ܳɼ<DCB3>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> stuId;
printf("ѧ<EFBFBD><EFBFBD><EFBFBD>ܳɼ<EFBFBD>Ϊ<EFBFBD><EFBFBD>%.2lf\n", getOnesAllGrade(connection, stuId));
break;
case 4://<2F><>ȡ<EFBFBD>ƽ<E0BCB6><C6BD><EFBFBD><EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> stuClass;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
cout << stuClass << "<EFBFBD>" << courseName << "<EFBFBD>γ̵<EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>" << getClassAvgGrade(connection, stuClass, courseName) << "\n";
break;
case 5://<2F><>ȡ<EFBFBD><EFBFBD><E0BCB6><EFBFBD>߷<EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> stuClass;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
cout << stuClass << "<EFBFBD>" << courseName << "<EFBFBD>γ̵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>߷<EFBFBD>Ϊ<EFBFBD><EFBFBD>" << getClassMaxGrade(connection, stuClass, courseName) << "\n";
break;
case 6://<2F><>ȡ<EFBFBD><EFBFBD><E0BCB6><EFBFBD>ͷ<EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> stuClass;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
cout << stuClass << "<EFBFBD>" << courseName << "<EFBFBD>γ̵<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>Ϊ<EFBFBD><EFBFBD>" << getClassMinGrade(connection, stuClass, courseName) << "\n";
break;
case 7://<2F><>ȡ<EFBFBD><EFBFBD>ɼ<EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> stuClass;
v = getGradeByStuClass(connection, stuClass);
if (v == NULL) {
printf("<EFBFBD>ð༶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
break;
}
size = v->size();
cout << "ѧ<EFBFBD><EFBFBD>\t" << "<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>\t" << "<EFBFBD>ɼ<EFBFBD>\n";
for (int i = 0; i < size; i++) {
cout << (*v)[i].getStuId() << "\t" << getCourseById(connection, (*v)[i].getCourseId())->getName() << "\t" << (*v)[i].getGradeStr() << "\n";
}
break;
case 8://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>չ<EFBFBD>˵<EFBFBD>
studentGradeExternMenu(connection);
break;
default://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
return;
}
system("pause");
}
}
void studentGradeExternMenu(_ConnectionPtr connection) {
while (true) {
system("cls");
printf("1.ɾ<><C9BE>ijѧ<C4B3><D1A7>ij<EFBFBD>Ƴɼ<C6B3>\n");
printf("2.ɾ<><C9BE>ijѧ<C4B3><D1A7><EFBFBD>ɼ<EFBFBD>\n");
printf("3.ɾ<><C9BE>ij<EFBFBD>Ƴɼ<C6B3>\n");
printf("4.<2E><><EFBFBD><EFBFBD>ijѧ<C4B3><D1A7>ij<EFBFBD>Ƴɼ<C6B3>\n");
printf("5.<2E><>ѯijѧ<C4B3><D1A7>ij<EFBFBD>Ƴɼ<C6B3>\n");
printf("6.<2E><>ѯijѧ<C4B3><D1A7><EFBFBD>ɼ<EFBFBD>\n");
printf("7.<2E><>ѯij<D1AF>Ƴɼ<C6B3>\n");
printf("8.<2E><>ѯ<EFBFBD><D1AF><EFBFBD>гɼ<D0B3>\n");
printf("0.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>\n");
int opt = -1;
checkOptInput(opt, 0, 8);
printf("\n");
string stuId, courseId;
string stuClass, courseName;
double grade = -1;
int size;
vector<Grade> *v;
Grade* gra;
Course* course;
switch (opt) {
case 1://ɾ<><C9BE>ijѧ<C4B3><D1A7>ij<EFBFBD>Ƴɼ<C6B3>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> stuId;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
course = getCourseByName(connection, courseName);
if (course == NULL) {
printf("<EFBFBD>ÿγ̲<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
break;
}
deleteOnesGrade(connection, stuId, course->getId());
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
break;
case 2://ɾ<><C9BE>ijѧ<C4B3><D1A7><EFBFBD>ɼ<EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> stuId;
deleteGradeByStuId(connection, stuId);
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
break;
case 3://ɾ<><C9BE>ij<EFBFBD>Ƴɼ<C6B3>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
course = getCourseByName(connection, courseName);
if (course == NULL) {
printf("<EFBFBD>ÿγ̲<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
break;
}
deleteGradeByCourseId(connection, course->getId());
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
break;
case 4://<2F><><EFBFBD><EFBFBD>ijѧ<C4B3><D1A7>ij<EFBFBD>Ƴɼ<C6B3>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> stuId;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
course = getCourseByName(connection, courseName);
if (course == NULL) {
printf("<EFBFBD>ÿγ̲<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
break;
}
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD><EFBFBD>(0-100)<29><>");
while (!(cin >> grade) || (opt < 0) || (opt > 100)) {
cout << "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
cin.clear();
while (cin.get() != '\n');
}
updateOnesGrade(connection, stuId, course->getId(), doubleToString(grade));
printf("<EFBFBD><EFBFBD><EFBFBD>ijɹ<EFBFBD><EFBFBD><EFBFBD>\n");
break;
case 5://<2F><>ѯijѧ<C4B3><D1A7>ij<EFBFBD>Ƴɼ<C6B3>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> stuId;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
course = getCourseByName(connection, courseName);
if (course == NULL) {
printf("<EFBFBD>ÿγ̲<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
break;
}
gra = getOnesGrade(connection, stuId, course->getId());
if (gra == NULL) {
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
break;
}
cout << "ѧ<EFBFBD><EFBFBD>\t" << "<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>\t" << "<EFBFBD>ɼ<EFBFBD>\n";
cout << (*gra).getStuId() << "\t" << getCourseById(connection, (*gra).getCourseId())->getName() << "\t" << (*gra).getGradeStr() << "\n";
break;
case 6://<2F><>ѯijѧ<C4B3><D1A7><EFBFBD>ɼ<EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> stuId;
v = getGradeByStuId(connection, stuId);
if (v == NULL) {
printf("<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
break;
}
size = v->size();
cout << "ѧ<EFBFBD><EFBFBD>\t" << "<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>\t" << "<EFBFBD>ɼ<EFBFBD>\n";
for (int i = 0; i < size; i++) {
cout << (*v)[i].getStuId() << "\t" << getCourseById(connection, (*v)[i].getCourseId())->getName() << "\t" << (*v)[i].getGradeStr() << "\n";
}
break;
case 7://<2F><>ѯij<D1AF>Ƴɼ<C6B3>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
course = getCourseByName(connection, courseName);
if (course == NULL) {
printf("<EFBFBD>ÿγ̲<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
break;
}
v = getGradeByCourseId(connection, course->getId());
if (v == NULL) {
printf("<EFBFBD>ÿγ̲<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>Ӧ<EFBFBD>ɼ<EFBFBD><EFBFBD><EFBFBD>\n");
break;
}
size = v->size();
cout << "ѧ<EFBFBD><EFBFBD>\t" << "<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>\t" << "<EFBFBD>ɼ<EFBFBD>\n";
for (int i = 0; i < size; i++) {
cout << (*v)[i].getStuId() << "\t" << getCourseById(connection, (*v)[i].getCourseId())->getName() << "\t" << (*v)[i].getGradeStr() << "\n";
}
break;
case 8://<2F><>ѯ<EFBFBD><D1AF><EFBFBD>гɼ<D0B3>
v = getAllGrade(connection);
if (v == NULL) {
printf("<EFBFBD>޳ɼ<EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>\n");
break;
}
size = v->size();
cout << "ѧ<EFBFBD><EFBFBD>\t" << "<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>\t" << "<EFBFBD>ɼ<EFBFBD>\n";
for (int i = 0; i < size; i++) {
cout << (*v)[i].getStuId() << "\t" << getCourseById(connection, (*v)[i].getCourseId())->getName() << "\t" << (*v)[i].getGradeStr() << "\n";
}
break;
default://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
return;
}
system("pause");
}
}
void courseMenu(_ConnectionPtr connection) {
while (true) {
system("cls");
printf("1.<2E><><EFBFBD>ӿγ<D3BF>\n");
printf("2.ɾ<><C9BE><EFBFBD>γ<EFBFBD>\n");
printf("3.<2E><><EFBFBD>Ŀγ<C4BF>\n");
printf("4.<2E><>ѯ<EFBFBD><D1AF><EFBFBD>пγ<D0BF>\n");
printf("0.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>\n");
int opt = -1;
checkOptInput(opt, 0, 8);
printf("\n");
int size;
string courseId, courseName;
vector<Course>* v;
switch (opt) {
case 1://<2F><><EFBFBD>ӿγ<D3BF>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ̺ţ<EFBFBD>");
cin >> courseId;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
addCourse(connection,*new Course(courseId, courseName));
printf("<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD>\n");
break;
case 2://ɾ<><C9BE><EFBFBD>γ<EFBFBD>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ̺ţ<EFBFBD>");
cin >> courseId;
deleteCourse(connection, courseId);
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
break;
case 3://<2F><><EFBFBD>Ŀγ<C4BF>
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ̺ţ<EFBFBD>");
cin >> courseId;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> courseName;
updateCourseName(connection, courseId,courseName);
printf("<EFBFBD><EFBFBD><EFBFBD>³ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
break;
case 4://<2F><>ѯ<EFBFBD><D1AF><EFBFBD>пγ<D0BF>
v = getAllCourse(connection);
if (v == NULL) {
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڿγ̼<EFBFBD>¼<EFBFBD><EFBFBD>\n");
break;
}
size = v->size();
cout << "<EFBFBD>γ̺<EFBFBD>\t" << "<EFBFBD>γ<EFBFBD><EFBFBD><EFBFBD>\n";
for (int i = 0; i < size; i++) {
cout << (*v)[i].getId() << "\t" << (*v)[i].getName() << "\n";
}
break;
default://<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>
return;
}
system("pause");
}
}
void showAllStudent(_ConnectionPtr connection) {
vector<Student> vs = *getAllStudent(connection);
int size = vs.size();
for (int i = 0; i < size; i++) {
cout << vs[i].toString() << "\n";
}
}
void insertStudent(_ConnectionPtr connection) {
Student *stu = new Student();
string str;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> str;
stu->setId(str);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> str;
stu->setName(str);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD>");
cin >> str;
stu->setSex(str);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
cin >> str;
stu->setStuClass(str);
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD>״̬(<28>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD>ѧ)<29><>");
cin >> str;
stu->setStatus(str);
addStudent(connection, *stu);
printf("<EFBFBD><EFBFBD><EFBFBD>ӳɹ<EFBFBD><EFBFBD><EFBFBD>\n");
}
void deleteStudent(_ConnectionPtr connection) {
string id;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> id;
Student *stu = getStudentById(connection,id);
if (stu == NULL) {
printf("<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
return;
}
deleteStudent(connection, id);
printf("ɾ<EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD>\n");
}
void changeStudent(_ConnectionPtr connection) {
string id;
printf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѧ<EFBFBD>ţ<EFBFBD>");
cin >> id;
Student* stu = getStudentById(connection, id);
if (stu == NULL) {
printf("<EFBFBD><EFBFBD>ѧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>\n");
return;
}
printf("<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD> <20>༶(0) / ѧ<><D1A7>״̬(1)<29><>");
int opt = -1;
checkOptInput(opt, 0, 1);
string input;
switch (opt) {
case 0:
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>°༶<EFBFBD><EFBFBD>");
cin >> input;
updateStudentClass(connection,id,input);
break;
default:
printf("\n<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD>");
cin >> input;
updateStudentStatus(connection,id, input);
break;
}
}
void exportData(_ConnectionPtr connection) {
}
void importData(_ConnectionPtr connection) {
}