?? sb_accommodationmanagertestclient1.java~12~
字號:
} e.printStackTrace(); } if (logging) { log("Return value from saveToAcc(" + id + ", " + leavetime + ", " + charge + "): " + returnValue + "."); } return returnValue; } public Accommodation loadAccommodation(String id) { Accommodation returnValue = null; if (sB_AccommodationManager == null) { System.out.println("Error in loadAccommodation(): " + ERROR_NULL_REMOTE); return returnValue; } long startTime = 0; if (logging) { log("Calling loadAccommodation(" + id + ")"); startTime = System.currentTimeMillis(); } try { returnValue = sB_AccommodationManager.loadAccommodation(id); if (logging) { long endTime = System.currentTimeMillis(); log("Succeeded: loadAccommodation(" + id + ")"); log("Execution time: " + (endTime - startTime) + " ms."); } } catch(Exception e) { if (logging) { log("Failed: loadAccommodation(" + id + ")"); } e.printStackTrace(); } if (logging) { log("Return value from loadAccommodation(" + id + "): " + returnValue + "."); } return returnValue; } public void removeAccommodation(String id) { if (sB_AccommodationManager == null) { System.out.println("Error in removeAccommodation(): " + ERROR_NULL_REMOTE); return ; } long startTime = 0; if (logging) { log("Calling removeAccommodation(" + id + ")"); startTime = System.currentTimeMillis(); } try { sB_AccommodationManager.removeAccommodation(id); if (logging) { long endTime = System.currentTimeMillis(); log("Succeeded: removeAccommodation(" + id + ")"); log("Execution time: " + (endTime - startTime) + " ms."); } } catch(Exception e) { if (logging) { log("Failed: removeAccommodation(" + id + ")"); } e.printStackTrace(); } } public Accommodation saveAccommodation(Accommodation arecord) { Accommodation returnValue = null; if (sB_AccommodationManager == null) { System.out.println("Error in saveAccommodation(): " + ERROR_NULL_REMOTE); return returnValue; } long startTime = 0; if (logging) { log("Calling saveAccommodation(" + arecord + ")"); startTime = System.currentTimeMillis(); } try { returnValue = sB_AccommodationManager.saveAccommodation(arecord); if (logging) { long endTime = System.currentTimeMillis(); log("Succeeded: saveAccommodation(" + arecord + ")"); log("Execution time: " + (endTime - startTime) + " ms."); } } catch(Exception e) { if (logging) { log("Failed: saveAccommodation(" + arecord + ")"); } e.printStackTrace(); } if (logging) { log("Return value from saveAccommodation(" + arecord + "): " + returnValue + "."); } return returnValue; } public Accommodation addAccommodation(Accommodation arecord) { Accommodation returnValue = null; if (sB_AccommodationManager == null) { System.out.println("Error in addAccommodation(): " + ERROR_NULL_REMOTE); return returnValue; } long startTime = 0; if (logging) { log("Calling addAccommodation(" + arecord + ")"); startTime = System.currentTimeMillis(); } try { returnValue = sB_AccommodationManager.addAccommodation(arecord); if (logging) { long endTime = System.currentTimeMillis(); log("Succeeded: addAccommodation(" + arecord + ")"); log("Execution time: " + (endTime - startTime) + " ms."); } } catch(Exception e) { if (logging) { log("Failed: addAccommodation(" + arecord + ")"); } e.printStackTrace(); } if (logging) { log("Return value from addAccommodation(" + arecord + "): " + returnValue + "."); } return returnValue; } public Collection getAllAccommodation() { Collection returnValue = null; if (sB_AccommodationManager == null) { System.out.println("Error in getAllAccommodation(): " + ERROR_NULL_REMOTE); return returnValue; } long startTime = 0; if (logging) { log("Calling getAllAccommodation()"); startTime = System.currentTimeMillis(); } try { returnValue = sB_AccommodationManager.getAllAccommodation(); if (logging) { long endTime = System.currentTimeMillis(); log("Succeeded: getAllAccommodation()"); log("Execution time: " + (endTime - startTime) + " ms."); } } catch(Exception e) { if (logging) { log("Failed: getAllAccommodation()"); } e.printStackTrace(); } if (logging) { log("Return value from getAllAccommodation(): " + returnValue + "."); } return returnValue; } public Collection getSearchAccommodation(String sql) { Collection returnValue = null; if (sB_AccommodationManager == null) { System.out.println("Error in getSearchAccommodation(): " + ERROR_NULL_REMOTE); return returnValue; } long startTime = 0; if (logging) { log("Calling getSearchAccommodation(" + sql + ")"); startTime = System.currentTimeMillis(); } try { returnValue = sB_AccommodationManager.getSearchAccommodation(sql); if (logging) { long endTime = System.currentTimeMillis(); log("Succeeded: getSearchAccommodation(" + sql + ")"); log("Execution time: " + (endTime - startTime) + " ms."); } } catch(Exception e) { if (logging) { log("Failed: getSearchAccommodation(" + sql + ")"); } e.printStackTrace(); } if (logging) { log("Return value from getSearchAccommodation(" + sql + "): " + returnValue + "."); } return returnValue; } //---------------------------------------------------------------------------- // Utility Methods //---------------------------------------------------------------------------- private void log(String message) { if (message == null) { System.out.println("-- null"); return ; } if (message.length() > MAX_OUTPUT_LINE_LENGTH) { System.out.println("-- " + message.substring(0, MAX_OUTPUT_LINE_LENGTH) + " ..."); } else { System.out.println("-- " + message); } } //Main method public static void main(String[] args) { SB_AccommodationManagerTestClient1 client = new SB_AccommodationManagerTestClient1(); SB_AccommodationManager m = client.create(); Collection record=null; /* try{ record=m.getAllAccommodation(); Iterator i=record.iterator(); while(i.hasNext()){ Accommodation acc=(Accommodation) i.next(); System.out.println(acc.getId()); System.out.println(acc.getCid()); System.out.println(acc.getName()); System.out.println(acc.getIntime()); System.out.println(acc.getLeavetime()); System.out.println(acc.getRoomid()); System.out.println(acc.getPrice()); System.out.println(acc.getPrecharge()); System.out.println(acc.getCharge()); } } catch(Exception e){ e.printStackTrace(); }*/ int count=0; try{ count=m.getlivedays("200607013003"); System.out.println(count); } catch(Exception e){ e.printStackTrace(); } try{ float mg=m.getCost("200607013003"); System.out.println(mg); } catch(Exception e){ e.printStackTrace(); } }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -