⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sb_accommodationmanagertestclient1.java~9~

📁 用j2ee开发的一个旅店管理系统
💻 JAVA~9~
📖 第 1 页 / 共 2 页
字号:
    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{     record=m.getAccInfo("dsfg","3001");     Iterator i=record.iterator();      while(i.hasNext()){          count=count+1;          Accommodation acc=(Accommodation) i.next();          System.out.println(acc.getId());          System.out.println(acc.getCid());          System.out.println(acc.getName());          System.out.println(acc.getRoomid());          System.out.println(acc.getIntime());          System.out.println(acc.getLeavetime());          System.out.println(acc.getPrice());          System.out.println(acc.getPrecharge());          System.out.println(acc.getCharge());      }         System.out.println(count);   }   catch(Exception e){     e.printStackTrace();   }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -