# trgchinhh/quanlysinhvien-sqlserver architecture

> Architecture diagram of the GitHub repository trgchinhh/quanlysinhvien-sqlserver, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/trgchinhh/quanlysinhvien-sqlserver
- Repository: https://github.com/trgchinhh/quanlysinhvien-sqlserver

## Overview

A Vietnamese console application for instructors to register or sign in, then manage students in their assigned class. The workflow is driven by Program.cs: instructor authentication opens the student-management menu, whose services handle CRUD, filtering, sorting, and statistics against SQL Server. Registration also manages classes; models and helpers support validation, password hashing, and console presentation. Source excerpts establish the main calls and database operations; SQL schema details and some service behavior are not fully shown.

Main entry points: [`Services/QuanLyGiangVien.cs`](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Services/QuanLyGiangVien.cs) (Instructor accounts), [`Program.cs`](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Program.cs) (Menu and routing), [`Services/QuanLySinhVien.cs`](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Services/QuanLySinhVien.cs) (Student operations), [`Data/Ketnoidulieu.cs`](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Data/Ketnoidulieu.cs) (SQL data access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Console workflow"]
  node_program["Menu and routing<br/>[Program.cs]"]
  node_console_helpers["Menu helpers<br/>[HamPhuProgram.cs]"]
end

subgraph group_instructors["Instructor and class"]
  node_instructor_service["Instructor accounts<br/>[QuanLyGiangVien.cs]"]
  node_instructor_helpers["Instructor prompts"]
end

subgraph group_students["Student management"]
  node_student_service["Student operations<br/>[QuanLySinhVien.cs]"]
  node_student_helpers["Student helpers"]
end

subgraph group_persistence["SQL persistence"]
  node_database_access["SQL data access<br/>[Ketnoidulieu.cs]"]
  node_sql_server[("SQL Server")]
end

subgraph group_shared["Models and presentation"]
  node_instructor_model["Instructor model<br/>[GiangVien.cs]"]
  node_class_model["Class model<br/>[Lop.cs]"]
  node_student_model["Student model<br/>[SinhVien.cs]"]
  node_sha256["Password hashing<br/>[Sha256.cs]"]
  node_colors["Console colors<br/>[Mau.cs]"]
end

node_instructor(("Instructor"))

node_instructor -->|"uses"| node_program
node_program -->|"routes login"| node_instructor_service
node_program -->|"routes registration"| node_instructor_service
node_program -->|"lists accounts"| node_instructor_service
node_instructor_service -->|"opens student menu"| node_student_service
node_program -->|"dispatches menu actions"| node_student_service
node_program -->|"selects menu color"| node_console_helpers
node_program -->|"renders instructor header"| node_instructor_helpers
node_instructor_service -->|"prompts credentials"| node_instructor_helpers
node_instructor_service -->|"queries and writes"| node_database_access
node_instructor_service -->|"hashes login password"| node_sha256
node_instructor_service -->|"creates accounts"| node_instructor_model
node_instructor_service -->|"creates classes"| node_class_model
node_instructor_model -->|"hashes assigned password"| node_sha256
node_student_service -->|"loads and changes students"| node_database_access
node_student_service -->|"collects student input"| node_student_model
node_student_service -->|"filters and sorts"| node_student_helpers
node_database_access -->|"constructs student records"| node_student_model
node_database_access -->|"constructs instructor records"| node_instructor_model
node_database_access -->|"constructs class records"| node_class_model
node_database_access -->|"executes SQL"| node_sql_server
node_student_model -->|"formats warnings"| node_colors
node_instructor_model -->|"formats instructor display"| node_colors
node_instructor_service -->|"reports outcomes"| node_colors
node_student_service -->|"reports outcomes"| node_colors
node_console_helpers -->|"uses color choices"| node_colors

click node_program "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Program.cs"
click node_instructor_service "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Services/QuanLyGiangVien.cs"
click node_instructor_helpers "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Utils/HamPhuQuanLyGiangVien.cs"
click node_instructor_model "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Models/GiangVien.cs"
click node_class_model "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Models/Lop.cs"
click node_student_service "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Services/QuanLySinhVien.cs"
click node_student_helpers "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Utils/HamPhuQuanLySinhVien.cs"
click node_student_model "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Models/SinhVien.cs"
click node_database_access "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Data/Ketnoidulieu.cs"
click node_sha256 "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Sha256/Sha256.cs"
click node_console_helpers "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Utils/HamPhuProgram.cs"
click node_colors "https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Color/Mau.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_program,node_console_helpers toneBlue
class node_instructor_service,node_instructor_helpers toneAmber
class node_student_service,node_student_helpers toneMint
class node_database_access,node_sql_server toneRose
class node_instructor_model,node_class_model,node_student_model,node_sha256,node_colors,node_instructor toneIndigo
```

## Components

### Console workflow

- [Menu and routing](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Program.cs): `Program.cs`
- [Menu helpers](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Utils/HamPhuProgram.cs): `Utils/HamPhuProgram.cs`

### Instructor and class

- [Instructor accounts](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Services/QuanLyGiangVien.cs): `Services/QuanLyGiangVien.cs`
- [Instructor prompts](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Utils/HamPhuQuanLyGiangVien.cs): `Utils/HamPhuQuanLyGiangVien.cs`

### Student management

- [Student operations](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Services/QuanLySinhVien.cs): `Services/QuanLySinhVien.cs`
- [Student helpers](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Utils/HamPhuQuanLySinhVien.cs): `Utils/HamPhuQuanLySinhVien.cs`

### SQL persistence

- [SQL data access](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Data/Ketnoidulieu.cs): `Data/Ketnoidulieu.cs`
- **SQL Server**

### Models and presentation

- [Instructor model](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Models/GiangVien.cs): `Models/GiangVien.cs`
- [Class model](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Models/Lop.cs): `Models/Lop.cs`
- [Student model](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Models/SinhVien.cs): `Models/SinhVien.cs`
- [Password hashing](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Sha256/Sha256.cs): `Sha256/Sha256.cs`
- [Console colors](https://github.com/trgchinhh/quanlysinhvien-sqlserver/blob/main/Color/Mau.cs): `Color/Mau.cs`

### Other components

- **Instructor**

## Connections

- Instructor → Menu and routing: uses (evidence: `Program.cs`)
- Menu and routing → Instructor accounts: routes login (evidence: `Program.cs`)
- Menu and routing → Instructor accounts: routes registration (evidence: `Program.cs`)
- Menu and routing → Instructor accounts: lists accounts (evidence: `Program.cs`)
- Instructor accounts → Student operations: opens student menu (evidence: `Program.cs`)
- Menu and routing → Student operations: dispatches menu actions (evidence: `Program.cs`)
- Menu and routing → Menu helpers: selects menu color (evidence: `Program.cs`)
- Menu and routing → Instructor prompts: renders instructor header (evidence: `Program.cs`)
- Instructor accounts → Instructor prompts: prompts credentials (evidence: `Services/QuanLyGiangVien.cs`)
- Instructor accounts → SQL data access: queries and writes (evidence: `Services/QuanLyGiangVien.cs`)
- Instructor accounts → Password hashing: hashes login password (evidence: `Services/QuanLyGiangVien.cs`)
- Instructor accounts → Instructor model: creates accounts (evidence: `Services/QuanLyGiangVien.cs`)
- Instructor accounts → Class model: creates classes (evidence: `Services/QuanLyGiangVien.cs`)
- Instructor model → Password hashing: hashes assigned password (evidence: `Models/GiangVien.cs`)
- Student operations → SQL data access: loads and changes students (evidence: `Services/QuanLySinhVien.cs`)
- Student operations → Student model: collects student input (evidence: `Services/QuanLySinhVien.cs`)
- Student operations → Student helpers: filters and sorts (evidence: `Services/QuanLySinhVien.cs`)
- SQL data access → Student model: constructs student records (evidence: `Data/Ketnoidulieu.cs`)
- SQL data access → Instructor model: constructs instructor records (evidence: `Data/Ketnoidulieu.cs`)
- SQL data access → Class model: constructs class records (evidence: `Data/Ketnoidulieu.cs`)
- SQL data access → SQL Server: executes SQL (evidence: `Data/Ketnoidulieu.cs`)
- Student model → Console colors: formats warnings (evidence: `Models/SinhVien.cs`)
- Instructor model → Console colors: formats instructor display (evidence: `Models/GiangVien.cs`)
- Instructor accounts → Console colors: reports outcomes (evidence: `Services/QuanLyGiangVien.cs`)
- Student operations → Console colors: reports outcomes (evidence: `Services/QuanLySinhVien.cs`)
- Menu helpers → Console colors: uses color choices (evidence: `Utils/HamPhuProgram.cs`)
