/** 学生:直接删除 任课老师,直接删除 */ private void deleteStudent(int row) { AdminBLService ad = new AdminController(); UserVo stu = new UserVo((String) table.getValueAt(row, 0), "", "", "", "", "", "", "", 0, ""); String result = ad.deleteUser(stu); Methods.showTip(result); }
/** 删除教务处老师或院系教务老师: 若还有其他该角色的老师则直接删除, 否则要求用户添加一名新的老师,若不添加则不能删除 */ private void deleteJW(final int row, String role) { AdminBLService ad = new AdminController(); ArrayList<UserVo> user = ad.getUser(role); if (user.size() > 1) { String result = ad.deleteUser( new UserVo((String) table.getValueAt(row, 0), role, "", "", "", "", "", "", 0, "")); Methods.showTip(result); } else { JDialog tip = new JDialog(); tip.getContentPane().setLayout(null); tip.setTitle("~~~"); tip.setSize(350, 200); tip.setLocationRelativeTo(null); JTextArea area = new JTextArea("请先添加一名新的用户来接管该" + Methods.eToC(role) + "的\r\n工作再执行删除"); area.setBounds(42, 44, 260, 60); tip.getContentPane().add(area); tip.setVisible(true); } }