# q-tran14/manage-eyewear-store architecture

> Architecture diagram of the GitHub repository q-tran14/manage-eyewear-store, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/q-tran14/manage-eyewear-store
- Repository: https://github.com/q-tran14/manage-eyewear-store

## Overview

##### Project type and purpose
- This is a WinForms-based desktop management system (“eyewear-store-management-system”) for an eyewear shop.
- It implements a classic 3-tier architecture: Presentation (WinForms UI), Business Logic (BLL project), and Data Access (DAL project), persisting data to a SQL Server database defined by ESMDS.sql.
- Additional functionality includes custom UI components, shared utilities, and an external Location API integration.

##### File structure
- Top-level projects:
- BLL (Business Logic Layer) – contains `CustomerBLL`, `InvoiceBLL`, etc.
- DAL (Data Access Layer) – contains `CustomerDAL`, `InvoiceDAL`, plus an `Object` folder for POCOs, and `Utils/UtilityDatabase` for DB connectivity.
- eyewear-store-management-system (WinForms UI) – forms (`MainForm`, `LoginForm`, `InvoiceManagementForm`, etc), `CustomComponents`, and UI `Utils` (e.g., `ToastManager`, `UtilityDataGridView`, `LocationAPIUtils`).
- Infrastructure files:
- `ESMDS.sql` – SQL script to create the database schema.
- Solution file (`.sln`) ties the three projects together.
- Config file (`App.config`) for connection strings.

##### README
- Instructs to run the SQL script to provision the database, then launch the WinForms app.

