# gumiho0812/qlcuahangthucung architecture

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

- Interactive diagram: https://gitdiagram.com/gumiho0812/qlcuahangthucung
- Repository: https://github.com/gumiho0812/qlcuahangthucung

## Overview

QLCuaHangThuCung is a WPF pet-shop management application. The visible workflow is staff/admin login, role selection, then access to role-specific screens; staff can manage customers and assemble and confirm invoices from product, pet, and service items. Admin and employee permissions cover broader catalog, employee, promotion, service, invoice, dashboard, and reporting capabilities. Source excerpts confirm several direct SQL operations, but do not establish all screen-to-view-model bindings or unsampled feature wiring.

Main entry points: [`Views/Admin/AdminView.xaml.cs`](https://github.com/gumiho0812/qlcuahangthucung/blob/master/Views/Admin/AdminView.xaml.cs) (Admin workspace), [`ViewModels/Sercurity/Login_Viewmodel.cs`](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Sercurity/Login_Viewmodel.cs) (Login handler), [`ViewModels/NhanVien/NhanVien_BanHang_ViewModel.cs`](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/NhanVien/NhanVien_BanHang_ViewModel.cs) (Sales and invoicing), [`ViewModels/NhanVien/NhanVien_QLKhachHang_ViewModel.cs`](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/NhanVien/NhanVien_QLKhachHang_ViewModel.cs) (Customer management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and roles"]
  node_loginview["Login screen<br/>[Login_View.xaml.cs]"]
  node_loginvm["Login handler<br/>[Login_Viewmodel.cs]"]
  node_roles["Role permissions<br/>[RoleManager.cs]"]
end

subgraph group_staff["Staff operations"]
  node_staffshell["Staff workspace"]
  node_staffvm["Staff workspace model"]
  node_sales["Sales and invoicing"]
  node_customers["Customer management"]
  node_customerview["Customer screen"]
end

subgraph group_admin["Administration"]
  node_adminview["Admin workspace<br/>[AdminView.xaml.cs]"]
  node_adminhome["Admin dashboard"]
  node_admincustomers["Customer administration"]
  node_adminstaff["Employee administration"]
  node_admininvoices["Invoice administration"]
  node_admininvoiceinfo["Invoice details"]
  node_adminproducts["Product administration"]
  node_adminoverview["Admin reporting"]
end

subgraph group_data["Data layer"]
  node_dbhelper["SQL access helper<br/>[DatabaseHelper.cs]"]
  node_customerdata["Customer model<br/>[KhachHang.cs]"]
  node_invoicedata["Invoice model<br/>[HoaDon.cs]"]
end

node_user(("Operator"))
node_sql[("SQL Server")]

node_user -->|"enters credentials"| node_loginview
node_loginview -->|"binds input"| node_loginvm
node_loginvm -->|"gets connection"| node_dbhelper
node_loginvm -->|"authenticates"| node_sql
node_loginvm -->|"sets signed-in user"| node_roles
node_loginvm -->|"opens admin"| node_adminview
node_loginvm -->|"opens staff"| node_staffshell
node_staffshell -->|"creates model"| node_staffvm
node_staffvm -.->|"feature scope"| node_sales
node_staffvm -.->|"feature scope"| node_customers
node_customers -->|"gets connection"| node_dbhelper
node_customers -->|"reads and writes"| node_sql
node_customers -->|"populates"| node_customerdata
node_sales -->|"checks permission"| node_roles
node_sales -->|"gets connection"| node_dbhelper
node_sales -->|"loads and saves invoices"| node_sql
node_sales -.->|"uses invoice data"| node_invoicedata
node_admincustomers -->|"gets connection"| node_dbhelper
node_admincustomers -->|"reads and writes"| node_sql
node_adminstaff -->|"reads and writes"| node_sql
node_adminview -.->|"feature scope"| node_adminhome
node_adminview -.->|"feature scope"| node_admincustomers
node_adminview -.->|"feature scope"| node_adminstaff
node_adminview -.->|"feature scope"| node_admininvoices
node_adminview -.->|"feature scope"| node_admininvoiceinfo
node_adminview -.->|"feature scope"| node_adminproducts
node_adminview -.->|"feature scope"| node_adminoverview

click node_loginview "https://github.com/gumiho0812/qlcuahangthucung/blob/master/Views/Sercurity/Login_View.xaml.cs"
click node_loginvm "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Sercurity/Login_Viewmodel.cs"
click node_roles "https://github.com/gumiho0812/qlcuahangthucung/blob/master/Helpers/RoleManager.cs"
click node_staffshell "https://github.com/gumiho0812/qlcuahangthucung/blob/master/Views/NhanVien/NhanVienView_View.xaml.cs"
click node_staffvm "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/NhanVien/NhanVienView_ViewModel.cs"
click node_sales "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/NhanVien/NhanVien_BanHang_ViewModel.cs"
click node_customers "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/NhanVien/NhanVien_QLKhachHang_ViewModel.cs"
click node_customerview "https://github.com/gumiho0812/qlcuahangthucung/blob/master/Views/NhanVien/NhanVien_QLKhachHang_View.xaml.cs"
click node_adminview "https://github.com/gumiho0812/qlcuahangthucung/blob/master/Views/Admin/AdminView.xaml.cs"
click node_adminhome "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/AdminView_ViewModel.cs"
click node_admincustomers "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_KH_ViewModel.cs"
click node_adminstaff "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_NS_ViewModel.cs"
click node_admininvoices "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_HD_ViewModel.cs"
click node_admininvoiceinfo "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_ChiTietHD_ViewModel.cs"
click node_adminproducts "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_CTSP_ViewModel.cs"
click node_adminoverview "https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_TQ_ViewModel.cs"
click node_dbhelper "https://github.com/gumiho0812/qlcuahangthucung/blob/master/Helpers/DatabaseHelper.cs"
click node_customerdata "https://github.com/gumiho0812/qlcuahangthucung/blob/master/Models/KhachHang.cs"
click node_invoicedata "https://github.com/gumiho0812/qlcuahangthucung/blob/master/Models/HoaDon.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_loginview,node_loginvm,node_roles toneBlue
class node_staffshell,node_staffvm,node_sales,node_customers,node_customerview,node_sql toneAmber
class node_adminview,node_adminhome,node_admincustomers,node_adminstaff,node_admininvoices,node_admininvoiceinfo,node_adminproducts,node_adminoverview toneMint
class node_dbhelper,node_customerdata,node_invoicedata toneRose
class node_user toneIndigo
```

## Components

### Access and roles

- [Login screen](https://github.com/gumiho0812/qlcuahangthucung/blob/master/Views/Sercurity/Login_View.xaml.cs): `Views/Sercurity/Login_View.xaml.cs`
- [Login handler](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Sercurity/Login_Viewmodel.cs): `ViewModels/Sercurity/Login_Viewmodel.cs`
- [Role permissions](https://github.com/gumiho0812/qlcuahangthucung/blob/master/Helpers/RoleManager.cs): `Helpers/RoleManager.cs`

### Staff operations

- [Staff workspace](https://github.com/gumiho0812/qlcuahangthucung/blob/master/Views/NhanVien/NhanVienView_View.xaml.cs): `Views/NhanVien/NhanVienView_View.xaml.cs`
- [Staff workspace model](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/NhanVien/NhanVienView_ViewModel.cs): `ViewModels/NhanVien/NhanVienView_ViewModel.cs`
- [Sales and invoicing](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/NhanVien/NhanVien_BanHang_ViewModel.cs): `ViewModels/NhanVien/NhanVien_BanHang_ViewModel.cs`
- [Customer management](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/NhanVien/NhanVien_QLKhachHang_ViewModel.cs): `ViewModels/NhanVien/NhanVien_QLKhachHang_ViewModel.cs`
- [Customer screen](https://github.com/gumiho0812/qlcuahangthucung/blob/master/Views/NhanVien/NhanVien_QLKhachHang_View.xaml.cs): `Views/NhanVien/NhanVien_QLKhachHang_View.xaml.cs`

### Administration

- [Admin workspace](https://github.com/gumiho0812/qlcuahangthucung/blob/master/Views/Admin/AdminView.xaml.cs): `Views/Admin/AdminView.xaml.cs`
- [Admin dashboard](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/AdminView_ViewModel.cs): `ViewModels/Admin/AdminView_ViewModel.cs`
- [Customer administration](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_KH_ViewModel.cs): `ViewModels/Admin/Admin_KH_ViewModel.cs`
- [Employee administration](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_NS_ViewModel.cs): `ViewModels/Admin/Admin_NS_ViewModel.cs`
- [Invoice administration](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_HD_ViewModel.cs): `ViewModels/Admin/Admin_HD_ViewModel.cs`
- [Invoice details](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_ChiTietHD_ViewModel.cs): `ViewModels/Admin/Admin_ChiTietHD_ViewModel.cs`
- [Product administration](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_CTSP_ViewModel.cs): `ViewModels/Admin/Admin_CTSP_ViewModel.cs`
- [Admin reporting](https://github.com/gumiho0812/qlcuahangthucung/blob/master/ViewModels/Admin/Admin_TQ_ViewModel.cs): `ViewModels/Admin/Admin_TQ_ViewModel.cs`

### Data layer

- [SQL access helper](https://github.com/gumiho0812/qlcuahangthucung/blob/master/Helpers/DatabaseHelper.cs): `Helpers/DatabaseHelper.cs`
- [Customer model](https://github.com/gumiho0812/qlcuahangthucung/blob/master/Models/KhachHang.cs): `Models/KhachHang.cs`
- [Invoice model](https://github.com/gumiho0812/qlcuahangthucung/blob/master/Models/HoaDon.cs): `Models/HoaDon.cs`

### Other components

- **Operator**
- **SQL Server**

## Connections

- Operator → Login screen: enters credentials
- Login screen → Login handler: binds input
- Login handler → SQL access helper: gets connection
- Login handler → SQL Server: authenticates
- Login handler → Role permissions: sets signed-in user
- Login handler → Admin workspace: opens admin
- Login handler → Staff workspace: opens staff
- Staff workspace → Staff workspace model: creates model
- Staff workspace model → Sales and invoicing: feature scope
- Staff workspace model → Customer management: feature scope
- Customer management → SQL access helper: gets connection
- Customer management → SQL Server: reads and writes
- Customer management → Customer model: populates
- Sales and invoicing → Role permissions: checks permission
- Sales and invoicing → SQL access helper: gets connection
- Sales and invoicing → SQL Server: loads and saves invoices
- Sales and invoicing → Invoice model: uses invoice data
- Customer administration → SQL access helper: gets connection
- Customer administration → SQL Server: reads and writes
- Employee administration → SQL Server: reads and writes
- Admin workspace → Admin dashboard: feature scope
- Admin workspace → Customer administration: feature scope
- Admin workspace → Employee administration: feature scope
- Admin workspace → Invoice administration: feature scope
- Admin workspace → Invoice details: feature scope
- Admin workspace → Product administration: feature scope
- Admin workspace → Admin reporting: feature scope
