How hitroxvn/quanlycuahanggiay works
1. Project type and runtime
- This is a C# Windows Forms desktop application for shoe store management (QuanLyCuaHangGiay).
- The solution is organized as a single application project, with Program.cs as the startup entrypoint and App.config/packages.config for runtime and package configuration.
2. Overall architecture
- The code follows a simple layered monolith structure:
- View layer: WinForms screens and controls.
- Controller layer: business-use orchestration between UI and data access.
- Repository layer: database operations.
- Model layer: entity/data transfer classes.
- Utility layer: auth, hashing, session, validation helpers.
- The main flow is: Form/UI → Controller → Repository → DBConnection → database.
3. UI / presentation subsystem
- The view folder contains the application screens:
- Authentication and account screens: flogin, fregister, faccount, fChangePasswords
- Store operations: frmBanHang, frmKho, frmPhieuNhap, frmQuanLyDonHang, frmQuanLyKhachHang, frmNCC, F_Product, F_Category
- Dashboard/reporting: frmMain, frmThongKe, frmReport, frmHoaDon, ucSanPham
- These forms are the primary interaction surface and likely host navigation between modules.
4. Business/controller subsystem
- The controller folder contains one controller per business area:
- AuthController, UserController
- ProductController, CategoryController
- BanHangController, DonHangController
- KhachHangController, NhaCungCapController
- KhoController, PhieuNhapController
- ThongKeController
- These controllers appear to encapsulate application rules and coordinate data access for each module, keeping forms thinner.
5. Data access subsystem
- The database/repository folder contains repository classes for the same business domains:
- ProductRepository, CategoryRepository
- BanHangRepository, DonHangRepository
- KhachHangRepository, NhaCungCapRepository
- KhoRepository, PhieuNhapRepository
- ThongKeRepository, UserRepository
- database/DBConnection.cs is the shared connection layer, implying the repositories execute SQL against a central relational database.
6. Domain/data model
- The model folder defines the core entities used across the app:
- Product/catalog: Products, SanPham, Categories
- Sales/order flow: DonHang, ChiTietGioHang
- Business partners: KhachHang, NhaCungCap
- Inventory and purchasing: Kho, PhieuNhap
- Users/auth: Users
- Reporting/statistics: ThongKe, BieuDoThongKe
- These models are the shared data shape passed between UI, controllers, and repositories.
7. Authentication and authorization boundary
- Security-related helpers live in util:
- HashPassword for password handling
- ValidateUser for login input/rules
- Authorization and Session for user access control and current-user state
- This suggests form access is gated by role/session state rather than a separate identity service.
8. Reporting and analytics
- Reporting is a distinct subsystem:
- ReportPhieuNhap.rdlc
- DataSetPhieuNhap*.cs/.xsd/.xsc/.xss
- frmReport, frmThongKe
- The app likely generates purchase-receipt reports and store statistics using typed datasets plus RDLC report definitions.
9. Sales, inventory, and procurement workflow
- The repository names show the core business processes:
- Selling: frmBanHang / BanHangController / BanHangRepository
- Order management: frmQuanLyDonHang
- Inventory: frmKho
- Inbound purchasing: frmPhieuNhap / PhieuNhapController
- Master data: products, categories, customers, suppliers
- The architecture is centered on maintaining product availability while recording sales and stock-in transactions.
10. Navigation and shared UI structure
- frmMain likely acts as the main shell/menu for opening feature screens.
- IBaseForm suggests a common interface for forms or embedded views, which helps standardize navigation or lifecycle behavior.
- ucSanPham is a reusable user control, indicating some parts of the UI are componentized rather than purely form-based.
11. Persistence and external dependency boundary
- The app depends on a local/central relational database accessed through repository classes, but no separate backend service is present.
- All persistence logic is embedded in the desktop app, so the application is a thick client with direct database access.
12. Diagram-friendly summary
- A good architecture diagram should show:
- WinForms screens at the top
- Controllers in the middle
- Repositories + DBConnection beneath them
- Database at the bottom
- Side services for auth/session/validation and reports/datasets
- The key bounded contexts are: authentication, catalog management, sales/orders, inventory/procurement, customer/supplier management, and reporting/statistics.
Main entry points: frmMain.cs Main shell · DBConnection.cs DB connection · frmThongKe.cs Statistics · AuthController.cs Auth
Components 31
WinForms UI
Desktop screens and reusable controls.
- Main shell · Primary navigation window.
QuanLyCuaHangGiay/view/frmMain.cs - Login · Authentication screen.
QuanLyCuaHangGiay/view/flogin.cs - Products · Catalog management screen.
QuanLyCuaHangGiay/view/F_Product.cs - Sales · Point-of-sale workflow.
QuanLyCuaHangGiay/view/frmBanHang.cs - Inventory · Stock management screen.
QuanLyCuaHangGiay/view/frmKho.cs - Inbound · Purchase receipt workflow.
QuanLyCuaHangGiay/view/frmPhieuNhap.cs - Orders · Order management screen.
QuanLyCuaHangGiay/view/frmQuanLyDonHang.cs - Customers · Customer management screen.
QuanLyCuaHangGiay/view/frmQuanLyKhachHang.cs - Suppliers · Supplier management screen.
QuanLyCuaHangGiay/view/frmNCC.cs - Statistics · Reporting and analytics screen.
QuanLyCuaHangGiay/view/frmThongKe.cs
Controllers
Business orchestration between forms and persistence.
- Auth · Login and account workflows.
QuanLyCuaHangGiay/controller/AuthController.cs - Sales ctrl · Sales transaction orchestration.
QuanLyCuaHangGiay/controller/BanHangController.cs - Catalog ctrl · Product and category operations.
QuanLyCuaHangGiay/controller/ProductController.cs - Inventory ctrl · Stock and inbound purchasing logic.
QuanLyCuaHangGiay/controller/KhoController.cs - Orders ctrl · Order lifecycle management.
QuanLyCuaHangGiay/controller/DonHangController.cs - Partners ctrl · Customer and supplier management.
QuanLyCuaHangGiay/controller/KhachHangController.cs - Stats ctrl · Statistics and report queries.
QuanLyCuaHangGiay/controller/ThongKeController.cs
Data access
Repositories and shared database connection.
- DB connection · Shared relational database connection.
QuanLyCuaHangGiay/database/DBConnection.cs - Products repo · Product persistence operations.
QuanLyCuaHangGiay/database/repository/ProductRepository.cs - Sales repo · Sales transaction persistence.
QuanLyCuaHangGiay/database/repository/BanHangRepository.cs - Stock repo · Inventory and purchase persistence.
QuanLyCuaHangGiay/database/repository/KhoRepository.cs - Stats repo · Reporting and analytics queries.
QuanLyCuaHangGiay/database/repository/ThongKeRepository.cs
Domain models
Shared entities and DTO-style models.
Shared utilities
Authentication, session, and validation helpers.
- Auth utils · Password hashing, authorization, and session state.
QuanLyCuaHangGiay/util/Authorization.cs - Validation · Login and user input checks.
QuanLyCuaHangGiay/util/ValidateUser.cs
Reports
RDLC report assets and typed datasets.
- Receipt dataset · Typed dataset for purchase receipt reports.
QuanLyCuaHangGiay/DataSetPhieuNhap.xsd - Receipt report · RDLC definition for purchase receipt output.
QuanLyCuaHangGiay/ReportPhieuNhap.rdlc
Other components
- Program · Application entrypoint.
QuanLyCuaHangGiay/Program.cs
Connections 35
- Program → Main shell: starts · Launches the main shell.
- Main shell → Login: opens · Routes users into authentication.
- Login → Auth: uses · Submits login and account actions.
- Auth → Auth utils: checks · Validates credentials and session rules.
- Auth → DB connection: reads · Loads users and account state.
- Main shell → Products: navigates · Opens catalog management.
- Main shell → Sales: navigates · Opens point-of-sale workflow.
- Main shell → Inventory: navigates · Opens stock management.
- Main shell → Inbound: navigates · Opens inbound purchasing.
- Main shell → Orders: navigates · Opens order management.
- Main shell → Customers: navigates · Opens customer management.
- Main shell → Suppliers: navigates · Opens supplier management.
- Main shell → Statistics: navigates · Opens reporting and analytics.
- Products → Catalog ctrl: uses · Delegates product operations.
- Sales → Sales ctrl: uses · Delegates sale creation and checkout.
- Inventory → Inventory ctrl: uses · Delegates stock actions.
- Inbound → Inventory ctrl: uses · Reuses stock/purchase logic.
- Orders → Orders ctrl: uses · Delegates order lifecycle operations.
- Customers → Partners ctrl: uses · Delegates customer management.
- Suppliers → Partners ctrl: uses · Delegates supplier management.
- Statistics → Stats ctrl: uses · Requests analytics and report data.
- Catalog ctrl → Products repo: calls · Persists catalog changes.
- Sales ctrl → Sales repo: calls · Writes sales transactions.
- Inventory ctrl → Stock repo: calls · Reads and updates stock records.
- Stats ctrl → Stats repo: calls · Fetches reporting aggregates.
- Products repo → DB connection: uses · Executes database operations through shared connection.
- Sales repo → DB connection: uses · Executes database operations through shared connection.
- Stock repo → DB connection: uses · Executes database operations through shared connection.
- Stats repo → DB connection: uses · Executes database operations through shared connection.
- DB connection → Products: stores · Backs catalog persistence.
- DB connection → Orders: stores · Backs order and cart persistence.
- DB connection → Partners: stores · Backs customer and supplier persistence.
- DB connection → Users: stores · Backs user/account persistence.
- Stats ctrl → Receipt dataset: feeds · Populates typed dataset for reporting.
- Statistics → Receipt report: renders · Displays the RDLC receipt report.