How jose-santillano/punto-venta-csharp-sqlserver-2021 works
Project Type and Purpose
• This is a Windows-based, three-tier “Punto de Venta” (Point of Sale) desktop application written in C# and targeting .NET Framework 4.7.2.
• It follows a classic layered architecture (Presentation → Business → Data) and uses Microsoft SQL Server as its database.
• Key modules include user authentication, inventory (categorías, artículos), proveedores, clientes, ventas, ingresos, and reporting (PDF/Excel via RDLC).
File-Structure Analysis
• Top-level folders:
• CapaPresentacion – Windows Forms UI (forms, resources, report definitions, SqlServerTypes loader)
• CapaNegocio – Business Logic Layer (classes prefixed “N”, e.g., NArticulo, NVenta)
• CapaDatos – Data Access Layer (classes prefixed “D”, e.g., DArticulo, DVenta; ADO.NET dataset files)
• SistemaVentas – Main WinForms executable project tying the three layers together, ClickOnce publish artifacts.
• packages – NuGet packages for reporting (ReportViewerControl) and spatial types.
• dbventascopia.bak – Sample/backup of the SQL Server database.
• Each layer compiles to its own assembly: CapaDatos.dll, CapaNegocio.dll, CapaPresentacion.dll, and the final SistemaVentas.exe which references the three.
Assembly and Dependency Mapping (from README & file tree)
• The UI calls methods in CapaNegocio (business), which in turn calls CapaDatos (data).
• CapaDatos opens connections (Conexion.cs), executes queries or stored procedures against the SQL Server database.
• Reporting uses RDLC files (rpt*.rdlc) loaded in the UI via ReportViewerControl.Winforms.
Main Components
a. Client (User) with Windows Forms UI
b. Presentation Layer
• Forms (Login, Artículo, Categoría, Cliente, Venta, Ingreso, Reportes)
• RDLC Report definitions & ReportViewer control
• SqlServerTypes loader for spatial data
c. Business Logic Layer (CapaNegocio)
• NArticulo, NCategoria, NCliente, NProveedor, NTrabajador, NVenta, NIngreso, NDetalle_Venta, NDetalle_Ingreso
d. Data Access Layer (CapaDatos)
• Conexion.cs (DB connection management)
• D* classes for each entity
• Typed DataSet (dbventasDataSet.xsd)
e. Database Server
• SQL Server database (tables: Artículos, Categorías, Clientes, Ventas, Ingresos, Detalles)
f. External Dependencies
• Microsoft.ReportingServices.ReportViewerControl.Winforms
• Microsoft.SqlServer.Types (native loader for geography/data-types)
• ClickOnce deployment artifacts
Relationships and Data Flows
• User → UI (forms)
• UI → BLL: presentation invokes methods (e.g., NVenta.Insertar(), NArticulo.Mostrar())
• BLL → DAL: business classes call data classes (e.g., DVenta.Insertar())
• DAL → DB: SQL queries/stored procedures via ADO.NET
• UI → ReportViewer → Typed DataSet → DB (for on-the-fly report generation)
• Deployment: SistemaVentas.exe bundles all layer assemblies + config + SqlServerTypes + RDLC
Architectural Patterns & Principles
• Layered architecture (Separation of Concerns)
• ADO.NET Typed DataSets in DAL
• Strongly-typed business objects in BLL
• WinForms UI with code-behind
• ClickOnce for deployment/distribution