public boolean delete( String id, String name, String password, String identityID, String institutionID, enumSet.Position work) throws RemoteException { List<UserPO> userList = this.list; UserPO po = new UserPO(id, name, password, identityID, institutionID, work); for (UserPO temp : userList) { if (temp.getId().equals(id) && temp.getName().equals(name)) { po = UserDS.find(identityID); UserDS.delete(po); userList.remove(po); } } return true; }
public AdminBL() throws RemoteException { try { RMIHelper.initUserDataService(); UserDS = RMIHelper.getUserDataService(); list = UserDS.getUsers(); } catch (ClientInitException e) { e.printStackTrace(); } }
@Override public ArrayList<LogVO> logmessage(String office, String time) { // TODO Auto-generated method stub UserDataService userdata = datafactory.getUserData(); logVOs = new ArrayList<LogVO>(); try { logs = userdata.findsLogsPO(office, time); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } for (LogPO po : logs) { LogVO vo = new LogVO(po.getTime(), po.getOffice(), po.getUseuId(), po.getLogmessage()); logVOs.add(vo); } return logVOs; }
@Override public ResultMessage addMessage(String userId, String logmessage) { // TODO Auto-generated method stub PManagementController pm = new PManagementController(); StaffVO staffVO = pm.select(userId); UserDataService userdata = datafactory.getUserData(); Date dt = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String timeOfLog = sdf.format(dt); LogPO log = new LogPO(timeOfLog, staffVO.getWorkPlaceNumber(), userId, logmessage); try { return userdata.insertLogPO(log); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); return ResultMessage.FAIL; } }
public boolean add( String id, String name, String password, String identityID, String institutionID, enumSet.Position work) throws RemoteException { List<UserPO> userList = this.list; UserPO po = new UserPO(id, name, password, identityID, institutionID, work); for (UserPO temp : userList) { if (temp.getId().equals(po)) { return false; } } userList.add(po); UserDS.add(po); return true; }