@Override public void initPersonalInfo(Manager manager) throws DataBaseException, QueryResultIsNullException { Statement stmt = DB.CreateStatement(); String sql = "select *from DormManage where DMId=" + manager.getId(); // System.out.println(sql); try { ResultSet rs = null; rs = stmt.executeQuery(sql); if (!rs.next()) { throw new QueryResultIsNullException(); } // rs.next(); manager.setName(rs.getString("DMName")); manager.setSex(rs.getString("DMsex")); manager.setDormId(rs.getString("DormId")); manager.setPhone(rs.getString("DMPhone")); } catch (SQLException e) { // TODO 自动生成的 catch 块 e.printStackTrace(); throw new DataBaseException(); } }
@Override public String toString() { return "{\"EmployeeId\":\"" + employeeId + "\"," + "\"EmployeeName\":\"" + employeeName + "\"," + "\"ManagerId\":" + (manager == null ? "null" : "\"" + manager.getId() + "\"") + "," + "\"RoomId\":" + (room == null ? "null" : "\"" + room.getId() + "\"") + "," + "\"TeamId\":" + (team == null ? "null" : "\"" + team.getId() + "\"") + "," + "\"Location\":" + (location == null ? "null" : "{\"City\":" + (location.getCity() == null ? "null" : "{\"PostalCode\":\"" + location.getCity().getPostalCode() + "\"," + "\"CityName\":\"" + location.getCity().getCityName() + "\"}") + "," + "\"Country\":\"" + location.getCountry() + "\"}") + "," + "\"Age\":" + age + "," + "\"EntryDate\":" + (entryDate == null ? "null" : "\"" + DateFormat.getInstance().format(entryDate.getTime()) + "\"") + "," + "\"ImageUrl\":\"" + imageUrl + "\"}"; }