Architecture Overview
SMAF follows a classic three-tier architecture pattern that separates concerns into distinct layers, promoting maintainability, scalability, and clear separation of responsibilities.Three-Tier Architecture
1. Presentation Layer (InapescaWeb)
The presentation layer is built with ASP.NET Web Forms and handles all user interface and interaction logic.Key Components
Web Forms (.aspx)
ASPX pages for user interaction including Solicitudes, Autorizaciones, Comprobaciones, and Pagos
Code-Behind (.aspx.cs)
C# code-behind files containing page-level business logic and event handlers
Telerik Controls
Rich UI components including RadGrid, RadCalendar, RadUpload, and RadTreeView
Master Pages
Consistent layout and navigation across the application
Directory Structure
Web Configuration
Connection strings are encrypted using custom encryption (MngEncriptacion) for security. The system supports multiple database connections for different modules (SMAF, DGAIPP, Contratos).
Example Page Implementation
2. Business Logic Layer (InapescaWeb.BRL)
The Business Logic Layer encapsulates all business rules, validation, and coordination between the presentation and data access layers.Key Manager Classes
Business Logic Examples
3. Data Access Layer (InapescaWeb.DAL)
The Data Access Layer handles all database interactions and data persistence logic.Key Data Manager Classes
Database Connection Management
Entity Layer (InapescaWeb.Entidades)
Domain entities represent business objects and data structures.Core Entities
Usuario
User information including credentials, role, location, and personal data
Comision
Travel commission with all details: dates, destination, budget, approvals
comprobacion
Expense verification records with receipts and amounts
Pagos
Payment records with bank details and transaction information
Technology Stack
ASP.NET 4.0
Web application framework with Web Forms
C# .NET
Primary programming language
MySQL
Relational database for data persistence
Telerik UI
Rich web UI component suite
IIS
Web server for hosting
Visual Studio
Development environment
Key Technologies
| Component | Technology | Purpose |
|---|---|---|
| Web Framework | ASP.NET Web Forms 4.0 | Server-side web application framework |
| Language | C# | Business logic and data access |
| Database | MySQL | Data persistence and storage |
| ORM/Data Access | MySql.Data.MySqlClient | Database connectivity |
| UI Components | Telerik RadControls | Rich UI widgets (Grid, Calendar, Upload, etc.) |
| Reporting | Microsoft ReportViewer | PDF report generation |
| Document Processing | XML/PDF parsing | Fiscal receipt validation (CFDI) |
| Encryption | Custom (MngEncriptacion) | Connection string and password encryption |
Component Interaction Flow
Example: Creating a Commission Request
Example: Processing Payment
Security Architecture
Authentication & Authorization
Security Features
- Encrypted connection strings using custom encryption
- SQL injection prevention via parameterized queries
- Input validation with regular expressions
- Session timeout enforcement (30 minutes)
- Role-based access control throughout the application
- X-Frame-Options header to prevent clickjacking
- File upload restrictions (50MB max, validation)
Project Structure
The complete solution structure in Visual Studio:Database Architecture
SMAF uses MySQL as its relational database with the following characteristics:Database Structure
- Stored Procedures: Business logic encapsulated in database
- Multiple Databases: Separate databases for SMAF, DGAIPP, and Contratos modules
- Encrypted Connections: All connection strings encrypted in configuration
Key Database Operations
File System Integration
SMAF stores documents in the file system:- XML files: CFDI fiscal receipts (v3.3, v4.0)
- PDF files: Receipt PDFs, reports, official documents
- Upload directories: Organized by year, project, and commission
Performance Considerations
Connection Pooling
MySQL connection pooling for efficient database access
Telerik CDN
UI components served from CDN to reduce server load
Session State
In-memory session management with 30-minute timeout
File Streaming
Large files served via streaming to minimize memory usage
Next Steps
Development Guide
Set up your development environment and build the project
API Reference
Detailed API documentation for all layers
Database Schema
Complete database schema and stored procedures
Deployment
Deploy SMAF to IIS production environment