# jve386/hotelsol_app architecture

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

- Interactive diagram: https://gitdiagram.com/jve386/hotelsol_app
- Repository: https://github.com/jve386/hotelsol_app

## Overview

##### Project Type and Purpose
- The project is a room reservation management application that leverages a hybrid technology stack. On one side, it uses the .NET ecosystem (including Windows Forms for a desktop UI, ASP.NET components, ADO.NET, and Entity Framework for ORM) and on the other, it integrates Python scripts with the Odoo API for CRUD operations and system interactions.
- The architecture follows an MVC pattern, where you have distinct Controller (Controlador) and Model (Modelo) directories, with the model layer including both data access via Entity Framework (EF) and XML-based data handling.

##### Analyzing the File Structure
- Top-level directories include:
- Controlador: Contains .NET project files, configuration (App.config), and main controller classes.
- Modelo: Contains data models, EF subdirectories with all Entity Framework related files (such as .edmx, .tt, Designer.cs, etc.), and additional Python files (in versionJVE) that handle integration with the Odoo API.
- Two versions of the application exist ("HotelSOL_APP" and "HotelSOL_APP_versionJVE"), with the versionJVE folder introducing Python scripts for loading customers, rooms, and products from Odoo, enhancing the hybrid integration aspect.

- User Interface Layer: Windows Forms (desktop front-end) possibly interacting with users via the UI.
- Controller Layer: Under the “Controlador” directory; handles application logic and input processing.
- Model & Data Access Layer: In the “Modelo” directory; includes Entity Framework components, XML data handling, and ORM integration with SQL Server.
- Python Integration Module: Includes Python scripts (like CargarClientesOdoo.py, etc.) that handle CRUD operations and sync with Odoo.
- External Systems: Odoo API, SQL Server, and native XML databases.

- Out the relationships:
- UI interacts with the Controller (MainController.cs) using the MVC pattern.
- The Controller communicates with the Model, which encapsulates business/data logic.
- The Model uses Entity Framework Core to connect to SQL Server and also processes XML data using libraries like System.Xml (XmlReader/XmlTextWriter).
- The Python module interfaces with the external Odoo system, feeding data into or retrieving data from the Model.

- Directional flow:
- Clearly denote that data flows from the user through the UI, is processed by the Controller, and then actions like data retrieval, manipulation, and persistence are handled by the Model.
- Integration flow from the Python-based CRUD operations toward the Model and external Odoo API.

- Technologies and patterns:
- MVC Pattern: Differentiation between controller logic and data model.
- ORM: Entity Framework Core managing relationships with the SQL Server database.
- XML Data Handling: Using .NET’s System.Xml classes.
- Hybrid Integration: Combining .NET and Python components to interact with Odoo.

