# sonthicse/pmqlsvdh architecture

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

- Interactive diagram: https://gitdiagram.com/sonthicse/pmqlsvdh
- Repository: https://github.com/sonthicse/pmqlsvdh

## Overview

##### Project type and purpose
- This is a desktop “full-stack” application built with .NET 9.0 WinForms (PMQLSVDH stands for a university student‐management tool).
- The user interacts via multiple Forms and UserControls (LoginForm, AdminForm, GiangVienForm, ThemSinhVienForm, etc.).
- It persists data in a local SQLite database file (PMQLSVDH_v2.db).

##### File structure
- Top-level project artifact: PMQLSVDH.csproj + Program.cs (application entry point).
- UI layer:
- Forms (e.g., LoginForm.cs, AdminForm.cs, GiangVienForm.cs)
- UserControls (e.g., UserControlSinhVien, UserControlLopHoc, UserControlTaiKhoan, etc.)
- Data layer:
- Local DB file (PMQLSVDH_v2.db)
- Implicit or explicit data-access code in code-behind (no separate “DAL” folder, but likely ADO.NET/SQLite calls inside Forms or in helper classes).
- Build/system files: bin/ and obj/ for compiled outputs, .vs/ for IDE metadata.

##### README
- Contains only the project name; no further architecture details.
- We rely on file names and extensions to infer structure.

##### Detailed breakdown of components
- UI layer:
- LoginForm, AdminForm, GiangVienForm, ThemSinhVienForm, NavigationControl, various UserControls
- Responsibilities: authentication, CRUD operations for students, teachers, classes, etc.
- Business Logic:
- Validation of input, role checks (Admin vs. Teacher)
- Orchestration of data access calls
- Data Access:
- Classes/methods that open SQLite connections, execute SQL commands, map results to objects
- Database:
- PMQLSVDH_v2.db file storing tables for students, teachers, departments, accounts, etc.

##### Final advice
- Don’t over-complicate: even if there’s no strict boundary between logic and data-access files, represent them as separate layers for clarity.
- Flows (e.g., “Login → validate credentials → query Accounts table”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Dependencies
    subgraph "External Dependencies"
        direction TB
        NET[".NET Runtime & WinForms Libraries"]:::external
    end

    %% Entry Point
    Program["Program.cs\n(Application Entry)"]:::entry
    click Program "https://github.com/sonthicse/pmqlsvdh/blob/main/Program.cs"

    %% Presentation Layer
    subgraph "Presentation Layer (WinForms UI)" 
        direction TB
        Login["LoginForm"]:::ui
        click Login "https://github.com/sonthicse/pmqlsvdh/blob/main/LoginForm.cs"
        Admin["AdminForm"]:::ui
        click Admin "https://github.com/sonthicse/pmqlsvdh/blob/main/AdminForm.cs"
        GV["GiangVienForm"]:::ui
        click GV "https://github.com/sonthicse/pmqlsvdh/blob/main/GiangVienForm.cs"
        TS["ThemSinhVienForm"]:::ui
        click TS "https://github.com/sonthicse/pmqlsvdh/blob/main/ThemSinhVienForm.cs"
        Nav["NavigationControl"]:::ui
        click Nav "https://github.com/sonthicse/pmqlsvdh/blob/main/NavigationControl.cs"
        subgraph "UserControls"
            direction TB
            UC_SV["UserControlSinhVien"]:::ui
            click UC_SV "https://github.com/sonthicse/pmqlsvdh/blob/main/UserControlSinhVien.cs"
            UC_LH["UserControlLopHoc"]:::ui
            click UC_LH "https://github.com/sonthicse/pmqlsvdh/blob/main/UserControlLopHoc.cs"
            UC_LHA["UserControlLopHocAdmin"]:::ui
            click UC_LHA "https://github.com/sonthicse/pmqlsvdh/blob/main/UserControlLopHocAdmin.cs"
            UC_GV["UserControlGiangVien"]:::ui
            click UC_GV "https://github.com/sonthicse/pmqlsvdh/blob/main/UserControlGiangVien.cs"
            UC_KH["UserControlKhoa"]:::ui
            click UC_KH "https://github.com/sonthicse/pmqlsvdh/blob/main/UserControlKhoa.cs"
            UC_TK["UserControlTaiKhoan"]:::ui
            click UC_TK "https://github.com/sonthicse/pmqlsvdh/blob/main/UserControlTaiKhoan.cs"
            UC_CD["UserControlCaiDat"]:::ui
            click UC_CD "https://github.com/sonthicse/pmqlsvdh/blob/main/UserControlCaiDat.cs"
            UC_TC["UserControlTrangChu"]:::ui
            click UC_TC "https://github.com/sonthicse/pmqlsvdh/blob/main/UserControlTrangChu.cs"
        end
    end

    %% Business Logic Layer
    BL["Business Logic\n(Validation & Role Checks)"]:::logic

    %% Data Access Layer
    DA["Data Access\n(SQLite ADO.NET Wrapper)"]:::data

    %% Database
    DB["PMQLSVDH_v2.db"]:::db
    click DB "https://github.com/sonthicse/pmqlsvdh/blob/main/PMQLSVDH_v2.db"

    %% Project & Solution Files
    csproj["PMQLSVDH.csproj"]:::project
    click csproj "https://github.com/sonthicse/pmqlsvdh/blob/main/PMQLSVDH.csproj"
    sln["PMQLSVDH.sln"]:::project
    click sln "https://github.com/sonthicse/pmqlsvdh/blob/main/PMQLSVDH.sln"

    %% Flows
    NET --> Program
    Program --> Login
    Login --> BL
    Admin --> BL
    GV --> BL
    TS --> BL
    Nav --> BL
    UC_SV --> BL
    UC_LH --> BL
    UC_LHA --> BL
    UC_GV --> BL
    UC_KH --> BL
    UC_TK --> BL
    UC_CD --> BL
    UC_TC --> BL

    BL --> DA
    DA --> DB

    DB --> DA
    DA --> BL
    BL --> Login
    BL --> Admin

    %% Styles
    classDef external fill:#f9f,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5;
    classDef entry fill:#bbf,stroke:#333,stroke-width:1px;
    classDef ui fill:#cce5ff,stroke:#1f78b4,stroke-width:1px;
    classDef logic fill:#d4edda,stroke:#28a745,stroke-width:1px;
    classDef data fill:#fff3cd,stroke:#ffcd39,stroke-width:1px;
    classDef db fill:#ffe5e5,stroke:#e74c3c,stroke-width:1px,shape:cylinder;
    classDef project fill:#e0e0e0,stroke:#666,stroke-width:1px,stroke-dasharray: 2 2;
```
