Skip to main content

Overview

The Canchas Deportivas application uses SQL Server as its database management system. The database is named DB_canchasdeportivas and contains tables for managing users, clients, courts (canchas), and reservations.

Database Tables

Usuarios (Users)

Stores system user accounts with authentication credentials.
ColumnTypeDescription
IdUsuariointPrimary key, auto-increment
NombrenvarcharUsername for authentication
ClavenvarcharPassword (hashed)
EstadobitActive status (true/false)
Entity Class: CE_usuarios
public class CE_usuarios
{
    public int IdUsuario { get; set; }
    public string? Nombre { get; set; }
    public string? Clave { get; set; }
    public bool Estado { get; set; }
}

Clientes (Clients)

Stores client information for making reservations.
ColumnTypeDescription
IdClienteintPrimary key, auto-increment
NombrenvarcharClient full name
TelefononvarcharContact phone number
CorreonvarcharEmail address
EstadobitActive status (true/false)
Entity Class: CE_Clientes
public class CE_Clientes
{
    public int IdCliente { get; set; }
    public string? Nombre { get; set; }
    public string? Telefono { get; set; }
    public string? Correo { get; set; }
    public bool Estado { get; set; }
}

Canchas (Courts)

Stores sports court information with pricing.
ColumnTypeDescription
IdCanchaintPrimary key, auto-increment
NombrenvarcharCourt name
TiponvarcharType of court (e.g., futbol, basketball)
PrecioPorHoradecimalHourly rental price
EstadonvarcharCourt status
Entity Class: CE_Canchas
public class CE_Canchas
{
    public int IdCancha { get; set; }
    public string? Nombre { get; set; }
    public string? Tipo { get; set; }
    public decimal PrecioPorHora { get; set; }
    public string? Estado { get; set; }
}

Reservas (Reservations)

Stores court reservations with time slots.
ColumnTypeDescription
IdReservaintPrimary key, auto-increment
IdCanchaintForeign key to Canchas table
IdClienteintForeign key to Clientes table
IdUsuariointForeign key to Usuarios table
FechaReservadatetimeReservation date
HoraIniciotimeStart time
HoraFintimeEnd time
ComentarionvarcharAdditional notes
EstadobitActive status (true/false)
Entity Class: CE_Reservas
public class CE_Reservas
{
    public int IdReserva { get; set; }
    public int IdCancha { get; set; }
    public int IdCliente { get; set; }
    public int IdUsuario { get; set; }
    public DateTime FechaReserva { get; set; }
    public TimeSpan HoraInicio { get; set; }
    public TimeSpan HoraFin { get; set; }
    public string? NombreCliente { get; set; }
    public String? NombreCancha { get; set; }
    public string? Comentario { get; set; }
    public bool Estado { get; set; }
}

Relationships

  • Reservas has foreign key relationships to:
    • Canchas (IdCancha) - One court can have many reservations
    • Clientes (IdCliente) - One client can make many reservations
    • Usuarios (IdUsuario) - One user can create many reservations

Entity Relationships Diagram

┌─────────────┐
│  Usuarios   │
├─────────────┤
│ IdUsuario PK│
│ Nombre      │
│ Clave       │
│ Estado      │
└──────┬──────┘

       │ 1:N

┌──────┴──────┐     ┌─────────────┐
│  Reservas   │────▶│  Clientes   │
├─────────────┤ N:1 ├─────────────┤
│ IdReserva PK│     │ IdCliente PK│
│ IdCancha  FK│     │ Nombre      │
│ IdCliente FK│     │ Telefono    │
│ IdUsuario FK│     │ Correo      │
│ FechaReserva│     │ Estado      │
│ HoraInicio  │     └─────────────┘
│ HoraFin     │
│ Comentario  │
│ Estado      │
└──────┬──────┘

       │ N:1

┌─────────────┐
│   Canchas   │
├─────────────┤
│ IdCancha  PK│
│ Nombre      │
│ Tipo        │
│ PrecioPorHor│
│ Estado      │
└─────────────┘

Data Access Layer

The application uses a three-tier architecture with dedicated data access classes:
  • CD_Usuarios - User data operations
  • CD_Clientes - Client data operations
  • CD_Canchas - Court data operations
  • CD_Reservas - Reservation data operations
  • CD_TiposReservas - Reservation types operations
All data access classes inherit from CD_conexion for database connectivity.

Build docs developers (and LLMs) love