TarifaTemporada entity defines pricing for room categories during specific seasons. It enables dynamic pricing strategies based on demand, holidays, and seasonal variations.
Overview
TarifaTemporada associates a room category with a season and a specific price point. This allows flexible pricing where the same room category can have different rates during high season, low season, holidays, etc.
Namespace: SGRH.Domain.Entities.Habitaciones
Source: ~/workspace/source/SGRH.Domain/Entities/Habitaciones/TarifaTemporada.cs
Properties
Unique identifier for the seasonal rate (primary key).
Reference to the room category (e.g., Standard, Deluxe, Suite).
Reference to the season (e.g., High Season, Low Season, Holidays).
Price per night for this category during this season. Must be > 0.
Constructor
Parameters
- categoriaHabitacionId: Valid room category ID (must be > 0)
- temporadaId: Valid season ID (must be > 0)
- precio: Price per night (must be > 0)
Validations
- All IDs must be greater than 0 (
Guard.AgainstOutOfRange) - Price must be greater than 0
Example
Methods
ActualizarPrecio
- nuevoPrecio: New price (must be > 0)
- Price must be greater than 0
Price updates only affect future reservations. Existing reservations maintain their captured price snapshots.
Pricing Strategy
Multi-dimensional Pricing
TarifaTemporada enables flexible pricing based on two dimensions:
- Room Category: Different room types (Standard, Deluxe, Suite)
- Season: Different time periods (High, Low, Holidays)
Example Pricing Matrix
| Category | Low Season | High Season | Holidays |
|---|---|---|---|
| Standard | $100 | $150 | $200 |
| Deluxe | $150 | $225 | $300 |
| Suite | $250 | $375 | $500 |
Implementation
Usage in Reservations
Price Determination
When a reservation is created or dates are changed:- System determines the season based on check-in date
- Retrieves
TarifaTemporadafor each room’s category + season - Captures price as snapshot in
DetalleReserva.TarifaAplicada
Policy Integration
TheIReservaDomainPolicy.GetTarifaAplicada() method:
- Get room’s
CategoriaHabitacionId - Determine
TemporadaIdfromfechaEntrada - Query
TarifaTemporadaby category + season - Return
Precio
Snapshot Pattern
Prices are captured at reservation time:- Reservations aren’t affected by future price changes
- Historical accuracy for reporting
- Price consistency for guests
Business Rules
Price Validation
Price Validation
- Prices must always be greater than zero
- Negative or zero prices are rejected with
ValidationException - Ensures revenue integrity
Unique Constraints
Unique Constraints
While not enforced at the entity level, the database ensures:
- One price per category per season (unique constraint)
- Prevents pricing conflicts
- Enforced by EF Core configuration
Fallback Pricing
Fallback Pricing
If no
TarifaTemporada exists for a category/season combination:- System can fall back to
CategoriaHabitacion.PrecioBase - Implementation depends on application layer policy
- Prevents reservation failures due to missing rates
Common Scenarios
Seasonal Rate Adjustment
Seasonal Rate Adjustment
Scenario: Increase high season rates by 10%
New Season Setup
New Season Setup
Scenario: Create rates for a new Holiday season
Price Comparison
Price Comparison
Scenario: Show guest price differences by date
Related Entities
CategoriaHabitacion
Defines the room category:Temporada
Defines the season period:Related Documentation
- Habitacion - Room entity
- Reserva - Reservation with price snapshots
- Reservation Policies - Price determination logic
- Validation Guards - Validation mechanisms