# phuoctan221/c_sharp_nhom architecture

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

- Interactive diagram: https://gitdiagram.com/phuoctan221/c_sharp_nhom
- Repository: https://github.com/phuoctan221/c_sharp_nhom

## Overview

This is a WPF real-estate listing application backed by SQL Server. Users register or sign in, browse and filter sale/rental listings, open listing details, and save favorites; signed-in users can manage their listings, while admins can manage accounts. The graph includes documented database entities and capabilities, but several screens were not sampled, so their internal calls are omitted rather than inferred. The README documents the database schema; source excerpts show both shared-helper and direct SQL access patterns.

Main entry points: [`DatabaseHelper.cs`](https://github.com/phuoctan221/c_sharp_nhom/blob/main/DatabaseHelper.cs) (Listing data helper), [`CardBatDongSan.xaml.cs`](https://github.com/phuoctan221/c_sharp_nhom/blob/main/CardBatDongSan.xaml.cs) (Listing card), [`TimKiem.xaml.cs`](https://github.com/phuoctan221/c_sharp_nhom/blob/main/TimKiem.xaml.cs) (Listing search), [`DangNhap.xaml.cs`](https://github.com/phuoctan221/c_sharp_nhom/blob/main/DangNhap.xaml.cs) (Sign in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App navigation"]
  node_main["Main window<br/>[MainWindow.xaml.cs]"]
  node_contact["Contact screen<br/>[Contact.xaml.cs]"]
end

subgraph group_listings["Listing experience"]
  node_home["Home listings<br/>[TrangChu.xaml.cs]"]
  node_search["Listing search<br/>[TimKiem.xaml.cs]"]
  node_card["Listing card"]
  node_detail["Listing details<br/>[ChiTiet.xaml.cs]"]
  node_post["Create/edit listing<br/>[DangTin.xaml.cs]"]
  node_manage_listings["Manage listings<br/>[QuanLyTin.xaml.cs]"]
  node_favorites["Saved listings<br/>[YeuThich.xaml.cs]"]
end

subgraph group_accounts["Accounts and administration"]
  node_login["Sign in<br/>[DangNhap.xaml.cs]"]
  node_register["Registration<br/>[DangKy.xaml.cs]"]
  node_manage_accounts["Manage accounts"]
  node_edit_account["Account editor"]
end

subgraph group_data["Data access and entities"]
  node_dbhelper["Listing data helper<br/>[DatabaseHelper.cs]"]
  node_user_model["User model<br/>[NguoiDung.cs]"]
  node_listing_model["Listing model<br/>[TinDang.cs]"]
  node_sqlserver[("BatDongSanDB")]
end

node_person(("App user"))

node_person -.->|"enters credentials"| node_login
node_login -->|"sets user and navigates"| node_main
node_search -->|"queries listings"| node_dbhelper
node_search -->|"displays results"| node_listing_model
node_search -->|"creates cards"| node_card
node_home -->|"loads listings"| node_dbhelper
node_card -->|"checks and saves favorites"| node_dbhelper
node_card -->|"opens listing details"| node_detail
node_detail -->|"loads listing and favorites"| node_dbhelper
node_post -->|"loads and saves listing"| node_dbhelper
node_post -->|"builds listing"| node_listing_model
node_manage_listings -->|"queries and deletes listings"| node_sqlserver
node_favorites -->|"queries saved listings"| node_sqlserver
node_favorites -->|"renders saved listings"| node_card
node_register -->|"checks and inserts accounts"| node_sqlserver
node_login -->|"authenticates account"| node_sqlserver
node_manage_accounts -->|"queries and deletes accounts"| node_sqlserver
node_manage_accounts -->|"opens editor"| node_edit_account
node_edit_account -->|"reads and writes account"| node_sqlserver
node_dbhelper -->|"runs SQL operations"| node_sqlserver
node_dbhelper -->|"maps account data"| node_user_model
node_dbhelper -->|"maps listing data"| node_listing_model

click node_main "https://github.com/phuoctan221/c_sharp_nhom/blob/main/MainWindow.xaml.cs"
click node_home "https://github.com/phuoctan221/c_sharp_nhom/blob/main/TrangChu.xaml.cs"
click node_search "https://github.com/phuoctan221/c_sharp_nhom/blob/main/TimKiem.xaml.cs"
click node_card "https://github.com/phuoctan221/c_sharp_nhom/blob/main/CardBatDongSan.xaml.cs"
click node_detail "https://github.com/phuoctan221/c_sharp_nhom/blob/main/ChiTiet.xaml.cs"
click node_post "https://github.com/phuoctan221/c_sharp_nhom/blob/main/DangTin.xaml.cs"
click node_manage_listings "https://github.com/phuoctan221/c_sharp_nhom/blob/main/QuanLyTin.xaml.cs"
click node_favorites "https://github.com/phuoctan221/c_sharp_nhom/blob/main/YeuThich.xaml.cs"
click node_login "https://github.com/phuoctan221/c_sharp_nhom/blob/main/DangNhap.xaml.cs"
click node_register "https://github.com/phuoctan221/c_sharp_nhom/blob/main/DangKy.xaml.cs"
click node_manage_accounts "https://github.com/phuoctan221/c_sharp_nhom/blob/main/QuanLyTaiKhoan.xaml.cs"
click node_edit_account "https://github.com/phuoctan221/c_sharp_nhom/blob/main/SuaTaiKhoan.xaml.cs"
click node_contact "https://github.com/phuoctan221/c_sharp_nhom/blob/main/Contact.xaml.cs"
click node_dbhelper "https://github.com/phuoctan221/c_sharp_nhom/blob/main/DatabaseHelper.cs"
click node_user_model "https://github.com/phuoctan221/c_sharp_nhom/blob/main/NguoiDung.cs"
click node_listing_model "https://github.com/phuoctan221/c_sharp_nhom/blob/main/TinDang.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_main,node_contact,node_person toneBlue
class node_home,node_search,node_card,node_detail,node_post,node_manage_listings,node_favorites toneAmber
class node_login,node_register,node_manage_accounts,node_edit_account toneMint
class node_dbhelper,node_user_model,node_listing_model,node_sqlserver toneRose
```

## Components

### App navigation

- [Main window](https://github.com/phuoctan221/c_sharp_nhom/blob/main/MainWindow.xaml.cs): `MainWindow.xaml.cs`
- [Contact screen](https://github.com/phuoctan221/c_sharp_nhom/blob/main/Contact.xaml.cs): `Contact.xaml.cs`

### Listing experience

- [Home listings](https://github.com/phuoctan221/c_sharp_nhom/blob/main/TrangChu.xaml.cs): `TrangChu.xaml.cs`
- [Listing search](https://github.com/phuoctan221/c_sharp_nhom/blob/main/TimKiem.xaml.cs): `TimKiem.xaml.cs`
- [Listing card](https://github.com/phuoctan221/c_sharp_nhom/blob/main/CardBatDongSan.xaml.cs): `CardBatDongSan.xaml.cs`
- [Listing details](https://github.com/phuoctan221/c_sharp_nhom/blob/main/ChiTiet.xaml.cs): `ChiTiet.xaml.cs`
- [Create/edit listing](https://github.com/phuoctan221/c_sharp_nhom/blob/main/DangTin.xaml.cs): `DangTin.xaml.cs`
- [Manage listings](https://github.com/phuoctan221/c_sharp_nhom/blob/main/QuanLyTin.xaml.cs): `QuanLyTin.xaml.cs`
- [Saved listings](https://github.com/phuoctan221/c_sharp_nhom/blob/main/YeuThich.xaml.cs): `YeuThich.xaml.cs`

### Accounts and administration

- [Sign in](https://github.com/phuoctan221/c_sharp_nhom/blob/main/DangNhap.xaml.cs): `DangNhap.xaml.cs`
- [Registration](https://github.com/phuoctan221/c_sharp_nhom/blob/main/DangKy.xaml.cs): `DangKy.xaml.cs`
- [Manage accounts](https://github.com/phuoctan221/c_sharp_nhom/blob/main/QuanLyTaiKhoan.xaml.cs): `QuanLyTaiKhoan.xaml.cs`
- [Account editor](https://github.com/phuoctan221/c_sharp_nhom/blob/main/SuaTaiKhoan.xaml.cs): `SuaTaiKhoan.xaml.cs`

### Data access and entities

- [Listing data helper](https://github.com/phuoctan221/c_sharp_nhom/blob/main/DatabaseHelper.cs): `DatabaseHelper.cs`
- [User model](https://github.com/phuoctan221/c_sharp_nhom/blob/main/NguoiDung.cs): `NguoiDung.cs`
- [Listing model](https://github.com/phuoctan221/c_sharp_nhom/blob/main/TinDang.cs): `TinDang.cs`
- **BatDongSanDB**

### Other components

- **App user**

## Connections

- App user → Sign in: enters credentials
- Sign in → Main window: sets user and navigates (evidence: `DangNhap.xaml.cs`)
- Listing search → Listing data helper: queries listings (evidence: `TimKiem.xaml.cs`)
- Listing search → Listing model: displays results (evidence: `TimKiem.xaml.cs`)
- Listing search → Listing card: creates cards (evidence: `TimKiem.xaml.cs`)
- Home listings → Listing data helper: loads listings (evidence: `TrangChu.xaml.cs`)
- Listing card → Listing data helper: checks and saves favorites (evidence: `CardBatDongSan.xaml.cs`)
- Listing card → Listing details: opens listing details (evidence: `CardBatDongSan.xaml.cs`)
- Listing details → Listing data helper: loads listing and favorites (evidence: `ChiTiet.xaml.cs`)
- Create/edit listing → Listing data helper: loads and saves listing (evidence: `DangTin.xaml.cs`)
- Create/edit listing → Listing model: builds listing (evidence: `DangTin.xaml.cs`)
- Manage listings → BatDongSanDB: queries and deletes listings (evidence: `QuanLyTin.xaml.cs`)
- Saved listings → BatDongSanDB: queries saved listings (evidence: `YeuThich.xaml.cs`)
- Saved listings → Listing card: renders saved listings (evidence: `YeuThich.xaml.cs`)
- Registration → BatDongSanDB: checks and inserts accounts (evidence: `DangKy.xaml.cs`)
- Sign in → BatDongSanDB: authenticates account (evidence: `DangNhap.xaml.cs`)
- Manage accounts → BatDongSanDB: queries and deletes accounts (evidence: `QuanLyTaiKhoan.xaml.cs`)
- Manage accounts → Account editor: opens editor (evidence: `QuanLyTaiKhoan.xaml.cs`)
- Account editor → BatDongSanDB: reads and writes account (evidence: `SuaTaiKhoan.xaml.cs`)
- Listing data helper → BatDongSanDB: runs SQL operations (evidence: `DatabaseHelper.cs`)
- Listing data helper → User model: maps account data (evidence: `DatabaseHelper.cs`)
- Listing data helper → Listing model: maps listing data (evidence: `DatabaseHelper.cs`)
