# andrewnguyen-05/qlnh_wf architecture

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

- Interactive diagram: https://gitdiagram.com/andrewnguyen-05/qlnh_wf
- Repository: https://github.com/andrewnguyen-05/qlnh_wf

## Overview

##### Main Components
- Data Access Layer (DAL): Located in the DAO directory, these files (e.g., AccountDAO.cs, BillDAO.cs, FoodDAO.cs, TableDAO.cs, etc.) handle interactions with the database. The DataProvider.cs file acts as a central point to connect and execute SQL queries.
- Data Transfer Objects (DTO): Contained in the DTO folder. Files such as Account.cs, Bill.cs, Food.cs, etc. define the underlying data models passed between layers.
- Database: The backend database (SQL Server) is represented by the Data.sql file which creates a database called “QLNH” along with tables and seed data. Include this as the persistent storage backend.
- Configuration and Resources: The App.config file manages configuration settings (like connection strings). In addition, Resource files (images, screenshots, logos) and packages.config have a role in defining external dependencies and branding.

##### Diagramming Relationships and Interactions
- Data Access Layer as a mediator between the application's UI and the database. Show arrowed connections from DAO components to the Database.
- A configuration element (App.config) linked to the DataProvider, indicating how connection strings and other settings are retrieved.
- You may add a “Dependencies/External Libraries” section noting the use of .NET Framework, WinForms, ADO.NET, and SQL Server technologies.

##### Architectural Patterns and Design Principles
- Layered/MVC-like Structure: While the project doesn’t strictly use MVC, it reflects a separation of concerns where the presentation (forms), data access (DAO), and data model (DTO) are segregated.
- Loose coupling: The use of DTO objects helps decouple the database schema from business logic.
- Maintainability: The structure with separate folders for DAO and DTO implies an emphasis on a modular design.

##### Relevant Technologies and Frameworks
- .NET Framework and C#: Core platform.
- WinForms: For building the interactive desktop UI.
- ADO.NET: For data access through classes in the DAO.
- SQL Server: As the database backend created using the provided Data.sql script.
- NuGet: For managing external packages (as noted in the README).

##### Additional Details
- Optionally, include a sub-section that outlines typical user workflows (e.g., login, place order, process payment) to further clarify how components interact during runtime.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "UI/Presentation (WinForms)"
        UI["UI/Presentation (WinForms)"]:::ui
    end

    subgraph "Data Access Layer"
        DAO["DAO (Business Logic, ADO.NET)"]:::dao
        DP["DataProvider (SQL Connection)"]:::dao
    end

    subgraph "Business Data Models"
        DTO["DTO (Data Models)"]:::dto
    end

    subgraph "Database"
        DB(["Database (SQL Server)"]):::db
    end

    subgraph "Configuration & Resources"
        CONFIG["Configuration & Resources (App.config, Resources, packages.config)"]:::config
    end

    subgraph "External Dependencies"
        EXT["External Dependencies (.NET, WinForms, ADO.NET, SQL Server, NuGet)"]:::ext
    end

    UI -->|"triggers"| DAO
    DAO -->|"calls"| DP
    DP -->|"executesQueries"| DB
    CONFIG -->|"providesConfig"| DP
    DAO -->|"transfersData"| DTO
    DTO -->|"transfersData"| DAO
    EXT --> UI
    EXT --> DAO
    EXT --> DB

    click UI "https://github.com/andrewnguyen-05/qlnh_wf/tree/master/QLNH_Winform/Forms"
    click UI "https://github.com/andrewnguyen-05/qlnh_wf/blob/master/QLNH_Winform/Form1.cs"
    click UI "https://github.com/andrewnguyen-05/qlnh_wf/blob/master/QLNH_Winform/FoodCard.cs"
    click DAO "https://github.com/andrewnguyen-05/qlnh_wf/tree/master/QLNH_Winform/DAO"
    click DTO "https://github.com/andrewnguyen-05/qlnh_wf/tree/master/QLNH_Winform/DTO"
    click DB "https://github.com/andrewnguyen-05/qlnh_wf/blob/master/Data.sql"
    click CONFIG "https://github.com/andrewnguyen-05/qlnh_wf/blob/master/QLNH_Winform/App.config"
    click CONFIG "https://github.com/andrewnguyen-05/qlnh_wf/tree/master/QLNH_Winform/Resources"
    click CONFIG "https://github.com/andrewnguyen-05/qlnh_wf/blob/master/QLNH_Winform/packages.config"

    classDef ui fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef dao fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef dto fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef config fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef db fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef ext fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
