Nueva mejoras Y estabilidad
This commit is contained in:
@@ -1,33 +1,64 @@
|
||||
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; }
|
||||
public int ExpedienteId { get; set; }
|
||||
public DateTime Fecha { get; set; }
|
||||
public string Estado { get; set; } // P, T, F
|
||||
public TimeSpan? HoraEntrada { get; set; }
|
||||
public TimeSpan? HoraSalida { get; set; }
|
||||
public string Observaciones { get; set; }
|
||||
public DateTime FechaRegistro { get; set; }
|
||||
public string UsuarioRegistro { get; set; }
|
||||
|
||||
// Propiedades calculadas
|
||||
[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" => "Falto",
|
||||
'P' => "Presente",
|
||||
'T' => "Tarde",
|
||||
'F' => "Faltó",
|
||||
_ => "Desconocido"
|
||||
};
|
||||
|
||||
[NotMapped]
|
||||
public string ColorEstado => Estado switch
|
||||
{
|
||||
"P" => "success",
|
||||
"T" => "warning",
|
||||
"F" => "danger",
|
||||
'P' => "success",
|
||||
'T' => "warning",
|
||||
'F' => "danger",
|
||||
_ => "secondary"
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user