Package com.manager

Class DB2024TEAM07_UserManager

java.lang.Object
com.manager.DB2024TEAM07_UserManager

public class DB2024TEAM07_UserManager extends Object
This class manages user functionalities in the E-MATEASY application. It provides methods for user login, logout, registration, information update, and retrieval of user information for both general users and managers.
  • Field Details

  • Constructor Details

    • DB2024TEAM07_UserManager

      public DB2024TEAM07_UserManager(DB2024TEAM07_UserDAO userDAO)
      Constructor that takes a DB2024TEAM07_UserDAO object as input.
      Parameters:
      userDAO - a DB2024TEAM07_UserDAO object for interacting with the user data access layer
  • Method Details

    • login

      public boolean login(String username, String password)
      Attempts to log in a user with the provided username and password.
      Parameters:
      username - the username of the user trying to log in
      password - the password of the user trying to log in
      Returns:
      true if the login is successful, false otherwise
    • logout

      public void logout()
      Logs out the currently logged in user by setting loggedInUser to null.
    • addUser

      public boolean addUser(DB2024TEAM07_User user)
      Adds a new user to the database.
      Parameters:
      user - a DB2024TEAM07_User object representing the new user
      Returns:
      true if the user is added successfully, false otherwise
    • showMyInfo

      public static void showMyInfo()
      Displays the information of the currently logged in user.
    • searchOtherUser

      public static void searchOtherUser(Scanner scanner)
      Allows users to search for another user by ID.
      Parameters:
      scanner - a Scanner object to read user input
    • deleteAccount

      public static void deleteAccount(Scanner scanner)
      Allows users to delete their account after confirmation.
      Parameters:
      scanner - a Scanner object to read user input
    • update

      public static void update(Scanner scanner)
      Allows users to update their information.
      Parameters:
      scanner - a Scanner object to read user input
    • displayAllUsers

      public static void displayAllUsers()
      Displays a list of all users in the system.
    • addAccountByManager

      public void addAccountByManager(Scanner scanner)
      Allows managers to add new users.
      Parameters:
      scanner - a Scanner object to read user input
    • updateAccountByManager

      public void updateAccountByManager(Scanner scanner)
      Allows managers to update existing user information.
      Parameters:
      scanner - a Scanner object to read user input
    • searchAccountByManager

      public void searchAccountByManager(Scanner scanner)
      Allows managers to search for users by ID.
      Parameters:
      scanner - a Scanner object to read user input
    • deleteAccountByManager

      public void deleteAccountByManager(Scanner scanner)
      Allows managers to delete users.
      Parameters:
      scanner - a Scanner object to read user input