##### Specific Elements
- User Interface (Windows Forms)
- Controller (Controlador)
- Model Layer (Modelo, including EF and XML handlers)
- Python Integration Module (for Odoo-related CRUD operations)
- External Systems: SQL Server and Odoo API.
- The flow of commands from the UI to the Controller.
- Data queries and persistence actions between Controller and Model.
- Data exchanges between the Model and external systems (like Odoo via Python, and SQL Server via EF).

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% User Interface Layer
    subgraph "User Interface Layer"
        UI1["Windows Forms UI"]:::dotnet
        UI2["FormOdooHub"]:::dotnet
    end

    %% Controller Layer
    subgraph "Controller Layer"
        CTRL1["Main Controller (HotelSOL_APP)"]:::dotnet
        CTRL2["Main Controller (HotelSOL_APP_versionJVE)"]:::dotnet
    end

    %% Model & Data Access Layer
    subgraph "Model & Data Access Layer"
        EF1["EF Data Models (.NET)"]:::dotnet
        AC["App Config"]:::dotnet
        EF2["EF Data Models (versionJVE)"]:::dotnet
        XML["XML Data Handler"]:::dotnet
    end

    %% Python Integration Module
    subgraph "Python Integration Module"
        Py1["Cargar Clientes Odoo"]:::python
        Py2["Cargar Habitaciones Odoo"]:::python
        Py3["Cargar Productos Odoo"]:::python
        Py4["Python Models"]:::python
    end

    %% External Systems
    subgraph "External Systems"
        SQL["SQL Server"]:::database
        Odoo["Odoo API"]:::external
        SQLb["SQL Base"]:::sql
        SQLi["SQL Inserts"]:::sql
    end

    %% Connections from UI to Controller
    UI1 -->|"triggers"| CTRL1
    UI2 -->|"triggers"| CTRL2

    %% Connections from Controller to Model
    CTRL1 -->|"processes"| EF1
    CTRL1 -->|"processes"| AC
    CTRL1 -->|"processes"| EF2
    CTRL1 -->|"processes"| XML

    CTRL2 -->|"processes"| EF1
    CTRL2 -->|"processes"| AC
    CTRL2 -->|"processes"| EF2
    CTRL2 -->|"processes"| XML

    %% Connections from Python Integration Module to Model
    Py1 -->|"syncs_to"| XML
    Py2 -->|"syncs_to"| XML
    Py3 -->|"syncs_to"| XML
    Py4 -->|"supports"| XML

    %% Python Integration Module interacts with External Odoo API
    Py1 -->|"calls"| Odoo
    Py2 -->|"calls"| Odoo
    Py3 -->|"calls"| Odoo

    %% Model (EF Data Models) connects to SQL Server
    EF1 -->|"ORM accesses"| SQL
    EF2 -->|"ORM accesses"| SQL

    %% SQL Scripts feeding SQL Server
    SQLb -->|"setup"| SQL
    SQLi -->|"populate"| SQL

    %% Click Events for User Interface Layer
    click UI1 "https://github.com/jve386/hotelsol_app/tree/main/HotelSOL_APP/HotelSOL_APP"
    click UI2 "https://github.com/jve386/hotelsol_app/blob/main/HotelSOL_APP_versionJVE/Modelo/FormOdooHub.cs"

    %% Click Events for Controller Layer
    click CTRL1 "https://github.com/jve386/hotelsol_app/blob/main/HotelSOL_APP/Controlador/MainController.cs"
    click CTRL2 "https://github.com/jve386/hotelsol_app/blob/main/HotelSOL_APP_versionJVE/Controlador/MainController.cs"

    %% Click Events for Model & Data Access Layer
    click EF1 "https://github.com/jve386/hotelsol_app/tree/main/HotelSOL_APP/Modelo/EF/"
    click AC "https://github.com/jve386/hotelsol_app/blob/main/HotelSOL_APP/Modelo/App.Config"
    click EF2 "https://github.com/jve386/hotelsol_app/tree/main/HotelSOL_APP_versionJVE/Modelo/EF/"
    click XML "https://github.com/jve386/hotelsol_app/tree/main/HotelSOL_APP_versionJVE/Modelo/xml/"

    %% Click Events for Python Integration Module
    click Py1 "https://github.com/jve386/hotelsol_app/blob/main/HotelSOL_APP_versionJVE/Modelo/CargarClientesOdoo.py"
    click Py2 "https://github.com/jve386/hotelsol_app/blob/main/HotelSOL_APP_versionJVE/Modelo/CargarHabitacionesOdoo.py"
    click Py3 "https://github.com/jve386/hotelsol_app/blob/main/HotelSOL_APP_versionJVE/Modelo/CargarProductosOdoo.py"
    click Py4 "https://github.com/jve386/hotelsol_app/blob/main/HotelSOL_APP_versionJVE/Modelo/models.py"

    %% Click Events for External Systems (SQL Scripts)
    click SQLb "https://github.com/jve386/hotelsol_app/blob/main/SQLscripts/BaseDatos.txt"
    click SQLi "https://github.com/jve386/hotelsol_app/blob/main/SQLscripts/Insert_values.txt"

    %% Styles
    classDef dotnet fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef python fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef database fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#CB4335,stroke-width:2px;
    classDef sql fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;
```
