How 13felixlopez/proyectoofi works
1. Repository shape
- This is a Windows desktop application built in C# WinForms on .NET Framework 4.8.
- The solution centers on ProyectoOFI, with a smaller companion Datos project in the solution. The functional architecture is inside ProyectoOFI.
2. Top-level architecture
- The codebase follows a classic 3-layer pattern:
- UI layer: WinForms forms and user controls.
- Business layer: ProyectoOFI/Logica classes (L*).
- Data access layer: ProyectoOFI/Datos classes (D*).
- The UI does not appear to talk directly to SQL Server; it goes through Logica, which in turn uses Datos.
3. Application entry and shell
- Program.cs starts the app.
- Login is the first functional gate: it checks connectivity and user credentials.
- FrmConexionIP is the fallback/admin screen for configuring the SQL connection if the connection test fails.
- FrmMenu is the main shell/orchestrator after authentication; it routes users into functional modules.
4. Security and session flow
- User authentication and authorization are handled through Usuario/, Logica/LUsuarios.cs, Logica/LPermisos.cs, and the corresponding data classes.
- The menu loads permissions and adjusts access based on role; the README indicates an admin vs restricted-permission path.
- Password and sensitive values are handled with crypto helpers in Logica/AES.cs, Encrip.cs, and Desencryptacion.cs.
5. Data access and persistence boundary
- ProyectoOFI/Datos/ contains the SQL-facing classes such as DRecepcion, DControlPatio, DAlmacen, DCompraD, DUsuarios, DReporte, etc.
- This layer is tied to SQL Server and appears to rely heavily on stored procedures.
- The database scripts CoffeeTech.sql and Ultima.sql are part of the repo, indicating the schema and procedural database logic are versioned alongside the app.
6. Core operational domain: coffee flow
- The application tracks the operational lifecycle of coffee lots/tickets across these main business areas:
- Recepción / Transferencia
- Control Patio / secado natural
- Secado Mecánico (SM)
- Análisis / Catación
- Almacén / Bodega / Compra directa
- Reportería
- Configuración y catálogos
- The central data object is a ticket/lote, which moves through these stages and accumulates operational and quality records.
7. Reception and ticket intake
- Recepcion/ handles the initial capture of incoming tickets/lotes and transfer/consolidation workflows.
- Subforms like AddEditTicket, Consolidar, and Transferencia suggest the entry point for a lot into the system.
- The flow is: validate input → persist reception data → update lot status so downstream modules can consume it.
8. Drying and patio operations
- ControlPatio/ models natural drying workflows and patio management.
- SM/ contains the mechanical drying subsystem, with separate forms for entities such as guadiolas, tolvas, verticales, PS/POA, and related operations.
- These modules are operationally similar: select lot/subprocess → record process event → save state and history in the database.
9. Quality analysis
- Analisis/ handles samples and cupping/catation.
- The main artifacts are sample registration and quality assessment, which are then linked back to the lot/ticket.
- This subsystem contributes quality metrics used later by reporting and operational decisions.
10. Storage, movement, and purchase
- Almacen/ and Compras/ represent inventory/storage and direct purchase workflows.
- Otros/ contains many supporting master-data forms: clients, providers, locations, varieties, qualities, turns, materials, damages, areas, etc.
- These screens act as configuration and reference-data boundaries for the operational modules.
11. Reporting and analytics
- Reportes/ is the read-heavy side of the system: dashboard, ticket reports, histories, lot listings, digitization, and tender/processing views.
- Reporting reads aggregated operational data from SQL Server and presents it in forms or exportable views.
- This is the main consumer of the historical trail produced by all operational modules.
12. Cross-cutting services
- Log.cs plus the README indicate errors are written to C:\Log\logerror.txt.
- Services/ApiService.cs provides optional HTTP integration, including an endpoint named /api/ExcelLotesExcelCP, which suggests export or sync support for patio/lot Excel workflows.
- The app also has form-level support for Excel import/export in several modules, indicating file-based interchange alongside the SQL backend.
13. Configuration and environment
- App.config and the connection-setup screen imply runtime configuration is essential to startup.
- The connection string is described as being stored in ConnectionString.xml and protected with AES-based encryption.
- Operationally, the app depends on a reachable SQL Server instance before the main login flow can succeed.
14. How to draw the architecture
- Draw the UI layer as a set of module forms under Login/FrmMenu.
- Place Logica as the mediator/business boundary between UI and persistence.
- Place Datos + SQL Server as the persistence boundary, with stored procedures as the main database interaction mechanism.
- Show two side channels: encrypted connection/configuration and file-based logging, plus a small HTTP API integration for Excel-related exchange.
Main entry points: FrmMenu.cs Main menu · LRecepcion.cs Logica · Login.cs Login · Dashboard.cs Reportes
Components 22
UI layer
WinForms screens and module forms
- Program · Application entry point
ProyectoOFI/Program.cs - Login · First functional gate for connectivity and credentials
ProyectoOFI/Login.cs - Connection setup · Fallback screen for SQL connection configuration
ProyectoOFI/FrmConexionIP.cs - Main menu · Primary application shell and module router
ProyectoOFI/FrmMenu.cs - Recepción · Incoming ticket and transfer workflows
ProyectoOFI/Recepcion/Transferencia.cs - Control patio · Natural drying and patio management
ProyectoOFI/ControlPatio/CUControlPatio.cs - Secado mecánico · Mechanical drying workflows and equipment screens
ProyectoOFI/SM/SecadoMecanico.cs - Análisis · Sampling and cupping/catation screens
ProyectoOFI/Analisis/Catacion.cs - Almacén · Storage and warehouse operations
ProyectoOFI/Almacen/Almacen.cs - Compras · Direct purchase workflows
ProyectoOFI/Compras/ComprasDirectas.cs - Reportes · Dashboard, histories, lot views, and digitation
ProyectoOFI/Reportes/Dashboard.cs - Catálogos · Reference-data maintenance screens
ProyectoOFI/Otros/FrmConfig.cs - Usuario · Profile, recovery, and user-facing account screens
ProyectoOFI/Usuario/FrmPerfil.cs
Business layer
Logica classes coordinating workflows and rules
- Logica · Business rules and orchestration boundary
ProyectoOFI/Logica/LRecepcion.cs - Seguridad · Users, permissions, and encryption helpers
ProyectoOFI/Logica/LUsuarios.cs - Permisos · Role and module permission evaluation
ProyectoOFI/Logica/LPermisos.cs - Operaciones · Reception, patio, drying, analysis, storage, and purchase logic
ProyectoOFI/Logica/LControlPatio.cs
Data layer
SQL-facing classes and database boundary
- Datos · SQL-facing data access classes
- SQL Server · Stored-procedure-backed database
Cross-cutting
Security, config, logging, and integration services
- Config crypto · Connection string protection and AES helpers
ProyectoOFI/Logica/AES.cs - Logger · Error logging to a local file
ProyectoOFI/Log.cs - API service · Optional HTTP integration for Excel exchange
ProyectoOFI/Services/ApiService.cs
Connections 29
- Program → Login: starts · Launches the application at the login gate
- Login → Connection setup: fallback · Routes to connection setup when SQL connectivity fails
- Login → Main menu: authenticates · On success, opens the main shell
- Main menu → Recepción: opens · Navigates to intake workflows
- Main menu → Control patio: opens · Navigates to patio control
- Main menu → Secado mecánico: opens · Navigates to mechanical drying
- Main menu → Análisis: opens · Navigates to quality analysis
- Main menu → Almacén: opens · Navigates to inventory/storage
- Main menu → Compras: opens · Navigates to direct purchases
- Main menu → Reportes: opens · Navigates to reporting and dashboards
- Main menu → Catálogos: opens · Navigates to master data maintenance
- Main menu → Usuario: opens · Navigates to account/profile features
- Recepción → Logica: uses · Routes ticket intake through business rules
- Control patio → Logica: uses · Sends drying events through business rules
- Secado mecánico → Logica: uses · Sends mechanical drying events through business rules
- Análisis → Logica: uses · Sends sample and catation data through business rules
- Almacén → Logica: uses · Sends storage movements through business rules
- Compras → Logica: uses · Sends purchase workflows through business rules
- Reportes → Logica: reads via · Loads historical and aggregated data through the business layer
- Catálogos → Logica: uses · Maintains reference data through business rules
- Usuario → Seguridad: uses · Account and credential workflows depend on security services
- Main menu → Permisos: enforces · Adjusts access based on loaded permissions
- Logica → Datos: calls · Business logic delegates persistence to data access classes
- Seguridad → Datos: calls · User and permission features persist through data access
- Permisos → Datos: calls · Permission checks query the data layer
- Datos → SQL Server: persists to · SQL Server is the main persistence boundary
- Config crypto → Connection setup: protects · Encrypted connection configuration feeds the setup screen
- Logger → Login: records · Startup and authentication errors are written to local logs
- API service → Reportes: integrates · Supports Excel-related exchange and optional HTTP workflows