# nguyen06-cse/quan-li-dang-ky-hoc-phan architecture

> Architecture diagram of the GitHub repository nguyen06-cse/quan-li-dang-ky-hoc-phan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nguyen06-cse/quan-li-dang-ky-hoc-phan
- Repository: https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan

## Overview

QuanLyDKHP is a .NET/Avalonia desktop system for academic administration: staff manage student and course records, open semesters and class sections, process course registrations and tuition, then produce reports or exchange data through Excel/PDF. The sampled registration service validates requests, persists enrollment and recalculates tuition; the import implementation also saves imported records and recalculates tuition. The README documents the broader feature set and Clean Architecture layers. Some UI-to-service and unsampled subsystem wiring is not shown in the excerpts, so those connections are kept conservative.

Main entry points: [`src/QuanLyDKHP.Infrastructure/Data/AppDbContext.cs`](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Infrastructure/Data/AppDbContext.cs) (PostgreSQL context), [`src/QuanLyDKHP.Services/DangKyHocPhanService.cs`](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/DangKyHocPhanService.cs) (Registration rules), [`src/QuanLyDKHP.App/App.axaml.cs`](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/App.axaml.cs) (Desktop entry), [`src/QuanLyDKHP.Infrastructure/Repositories`](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/tree/main/src/QuanLyDKHP.Infrastructure/Repositories) (Data repositories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop application"]
  node_app["Desktop entry<br/>[App.axaml.cs]"]
  node_login["Login view model<br/>[LoginViewModel.cs]"]
  node_main["Main window"]
end

subgraph group_academics["Academic records"]
  node_student_ui["Student management"]
  node_course_ui["Course management<br/>[MonHocViewModel.cs]"]
  node_semester_ui["Semester sections"]
  node_student_service["Student service<br/>[SinhVienService.cs]"]
  node_course_service["Course service<br/>[MonHocService.cs]"]
  node_semester_services["Semester and section services"]
end

subgraph group_enrollment["Enrollment and fees"]
  node_registration_ui["Registration screen"]
  node_registration_service["Registration rules"]
  node_fee_service["Tuition calculation<br/>[HocPhiService.cs]"]
  node_config_service["System configuration<br/>[CauHinhService.cs]"]
end

subgraph group_reporting["Reporting and exchange"]
  node_import_ui["Excel import screen"]
  node_importer["Excel import"]
  node_reports["Reports and statistics"]
  node_exports["Excel and PDF export<br/>[Export]"]
end

subgraph group_data["Business and persistence"]
  node_auth["Authentication<br/>[AuthService.cs]"]
  node_repositories["Data repositories<br/>[Repositories]"]
  node_database[("PostgreSQL context<br/>[AppDbContext.cs]")]
end

node_operator(("Staff user"))
node_postgres[("PostgreSQL")]

node_operator -->|"starts"| node_app
node_app -->|"opens login"| node_login
node_login -->|"authenticates"| node_auth
node_auth -->|"looks up user"| node_repositories
node_repositories -->|"queries"| node_database
node_app -->|"opens after login"| node_main
node_registration_service -->|"reads and writes"| node_repositories
node_registration_service -->|"checks limits"| node_config_service
node_registration_service -->|"recalculates tuition"| node_fee_service
node_importer -->|"saves imported records"| node_database
node_importer -->|"recalculates tuition"| node_fee_service
node_reports -->|"queries records"| node_database
node_exports -->|"provides files"| node_operator
node_database -->|"persists data"| node_postgres

click node_app "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/App.axaml.cs"
click node_login "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/LoginViewModel.cs"
click node_main "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/MainWindowViewModel.cs"
click node_student_ui "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/SinhVienViewModel.cs"
click node_course_ui "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/MonHocViewModel.cs"
click node_semester_ui "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/HocKyLopHocPhanViewModel.cs"
click node_student_service "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/SinhVienService.cs"
click node_course_service "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/MonHocService.cs"
click node_semester_services "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/tree/main/src/QuanLyDKHP.Services"
click node_registration_ui "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/DangKyHocPhanViewModel.cs"
click node_registration_service "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/DangKyHocPhanService.cs"
click node_fee_service "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/HocPhiService.cs"
click node_config_service "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/CauHinhService.cs"
click node_import_ui "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/ImportExcelViewModel.cs"
click node_importer "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Infrastructure/Repositories/ImportExcelRepository.cs"
click node_reports "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Infrastructure/Repositories/BaoCaoRepository.cs"
click node_exports "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/tree/main/src/QuanLyDKHP.Infrastructure/Export"
click node_auth "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/AuthService.cs"
click node_repositories "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/tree/main/src/QuanLyDKHP.Infrastructure/Repositories"
click node_database "https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Infrastructure/Data/AppDbContext.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_login,node_main,node_operator toneBlue
class node_student_ui,node_course_ui,node_semester_ui,node_student_service,node_course_service,node_semester_services,node_postgres toneAmber
class node_registration_ui,node_registration_service,node_fee_service,node_config_service toneMint
class node_import_ui,node_importer,node_reports,node_exports toneRose
class node_auth,node_repositories,node_database toneIndigo
```

## Components

### Desktop application

- [Desktop entry](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/App.axaml.cs): `src/QuanLyDKHP.App/App.axaml.cs`
- [Login view model](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/LoginViewModel.cs): `src/QuanLyDKHP.App/ViewModels/LoginViewModel.cs`
- [Main window](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/MainWindowViewModel.cs): `src/QuanLyDKHP.App/ViewModels/MainWindowViewModel.cs`

### Academic records

- [Student management](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/SinhVienViewModel.cs): `src/QuanLyDKHP.App/ViewModels/SinhVienViewModel.cs`
- [Course management](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/MonHocViewModel.cs): `src/QuanLyDKHP.App/ViewModels/MonHocViewModel.cs`
- [Semester sections](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/HocKyLopHocPhanViewModel.cs): `src/QuanLyDKHP.App/ViewModels/HocKyLopHocPhanViewModel.cs`
- [Student service](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/SinhVienService.cs): `src/QuanLyDKHP.Services/SinhVienService.cs`
- [Course service](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/MonHocService.cs): `src/QuanLyDKHP.Services/MonHocService.cs`
- [Semester and section services](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/tree/main/src/QuanLyDKHP.Services): `src/QuanLyDKHP.Services`

### Enrollment and fees

- [Registration screen](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/DangKyHocPhanViewModel.cs): `src/QuanLyDKHP.App/ViewModels/DangKyHocPhanViewModel.cs`
- [Registration rules](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/DangKyHocPhanService.cs): `src/QuanLyDKHP.Services/DangKyHocPhanService.cs`
- [Tuition calculation](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/HocPhiService.cs): `src/QuanLyDKHP.Services/HocPhiService.cs`
- [System configuration](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/CauHinhService.cs): `src/QuanLyDKHP.Services/CauHinhService.cs`

### Reporting and exchange

- [Excel import screen](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.App/ViewModels/ImportExcelViewModel.cs): `src/QuanLyDKHP.App/ViewModels/ImportExcelViewModel.cs`
- [Excel import](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Infrastructure/Repositories/ImportExcelRepository.cs): `src/QuanLyDKHP.Infrastructure/Repositories/ImportExcelRepository.cs`
- [Reports and statistics](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Infrastructure/Repositories/BaoCaoRepository.cs): `src/QuanLyDKHP.Infrastructure/Repositories/BaoCaoRepository.cs`
- [Excel and PDF export](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/tree/main/src/QuanLyDKHP.Infrastructure/Export): `src/QuanLyDKHP.Infrastructure/Export`

### Business and persistence

- [Authentication](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Services/AuthService.cs): `src/QuanLyDKHP.Services/AuthService.cs`
- [Data repositories](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/tree/main/src/QuanLyDKHP.Infrastructure/Repositories): `src/QuanLyDKHP.Infrastructure/Repositories`
- [PostgreSQL context](https://github.com/nguyen06-cse/quan-li-dang-ky-hoc-phan/blob/main/src/QuanLyDKHP.Infrastructure/Data/AppDbContext.cs): `src/QuanLyDKHP.Infrastructure/Data/AppDbContext.cs`

### Other components

- **Staff user**
- **PostgreSQL**

## Connections

- Staff user → Desktop entry: starts
- Desktop entry → Login view model: opens login
- Login view model → Authentication: authenticates
- Authentication → Data repositories: looks up user
- Data repositories → PostgreSQL context: queries
- Desktop entry → Main window: opens after login
- Registration rules → Data repositories: reads and writes
- Registration rules → System configuration: checks limits
- Registration rules → Tuition calculation: recalculates tuition
- Excel import → PostgreSQL context: saves imported records
- Excel import → Tuition calculation: recalculates tuition
- Reports and statistics → PostgreSQL context: queries records
- Excel and PDF export → Staff user: provides files
- PostgreSQL context → PostgreSQL: persists data
