Skip to main content
The Cliente entity represents a customer in the SGRH system. It stores essential personal information and enforces validation rules to ensure data integrity.

Overview

Cliente is a sealed entity that inherits from EntityBase. It maintains customer details including national identification, name, contact information, and provides methods for updating customer data with proper validation. Namespace: SGRH.Domain.Entities.Clientes Source: ~/workspace/source/SGRH.Domain/Entities/Clientes/Cliente.cs

Properties

ClienteId
int
required
Unique identifier for the customer (primary key).
NationalId
string
required
National identification number (e.g., cedula). Maximum length: 20 characters.
NombreCliente
string
required
Customer’s first name. Maximum length: 100 characters.
ApellidoCliente
string
required
Customer’s last name. Maximum length: 100 characters.
Email
string
required
Customer’s email address. Maximum length: 100 characters.
Telefono
string
required
Customer’s phone number. Maximum length: 20 characters.

Constructor

public Cliente(
    string nationalId,
    string nombreCliente,
    string apellidoCliente,
    string email,
    string telefono)
Creates a new customer instance with full validation.

Parameters

  • nationalId: National ID (max 20 chars, required)
  • nombreCliente: First name (max 100 chars, required)
  • apellidoCliente: Last name (max 100 chars, required)
  • email: Email address (max 100 chars, required)
  • telefono: Phone number (max 20 chars, required)

Validations

All parameters are validated using Guard.AgainstNullOrWhiteSpace to ensure:
  • Values are not null or empty
  • Values do not exceed maximum length constraints

Example

var cliente = new Cliente(
    nationalId: "001-1234567-8",
    nombreCliente: "Juan",
    apellidoCliente: "Pérez",
    email: "[email protected]",
    telefono: "809-555-1234"
);

Methods

ActualizarDatos

public void ActualizarDatos(
    string nombreCliente,
    string apellidoCliente,
    string email,
    string telefono)
Updates customer information with validation.
Note: The NationalId cannot be changed after creation. Only name, email, and phone can be updated.

Parameters

  • nombreCliente: Updated first name (max 100 chars)
  • apellidoCliente: Updated last name (max 100 chars)
  • email: Updated email address (max 100 chars)
  • telefono: Updated phone number (max 20 chars)

Example

cliente.ActualizarDatos(
    nombreCliente: "Juan Carlos",
    apellidoCliente: "Pérez García",
    email: "[email protected]",
    telefono: "809-555-5678"
);

Business Rules

All string properties are validated to ensure:
  1. Non-empty values: No null or whitespace-only strings
  2. Maximum length enforcement: Each field has specific length constraints
  3. Immutable National ID: The national ID cannot be changed after creation
Violations throw ValidationException with descriptive error messages.
The entity uses ClienteId as its primary key, implemented via the GetKey() method from EntityBase.

Usage in Application

The Cliente entity is typically used in:
  • Reservation System: Linked to reservations via ClienteId
  • Customer Management: CRUD operations for customer records
  • Reporting: Customer analytics and history
  • Reserva: References Cliente through ClienteId (see Reserva)

Validation Guards

For detailed information about validation mechanisms, see Validation Guards.

Build docs developers (and LLMs) love