Example #1
0
  /**
   * Log employee into system. It can be looped in a main method if the login information is
   * incorrect. Returns true if login is successful.
   *
   * @param employeeId
   * @param password
   */
  public boolean login(int employeeId, String password) {
    Employee e = this.eList.findEmployee(employeeId);
    boolean successful = false;

    try {
      if (eList.checkPassword(employeeId, password)) {
        loggedOnEmployees.addEmployee(eList.findEmployee(employeeId));
        successful = true;
      }
    } catch (NullPointerException ex) {
      System.out.println("Error: employeeID not found.");
    }
    return successful;
  }