管理员业务开发 package com.xll.manage;import java.util.List;import javax.naming.ldap.ManageReferralControl;import com.xll.login.Login;import com.xll.model.Student;import com.xll.model.Teacher;import com.xll.util.Tools;public class Te
package com.xll.manage; import java.util.List; import javax.naming.ldap.ManageReferralControl; import com.xll.login.Login; import com.xll.model.Student; import com.xll.model.Teacher; import com.xll.util.Tools; public class TeacherLogin { public static void Login() { while(true){ String name=Tools.getString("请输入登录名"); String pwd=Tools.getString("请输入密码"); if(Menu.tlist.contains(new Teacher(name,pwd))){ menu();break; }else Tools.pl("登录失败,请重新登录"); } } private static void menu() { // TODO Auto-generated method stub Tools.pl("登录成功"); Menu.slist.clear(); // if(Tools.loadData(Menu.pathName)!=null) // Menu.slist=(List) Tools.loadData(Menu.pathName); if(Tools.load(Menu.slist,Menu.pathName)!=null) Menu.slist=(List ) Tools.load(Menu.slist,Menu.pathName); lab: while(true){ int i=Tools.menuFactory("添加学生信息,修改学生信息,删除学生信息,查询学生信息"); switch (i) { case 1: addStudent(); break; case 2: update(); break; case 3: removeStudent(); break; case 4: selectStudent(); break; case 0: if(Tools.isContinue("是否退出登录 ")){ break lab; } default: Tools.pl("输入错误,请输入正确的选择"); break; } } } private static void selectStudent() { // TODO Auto-generated method stub lab: while(true){ switch (Tools.menuFactory("搜索全部学生信息,根据姓名关键字搜索学生信息")) { case 1: selectAll(); break; case 2: selectByName(); case 0: if(!Tools.isContinue("是否继续查询同学信息 ")){ break lab; } default: Tools.pl("输入错误,请输入正确的选择"); break; } } } private static void update() { // TODO Auto-generated method stub while(true){ selectAll(); int i=Tools.getInt("请输入需要修改的学生的编号:"); Student stu=(Student)Menu.slist.get(i); stu.setName(Tools.getString("请输入新的姓名")); stu.setAddress(Tools.getString("请输入新的地址")); stu.setId(Tools.getInt("请输入新的ID:")); stu.setMobile(Tools.getString("请输入新的号码:")); stu.setPwd(Tools.getString("请输入新的密码")); stu.setSex(Tools.getString("请输入新的性别")); Menu.slist.set(i, stu); //Tools.savaData(Menu.pathName); Tools.sava(Menu.slist,Menu.pathName); selectAll(); if(!Tools.isContinue("是否继续修改学生信息 ")) break; } } private static void removeStudent() { // TODO Auto-generated method stub selectAll(); while(true){ int i=Tools.getInt("请输入要删除的学生的下标:"); Menu.slist.remove(i); // Tools.savaData(Menu.pathName); Tools.sava(Menu.slist,Menu.pathName); selectAll(); if(!Tools.isContinue("是否继续删除 ")) break; } } private static void selectAll() { // TODO Auto-generated method stub // if(Tools.loadObjec(pathName)!=null) // Menu.slist=(List ) Tools.loadObjec(pathName); try { if(Menu.slist.size()==0) Tools.pl("学生信息为空"); else{ Tools.pl("编号\tID\t姓名\t年龄\t密码\t性别\t号码\t地址\t"); for(int i=0;i ")) break; } } public static void addStudent() { // TODO Auto-generated method stub while(true){ String name=Tools.getString("请输入姓名:"); String pwd=Tools.getString("请输入密码:"); String sex=Tools.getString("请输入性别:"); String number=Tools.getString("请输入号码:"); String address=Tools.getString("请输入地址:"); int age=Tools.getInt("请输入年龄:"); int id=Tools.getInt("请输入ID:"); Student stu=new Student(name,pwd,id,age,sex, number,address); Menu.slist.add(stu); if(!Tools.isContinue("是否继续添加学生信息 ")) break; } //Tools.savaData(Menu.pathName); Tools.sava(Menu.slist,Menu.pathName); } }