66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace MieSystem.Models
|
|
{
|
|
[Table("asistencia", Schema = "public")]
|
|
public class Asistencia
|
|
{
|
|
[Key]
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
[Column("id")]
|
|
public int Id { get; set; }
|
|
|
|
[Required]
|
|
[Column("expediente_id")]
|
|
public int ExpedienteId { get; set; }
|
|
|
|
[Required]
|
|
[Column("fecha")]
|
|
public DateTime Fecha { get; set; }
|
|
|
|
[Required]
|
|
[Column("estado")]
|
|
public char Estado { get; set; } // P, T, F
|
|
|
|
[Column("hora_entrada")]
|
|
public TimeSpan? HoraEntrada { get; set; }
|
|
|
|
[Column("hora_salida")]
|
|
public TimeSpan? HoraSalida { get; set; }
|
|
|
|
[Column("observaciones")]
|
|
public string? Observaciones { get; set; }
|
|
|
|
[Required]
|
|
[Column("fecha_registro")]
|
|
public DateTime FechaRegistro { get; set; }
|
|
|
|
[StringLength(100)]
|
|
[Column("usuario_registro")]
|
|
public string? UsuarioRegistro { get; set; }
|
|
|
|
// ==========================
|
|
// PROPIEDADES CALCULADAS
|
|
// ==========================
|
|
|
|
[NotMapped]
|
|
public string EstadoTexto => Estado switch
|
|
{
|
|
'P' => "Presente",
|
|
'T' => "Tarde",
|
|
'F' => "Faltó",
|
|
_ => "Desconocido"
|
|
};
|
|
|
|
[NotMapped]
|
|
public string ColorEstado => Estado switch
|
|
{
|
|
'P' => "success",
|
|
'T' => "warning",
|
|
'F' => "danger",
|
|
_ => "secondary"
|
|
};
|
|
}
|
|
}
|