##### Detailed capture of essential elements
- Break each layer into its major sub-components—for DAL: “Data Objects” vs. “Repositories” vs. “Database Utility”; for UI: “Forms”, “CustomComponents”, “Utils”.
- How utility libraries (security, imaging, toasts) are shared across forms.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        UINode["UI (WinForms)"]:::ui
        MainForm["MainForm"]:::ui
        LoginForm["LoginForm"]:::ui
        InvoiceMgmtForm["InvoiceManagementForm"]:::ui
        RevenueAnalysisForm["RevenueAnalysisForm"]:::ui
        StaffMgmtForm["StaffManagementForm"]:::ui
        StockMgmtForm["StockManagementForm"]:::ui
        VoucherMgmtForm["VoucherManagementForm"]:::ui
        CustomComps["CustomComponents"]:::ui
        subgraph "UI Utils" 
            direction TB
            BaseForm["BaseForm"]:::ui
            ToastMgr["ToastManager"]:::ui
            UtilityDGV["UtilityDataGridView"]:::ui
            UtilityImg["UtilityImage"]:::ui
            UtilitySec["UtilitySecurity"]:::ui
            OtherUtils["OtherUtilities"]:::ui
        end
        subgraph "Location API Utils"
            direction TB
            CacheMgr["CacheManager"]:::ui
            LocationAPI["LocationByAPI"]:::ui
            UtilityAPI["UtilityAPI"]:::ui
        end
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        direction TB
        CustomerBLL["CustomerBLL"]:::bll
        EmployeeBLL["EmployeeBLL"]:::bll
        InvoiceBLL["InvoiceBLL"]:::bll
        InvoiceLineBLL["InvoiceLineBLL"]:::bll
        ProductBLL["ProductBLL"]:::bll
        VoucherBLL["VoucherBLL"]:::bll
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        direction TB
        CustomerDAL["CustomerDAL"]:::dal
        EmployeeDAL["EmployeeDAL"]:::dal
        InvoiceDAL["InvoiceDAL"]:::dal
        InvoiceLineDAL["InvoiceLineDAL"]:::dal
        ProductDAL["ProductDAL"]:::dal
        VoucherDAL["VoucherDAL"]:::dal
        subgraph "Data Objects"
            direction TB
            CustObj["Customer.cs"]:::dal
            EmpObj["Employee.cs"]:::dal
            InvObj["Invoice.cs"]:::dal
            InvLineObj["InvoiceLine.cs"]:::dal
            ProdObj["Product.cs"]:::dal
            VouchObj["Voucher.cs"]:::dal
        end
        UtilityDB["UtilityDatabase"]:::dal
    end

    %% Database
    Database["SQL Server Database"]:::db

    %% External Service
    ExternalService["Location API Service"]:::ext

    %% Relationships
    UINode -->|"invokes"| CustomerBLL
    UINode -->|"invokes"| InvoiceBLL
    UINode -->|"invokes"| VoucherBLL
    CustomerBLL -->|"calls"| CustomerDAL
    InvoiceBLL -->|"calls"| InvoiceDAL
    VoucherBLL -->|"calls"| VoucherDAL
    CustomerDAL -->|"uses"| UtilityDB
    EmployeeDAL -->|"uses"| UtilityDB
    UtilityDB -->|"executes SQL"| Database
    LocationAPI -->|"HTTP call"| ExternalService
    UINode --> CustomComps
    UINode --> BaseForm
    UINode --> ToastMgr
    UINode --> UtilityDGV
    UINode --> UtilityImg
    UINode --> UtilitySec
    UINode --> OtherUtils
    UINode --> LocationAPI
    UINode --> CacheMgr
    UINode --> UtilityAPI

    %% Click Events for UI
    click MainForm "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/MainForm.cs"
    click LoginForm "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/LoginForm.cs"
    click InvoiceMgmtForm "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/InvoiceManagementForm.cs"
    click RevenueAnalysisForm "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/RevenueAnalysisForm.cs"
    click StaffMgmtForm "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/StaffManagementForm.cs"
    click StockMgmtForm "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/StockManagementForm.cs"
    click VoucherMgmtForm "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/VoucherManagementForm.cs"
    click CustomComps "https://github.com/q-tran14/manage-eyewear-store/tree/master/eyewear-store-management-system/CustomComponents"
    click BaseForm "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/Utils/BaseForm.cs"
    click ToastMgr "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/Utils/ToastManager.cs"
    click UtilityDGV "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/Utils/UtilityDataGridView.cs"
    click UtilityImg "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/Utils/UtilityImage.cs"
    click UtilitySec "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/Utils/UtilitySecurity.cs"
    click OtherUtils "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/Utils/OtherUtilities.cs"
    click CacheMgr "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/Utils/LocationAPIUtils/CacheManager.cs"
    click LocationAPI "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/Utils/LocationAPIUtils/LocationByAPI.cs"
    click UtilityAPI "https://github.com/q-tran14/manage-eyewear-store/blob/master/eyewear-store-management-system/Utils/LocationAPIUtils/UtilityAPI.cs"

    %% Click Events for BLL
    click CustomerBLL "https://github.com/q-tran14/manage-eyewear-store/blob/master/BLL/CustomerBLL.cs"
    click EmployeeBLL "https://github.com/q-tran14/manage-eyewear-store/blob/master/BLL/EmployeeBLL.cs"
    click InvoiceBLL "https://github.com/q-tran14/manage-eyewear-store/blob/master/BLL/InvoiceBLL.cs"
    click InvoiceLineBLL "https://github.com/q-tran14/manage-eyewear-store/blob/master/BLL/InvoiceLineBLL.cs"
    click ProductBLL "https://github.com/q-tran14/manage-eyewear-store/blob/master/BLL/ProductBLL.cs"
    click VoucherBLL "https://github.com/q-tran14/manage-eyewear-store/blob/master/BLL/VoucherBLL.cs"

    %% Click Events for DAL
    click CustomerDAL "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/CustomerDAL.cs"
    click EmployeeDAL "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/EmployeeDAL.cs"
    click InvoiceDAL "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/InvoiceDAL.cs"
    click InvoiceLineDAL "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/InvoiceLineDAL.cs"
    click ProductDAL "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/ProductDAL.cs"
    click VoucherDAL "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/VoucherDAL.cs"
    click CustObj "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/Object/Customer.cs"
    click EmpObj "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/Object/Employee.cs"
    click InvObj "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/Object/Invoice.cs"
    click InvLineObj "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/Object/InvoiceLine.cs"
    click ProdObj "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/Object/Product.cs"
    click VouchObj "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/Object/Voucher.cs"
    click UtilityDB "https://github.com/q-tran14/manage-eyewear-store/blob/master/DAL/Utils/UtilityDatabase.cs"

    %% Click Event for Database Script
    click Database "https://github.com/q-tran14/manage-eyewear-store/blob/master/ESMDS.sql"

    %% Styles
    classDef ui fill:#add8e6,stroke:#000,stroke-width:1px
    classDef bll fill:#90ee90,stroke:#000,stroke-width:1px
    classDef dal fill:#ffa500,stroke:#000,stroke-width:1px
    classDef db fill:#d3d3d3,stroke:#000,stroke-width:1px
    classDef ext fill:#dda0dd,stroke:#000,stroke-width:1px
```
