# nhuanld17/hotelmanagementsystem architecture

> Architecture diagram of the GitHub repository nhuanld17/hotelmanagementsystem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nhuanld17/hotelmanagementsystem
- Repository: https://github.com/nhuanld17/hotelmanagementsystem

## Overview

##### Project Overview
This is a Java-based hotel management system using Eclipse and MySQL, following a layered architecture pattern (GUI, Controller, BUS (Business Logic), DAO (Data Access), DTO (Data Transfer Objects)).

##### Main Components

A. Presentation Layer (GUI)
- GUI components (Login, Employee, Customer, Bill, Charts)
- User types (Admin/Manager) interaction points

B. Controller Layer
- Controllers between GUI and Business Logic
- Connections to respective GUI components

C. Business Logic Layer (BUS)
- Business services (Account, Employee, HoaDon, KhachHang, Phong)
- Validation and processing logic

D. Data Access Layer (DAO)
- DAO components
- DBConn as a central connection manager

E. Data Transfer Objects (DTO)
- Entity classes (Account, Employee, HoaDon, KhachHang, Phong, Chart)

F. Database
- MySQL database
- Connection to DAO layer through DBConn
- Use a database symbol

**[User Interface Layer]**
- ↓
**[Controller Layer]**
- ↓
**[Business Logic Layer]**
- ↓
**[Data Access Layer]**
- ↓
**[Database Layer]**

##### Key Relationships to Highlight

- User role-based access (Admin vs Manager)
- Flow of data from GUI through layers
- CRUD operations flow
- Reporting and chart generation flow
- Authentication flow through layers

##### Special Features

- PDF generation for invoices
- Excel export functionality
- Chart generation components
- Authentication/Authorization flow
- Revenue calculation and reporting

##### Implementation Details

- Maintain consistent spacing and alignment
- Related components together
- Use standardized UML notation where appropriate

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef gui fill:#b3d9ff,stroke:#333,stroke-width:2px
    classDef controller fill:#90EE90,stroke:#333,stroke-width:2px
    classDef business fill:#ffeb99,stroke:#333,stroke-width:2px
    classDef dao fill:#ffb366,stroke:#333,stroke-width:2px
    classDef dto fill:#e6e6e6,stroke:#333,stroke-width:2px
    classDef database fill:#d9b3ff,stroke:#333,stroke-width:2px
    classDef external fill:#ff9999,stroke:#333,stroke-width:2px

    %% User Types
    Users[Users]
    Admin[Admin]
    Manager[Manager]
    Users --> Admin
    Users --> Manager

    %% GUI Layer
    subgraph GUI
        Login["Login Interface"]:::gui
        EmpGUI["Employee Management"]:::gui
        CustGUI["Customer Management"]:::gui
        BillGUI["Bill Management"]:::gui
        ChartGUI["Charts/Reporting"]:::gui
    end

    %% Controller Layer
    subgraph Controllers
        BillCtrl["Bill Controller"]:::controller
        EmpCtrl["Employee Controller"]:::controller
        CustCtrl["Customer Controller"]:::controller
    end

    %% Business Layer
    subgraph Business
        AccBUS["Account Management"]:::business
        EmpBUS["Employee Management"]:::business
        BillBUS["Bill Management"]:::business
        CustBUS["Customer Management"]:::business
        RoomBUS["Room Management"]:::business
    end

    %% DAO Layer
    subgraph "Data Access"
        DBConn["Database Connection"]:::dao
        AccDAO["Account DAO"]:::dao
        EmpDAO["Employee DAO"]:::dao
        BillDAO["Bill DAO"]:::dao
        CustDAO["Customer DAO"]:::dao
        RoomDAO["Room DAO"]:::dao
    end

    %% DTO Layer
    subgraph "Data Transfer Objects"
        AccDTO["Account"]:::dto
        EmpDTO["Employee"]:::dto
        BillDTO["Bill"]:::dto
        CustDTO["Customer"]:::dto
        RoomDTO["Room"]:::dto
        ChartDTO["Chart"]:::dto
    end

    %% Database
    DB[(MySQL Database)]:::database

    %% External Dependencies
    JGoodies["JGoodies Forms"]:::external

    %% Relationships
    Admin & Manager --> Login
    Login --> AccBUS
    
    EmpGUI --> EmpCtrl
    CustGUI --> CustCtrl
    BillGUI --> BillCtrl
    
    EmpCtrl --> EmpBUS
    CustCtrl --> CustBUS
    BillCtrl --> BillBUS
    
    AccBUS --> AccDAO
    EmpBUS --> EmpDAO
    BillBUS --> BillDAO
    CustBUS --> CustDAO
    RoomBUS --> RoomDAO
    
    AccDAO & EmpDAO & BillDAO & CustDAO & RoomDAO --> DBConn
    DBConn --> DB

    %% Click Events
    click Login "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/GUI/LoginGUI.java"
    click EmpGUI "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/GUI/EmployeeGUI.java"
    click CustGUI "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/GUI/KhachHangGUI.java"
    click BillGUI "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/GUI/BillGUI.java"
    click ChartGUI "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/GUI/ChartGUI.java"
    
    click BillCtrl "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/CONTROLLER/BillController.java"
    click EmpCtrl "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/CONTROLLER/EmployeeController.java"
    click CustCtrl "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/CONTROLLER/KhachHangController.java"
    
    click AccBUS "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/BUS/AccountBUS.java"
    click EmpBUS "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/BUS/EmployeeBUS.java"
    click BillBUS "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/BUS/HoaDonBUS.java"
    click CustBUS "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/BUS/KhachHangBUS.java"
    click RoomBUS "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/BUS/PhongBUS.java"
    
    click DBConn "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DAO/DBConn.java"
    click AccDAO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DAO/AccountDAO.java"
    click EmpDAO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DAO/EmployeeDAO.java"
    click BillDAO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DAO/HoaDonDAO.java"
    click CustDAO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DAO/KhachHangDAO.java"
    click RoomDAO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DAO/PhongDAO.java"
    
    click AccDTO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DTO/Account.java"
    click EmpDTO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DTO/Employee.java"
    click BillDTO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DTO/HoaDon.java"
    click CustDTO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DTO/KhachHang.java"
    click RoomDTO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DTO/Phong.java"
    click ChartDTO "https://github.com/nhuanld17/HotelManagementSystem/blob/main/src/DTO/Chart.java"
    
    click DB "https://github.com/nhuanld17/HotelManagementSystem/blob/main/database.sql"
    click JGoodies "https://github.com/nhuanld17/HotelManagementSystem/blob/main/jgoodies-forms-1.8.0.jar"
```
