# lethanhvinh0604/electronic-library architecture

> Architecture diagram of the GitHub repository lethanhvinh0604/electronic-library, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lethanhvinh0604/electronic-library
- Repository: https://github.com/lethanhvinh0604/electronic-library

## Overview

- Presentation Layer: Represented by the various Windows Forms (e.g., FormDangNhap, FormDangKy, FormSach, FormQuanLySach, etc.). This layer is responsible for all UI and user interactions.
- Business Logic Layer (BSLayer): Contains classes like BLAccount, BLManager, and BLUser. This layer processes user requests, applies business rules, and mediates between the presentation and data layers.
- Data Access Layer (DBLayer): Consists of the Connector and any other classes that provide direct communication with the SQL Server database.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Emphasize that by separating UI, business logic, and data access, the system remains modular.
- Use of Connector/Adapter Pattern in the DBLayer for abstracting direct SQL Server calls from the business logic.

##### Technologies and Artifacts
- That the UI leverages the Windows Forms framework in C#.
- That the project is built in Visual Studio (evident from the .sln and .csproj files) and uses App.config for configuration.
- Use of SQL Server as the database platform, with additional reference to the provided "Nhóm 18 - Script Database.sql" file which likely contains the DDL/DML scripts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        A1["FormDangNhap"]:::presentation
        A2["FormDangKy"]:::presentation
        A3["FormSach"]:::presentation
        A4["FormQuanLySach"]:::presentation
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        B1["BLAccount"]:::business
        B2["BLManager"]:::business
        B3["BLUser"]:::business
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        D1["Connector"]:::dao
    end

    %% Database
    subgraph "Database"
        DB1["SQL Server Database"]:::database
    end

    %% Data Flow (Primary)
    A1 -->|"dispatch"| B1
    B1 -->|"process"| D1
    D1 -->|"persist"| DB1

    %% Data Flow (Feedback)
    DB1 -- "retrievedData" --> D1
    D1 -- "dataResult" --> B1
    B1 -- "updateUI" --> A1

    %% Click Events for Presentation Layer
    click A1 "https://github.com/lethanhvinh0604/electronic-library/blob/main/FinalProject/FormDangNhap.cs"
    click A2 "https://github.com/lethanhvinh0604/electronic-library/blob/main/FinalProject/FormDangKy.cs"
    click A3 "https://github.com/lethanhvinh0604/electronic-library/blob/main/FinalProject/FormSach.cs"
    click A4 "https://github.com/lethanhvinh0604/electronic-library/blob/main/FinalProject/FormQuanLySach.cs"

    %% Click Events for Business Logic Layer
    click B1 "https://github.com/lethanhvinh0604/electronic-library/blob/main/FinalProject/BSLayer/BLAccount.cs"
    click B2 "https://github.com/lethanhvinh0604/electronic-library/blob/main/FinalProject/BSLayer/BLManager.cs"
    click B3 "https://github.com/lethanhvinh0604/electronic-library/blob/main/FinalProject/BSLayer/BLUser.cs"

    %% Click Event for Data Access Layer
    click D1 "https://github.com/lethanhvinh0604/electronic-library/blob/main/FinalProject/DBLayer/Connector.cs"

    %% Click Event for Database
    click DB1 "https://github.com/lethanhvinh0604/electronic-library/blob/main/Nhóm 18 - Script Database.sql"

    %% Styles
    classDef presentation fill:#FFCCFF,stroke:#333,stroke-width:2px;
    classDef business fill:#CCEEFF,stroke:#333,stroke-width:2px;
    classDef dao fill:#CCFFCC,stroke:#333,stroke-width:2px;
    classDef database fill:#FFD9B3,stroke:#333,stroke-width:2px;
```
