# jasillo/sistema_de_ventas architecture

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

- Interactive diagram: https://gitdiagram.com/jasillo/sistema_de_ventas
- Repository: https://github.com/jasillo/sistema_de_ventas

## Overview

##### Project type and purpose
- This is a .NET Framework Windows-Forms desktop application called “Sistema_de_Ventas” (Sales System).
- It provides forms for Login, Main Dashboard, Inventory, Purchases, Sales, Users, Statistics, Historic data, and initial database setup.
- It uses a typed DataSet (`SalesSystemDB.xsd`) and a helper class (`ConDB.cs`) to connect to a local SQL database.
- It also includes a Visual Studio Installer project (`installer_sistema_ventas.vdproj`).

##### File structure
- Top-level:
- `Sistema_de_Ventas.sln` — solution file
- `Sistema_de_Ventas/` — application project
- `installer_sistema_ventas/` — installer project
- Inside `Sistema_de_Ventas/`:
- `*.cs` & `*.Designer.cs` & `*.resx` — Windows Forms UIs and code-behind
- `ConDB.cs` — data-access helper (connection management)
- `SalesSystemDB.xsd` (+ `.xsc`, `.xss`) — typed DataSet definition
- `App.config` — connection strings and app settings
- `Resources/`, `Properties/` — static assets and assembly settings
- Installer folder contains the deployment definition (`.vdproj`).

##### Key architectural insights from the README
- The README only provides a project name and a shared folder link.

##### Main components and their interactions
a. User Interface Layer
- Windows Forms modules:
- LoginForm → Authentication
- MainForm → Navigation hub
- InventoryForm, PurchaseForm, SalesForm, UserForm, StadisticsForm, HistoricForm → business-domain UIs
- initBDForm → Database initialization UI
b. Business Logic / Application Layer
- Code in each Form’s `.cs` handles user events, validation, and calls into the Data Access Layer.
c. Data Access Layer
- `ConDB.cs`
- Typed DataSet (`SalesSystemDB.xsd`) with TableAdapters
d. Data Storage
- Local SQL database (likely SQL Server Express `.mdf`), defined via DataSet and connection string.
e. Deployment
- Visual Studio Installer (`installer_sistema_ventas.vdproj`) packages the EXE, dependencies, and DB scripts.

##### Architectural patterns and design principles
- Layered architecture: UI → Business Logic → Data Access → Database
- Typed DataSet pattern (generated DataSet classes)
- Single application process (monolith)
- Installer for packaging and deployment

##### Relationships and data flow
- UI → Business Logic (calls form event handlers)
- Business Logic → Data Access (calls TableAdapters / ConDB)
- Data Access → Database (SQL queries / CRUD operations)
- Installer → Packages UI and DB components

##### Technologies and frameworks
- .NET Framework / C#
- Windows Forms
- Typed DataSets (.xsd) / ADO.NET
- SQL Server (Express)
- Visual Studio Installer (.vdproj)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Windows Forms Client Layer
    subgraph "Windows Forms Client"
        direction TB
        LoginForm["LoginForm"]:::ui
        MainForm["MainForm"]:::ui
        InventoryForm["InventoryForm"]:::ui
        PurchaseForm["PurchaseForm"]:::ui
        SalesForm["SalesForm"]:::ui
        UserForm["UserForm"]:::ui
        StadisticsForm["StadisticsForm"]:::ui
        HistoricForm["HistoricForm"]:::ui
        initBDForm["initBDForm"]:::ui
        Program["Program (Entry Point)"]:::ui
    end

    %% Business Logic Layer
    subgraph "Business Logic / Controllers"
        direction TB
        BusinessLogic["Form Code-Behind"]:::bl
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        direction TB
        ConDB["ConDB.cs"]:::dal
        DataSet["SalesSystemDB DataSet"]:::dal
    end

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

    %% Installer
    subgraph "Installer"
        InstallerProj["installer_sistema_ventas.vdproj"]:::installer
    end

    %% Relationships
    LoginForm -->|uses| BusinessLogic
    MainForm -->|uses| BusinessLogic
    InventoryForm -->|uses| BusinessLogic
    PurchaseForm -->|uses| BusinessLogic
    SalesForm -->|uses| BusinessLogic
    UserForm -->|uses| BusinessLogic
    StadisticsForm -->|uses| BusinessLogic
    HistoricForm -->|uses| BusinessLogic
    initBDForm -->|uses| BusinessLogic
    Program -->|launches| LoginForm

    BusinessLogic -->|calls| ConDB
    BusinessLogic -->|uses| DataSet

    ConDB -->|executes| SQLDB
    DataSet -->|communicates| SQLDB

    InstallerProj -->|packages| Program
    InstallerProj -->|includes| SQLDB

    %% Click Events
    click LoginForm "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/LoginForm.cs"
    click MainForm "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/MainForm.cs"
    click InventoryForm "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/InventoryForm.cs"
    click PurchaseForm "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/PurchaseForm.cs"
    click SalesForm "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/SalesForm.cs"
    click UserForm "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/UserForm.cs"
    click StadisticsForm "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/StadisticsForm.cs"
    click HistoricForm "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/Historic.cs"
    click initBDForm "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/initBDForm.cs"
    click Program "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/Program.cs"
    click ConDB "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/ConDB.cs"
    click DataSet "https://github.com/jasillo/sistema_de_ventas/blob/master/Sistema_de_Ventas/SalesSystemDB.xsd"
    click InstallerProj "https://github.com/jasillo/sistema_de_ventas/blob/master/installer_sistema_ventas/installer_sistema_ventas.vdproj"

    %% Styles
    classDef ui fill:#CFE2F3,stroke:#000;
    classDef bl fill:#D9EAD3,stroke:#000;
    classDef dal fill:#FFF2CC,stroke:#000;
    classDef db fill:#F4CCCC,stroke:#000,stroke-dasharray: 5 5;
    classDef installer fill:#EAD1DC,stroke:#000,stroke-dasharray: 2 2;
```
