# leyen1403/phanmemquanlycuahangbangaubong architecture

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

- Interactive diagram: https://gitdiagram.com/leyen1403/phanmemquanlycuahangbangaubong
- Repository: https://github.com/leyen1403/phanmemquanlycuahangbangaubong

## Overview

##### Project Type and Purpose
- This is a Windows-based, N-tier desktop application (“PhanMemQuanLyCuaHangBanGauBong”) for managing a plush-toy store’s business processes (orders, invoices, inventory, returns, reports).
- It uses .NET Framework 4.8 and DevExpress for UI, Microsoft Office Interop for report export (Excel/Word).

##### File-Structure Analysis
- Top-level solution “QuanLyBanGauBong.sln” contains five main projects:
- GUI – WinForms presentation layer (forms & views)
- UC – reusable UserControl library used by GUI
- BLL – Business Logic Layer (validation, business rules)
- DAL – Data Access Layer (CRUD operations against relational DB)
- DTO – Data Transfer Objects (entities & view models)
- Each project has standard bin/obj folders, config files, and references to DevExpress & Interop packages.
- No direct SQL scripts are in the tree (assume SQL Server / other RDBMS is configured via connection strings in App.config).

##### README Insights
- Relies on file structure and naming conventions to infer layering.

##### Key Details to Capture
- All major BLL/DAL pairs (e.g., DonDatHangBLL ↔ DonDatHangDAL)
- The DTO project as the shared model between layers
- UC library feeding into GUI forms
- External reporting/export pathways
- Configuration files (App.config) feeding DB connection info

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        GUIApp["GUI Application (WinForms)"]:::presentation
        UC["UserControl Library (UC)"]:::presentation
    end

    %% Business Layer
    subgraph "Business Layer"
        BLL["BLL (DonDatHangBLL, HoaDonBanHangBLL, KhachHangBLL, ...)"]:::business
    end

    %% Data Layer
    subgraph "Data Layer"
        DAL["DAL (DonDatHangDAL, HoaDonBanHangDAL, KhachHangDAL, ...)"]:::data
    end

    %% Data Model
    DTO["DTO (HoaDonDTO, SanPhamDTO, PhieuDoiTraDTO, ...)"]:::dto

    %% Persistence
    DB[(Relational Database)]:::database

    %% External Services
    subgraph "External Services"
        DevExpress["DevExpress UI Components"]:::external
        OfficeExcel["Office Interop Excel"]:::external
        OfficeWord["Office Interop Word"]:::external
    end

    %% Configuration & Solution
    Config["App.config (DB Connection)"]:::config
    Solution["QuanLyBanGauBong.sln"]:::config

    %% Relationships
    GUIApp --> UC
    GUIApp -->|calls| BLL
    UC --> GUIApp
    BLL -->|uses DTO| DTO
    BLL -->|calls| DAL
    DAL -->|uses DTO| DTO
    DAL -->|queries| DB
    DB -->|returns data| DAL
    BLL -->|returns DTOs| GUIApp
    GUIApp -->|uses| DevExpress
    GUIApp -->|export/report| OfficeExcel
    GUIApp -->|export/report| OfficeWord
    BLL -->|export/report| OfficeExcel
    BLL -->|export/report| OfficeWord
    Config --> DB
    Config --> GUIApp
    Solution --> GUIApp
    Solution --> UC
    Solution --> BLL
    Solution --> DAL
    Solution --> DTO

    %% Click Events
    click GUIApp "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/GUI/Program.cs"
    click GUIApp "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/GUI/frm_Main.cs"
    click GUIApp "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/GUI/frm_Main.Designer.cs"
    click GUIApp "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/GUI/GUI.csproj"
    click GUIApp "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/GUI/App.config"
    click UC "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/UC/ProductItem.cs"
    click UC "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/UC/ProductItem.Designer.cs"
    click UC "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/UC/UC.csproj"
    click BLL "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/BLL/BLL.csproj"
    click BLL "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/BLL/HoaDonBanHangBLL.cs"
    click BLL "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/BLL/DonDatHangBLL.cs"
    click BLL "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/BLL/KhachHangBLL.cs"
    click DAL "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/DAL/DAL.csproj"
    click DAL "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/DAL/HoaDonBanHangDAL.cs"
    click DAL "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/DAL/DonDatHangDAL.cs"
    click DAL "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/DAL/KhachHangDAL.cs"
    click DTO "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/DTO/DTO.csproj"
    click DTO "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/DTO/HoaDonDTO.cs"
    click DTO "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/DTO/SanPhamDTO.cs"
    click DTO "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/DTO/PhieuDoiTraDTO.cs"
    click DevExpress "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/GUI/bin/Debug/DevExpress.XtraBars.v22.2.xml"
    click OfficeExcel "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/tree/main/packages/Microsoft.Office.Interop.Excel.15.0.4795.1001/lib"
    click OfficeWord "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/tree/main/packages/Microsoft.Office.Interop.Word.15.0.4797.1004/lib"
    click Config "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/GUI/App.config"
    click Solution "https://github.com/leyen1403/phanmemquanlycuahangbangaubong/blob/main/QuanLyBanGauBong.sln"

    %% Styles
    classDef presentation fill:#c2f0c2,stroke:#2d862d,color:#000;
    classDef business fill:#c2dafc,stroke:#1f4e78,color:#000;
    classDef data fill:#fce4d6,stroke:#b65e20,color:#000;
    classDef dto fill:#e7e6e6,stroke:#6e6e6e,color:#000;
    classDef database fill:#cccccc,stroke:#333333,color:#000;
    classDef external fill:#f0f0f0,stroke-dasharray:5 5,stroke:#888888,color:#000;
    classDef config fill:#fff2cc,stroke:#b07d3b,color:#000;
```
