How lmtvinh/doanquanlycuahangsach works
Main Components
• User Interface (Presentation) Layer:
• Represented primarily by the “giaodienchuan” package and further detailed in the model/FrontEnd directory.
• Comprises various forms (e.g., LoginForm, BanHangForm, QuanLySanPhamForm) and visual elements (e.g., NavBar, MyButton, image resources).
• Business Logic Layer:
• Found in the “BUS” subpackages within model/BackEnd.
• Contains classes like QuanLyHoaDonBUS, QuanLyKhachHangBUS, etc., that enforce business rules and application logic.
• Data Access Layer:
• Represented by the “DAO” packages, responsible for interacting with the database via classes (e.g., QuanLyChiTietHoaDonDAO.java).
• Includes a dedicated DB connector (src/giaodienchuan/model/BackEnd/ConnectionDB/ConnectionDB.java) that abstracts the database connectivity.
• Data Model / DTOs:
• Comprised of the “DTO” subpackages. They serve as data carriers between layers.
• External Libraries and Utilities:
• The “lib” folder includes various JAR files for additional functionalities – for example, LGoodDatePicker for date picking, POI for Excel processing, iText for PDF generation, and the MySQL connector for DB connectivity.
• Additional utilities exist under modules like WorkWithExcel, WritePDF, and ReadWriteFile.
• Database:
• Shown via the “QuanLyCuaHangSach.sql” file – indicating a MySQL (or similar) database that stores the persistent data.
Relationships and Interactions
• UI (FrontEnd forms and components) interacts directly with the Business Logic (BUS) layer to process user actions (e.g., creating an invoice, managing customers).
• The Business Logic layer validates and orchestrates the operations by invoking DAO methods to retrieve or update data.
• DAO classes interact with the database using connection settings defined in the ConnectionDB component.
• The front-end may also include auxiliary functions such as printing/exporting through utilities (Excel, PDF) that integrate with external libraries.
Architectural Patterns and Design Principles
• MVC or Layered Architecture: Separation of UI, Business Logic, and Data Access promotes maintainability and modularity.
• Use of DTOs to decouple the internal data structure from presentation details.
• Utilization of utility classes for specialized tasks (file read/write, Excel, PDF) adds a service-like component to the overall design.
• The naming conventions (QuanLy – “management”) suggest domain-driven design focusing on distinct business entities such as HoaDon (Invoice), KhachHang (Customer), SanPham (Product), etc.