cambios de denuncias
This commit is contained in:
3
Antifraude.Net/GestionaDenunciasAN/Models/ApiError.cs
Normal file
3
Antifraude.Net/GestionaDenunciasAN/Models/ApiError.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record ApiError(string Error, bool SessionExpired = false);
|
||||
3
Antifraude.Net/GestionaDenunciasAN/Models/ContextDto.cs
Normal file
3
Antifraude.Net/GestionaDenunciasAN/Models/ContextDto.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record ContextDto(string Id, string Name);
|
||||
@@ -1,108 +1,282 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace GestionaDenunciasAN.Models
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public class DenunciasGestiona
|
||||
{
|
||||
public class DenunciasGestiona
|
||||
public int Id_RegistroDenuncia { get; set; }
|
||||
public int Id_Denuncia { get; set; }
|
||||
public DateTime Fecha { get; set; } = DateTime.MinValue;
|
||||
public string Expediente_Gestiona { get; set; } = string.Empty;
|
||||
public string CodigoExpedienteGestiona { get; set; } = string.Empty;
|
||||
public int Id_Persona_Gestiona { get; set; }
|
||||
public string Etiqueta { get; set; } = string.Empty;
|
||||
public string Estado { get; set; } = string.Empty;
|
||||
|
||||
public string Tipo_Denuncia { get; set; } = string.Empty;
|
||||
public string TipoDenunciante { get; set; } = string.Empty;
|
||||
public bool EsPersonaJuridica { get; set; }
|
||||
public string Nombre { get; set; } = string.Empty;
|
||||
public string PrimerApellido { get; set; } = string.Empty;
|
||||
public string SegundoApellido { get; set; } = string.Empty;
|
||||
public string Apellidos { get; set; } = string.Empty;
|
||||
public string RazonSocial { get; set; } = string.Empty;
|
||||
public string Sexo { get; set; } = string.Empty;
|
||||
public string Dni { get; set; } = string.Empty;
|
||||
public string TipoDocumentoIdentificativo { get; set; } = string.Empty;
|
||||
public string PaisOrigen { get; set; } = string.Empty;
|
||||
public string Asunto { get; set; } = string.Empty;
|
||||
public string A_Quien_Denuncia { get; set; } = string.Empty;
|
||||
public string DenunciadoDetalle { get; set; } = string.Empty;
|
||||
public string Descripcion_Denuncia { get; set; } = string.Empty;
|
||||
public string Denunciado_Ante_Inst { get; set; } = string.Empty;
|
||||
public string OrganismoDenunciado { get; set; } = string.Empty;
|
||||
public string SolicitaProteccion { get; set; } = string.Empty;
|
||||
public string MedidasProteccionSolicitadas { get; set; } = string.Empty;
|
||||
public string Modalidad_Informacion { get; set; } = string.Empty;
|
||||
public string Lugar_Hechos { get; set; } = string.Empty;
|
||||
public DateTime Fecha_Hechos { get; set; } = DateTime.MinValue;
|
||||
public string AutorizaRemision { get; set; } = string.Empty;
|
||||
public string PreferenciaRemision { get; set; } = string.Empty;
|
||||
public string Notificacion_Preferencia { get; set; } = string.Empty;
|
||||
public string Notificacion_Electronica { get; set; } = string.Empty;
|
||||
public string SeguimientoOnline { get; set; } = string.Empty;
|
||||
public string NotificacionPostal { get; set; } = string.Empty;
|
||||
public string Correo_Electronico { get; set; } = string.Empty;
|
||||
public string Notificacion_Sms { get; set; } = string.Empty;
|
||||
public bool Condiciones { get; set; }
|
||||
public string Comments { get; set; } = string.Empty;
|
||||
public string Telefono { get; set; } = string.Empty;
|
||||
public string Direccion { get; set; } = string.Empty;
|
||||
public string DireccionTipoVia { get; set; } = string.Empty;
|
||||
public string DireccionNumero { get; set; } = string.Empty;
|
||||
public string DireccionPiso { get; set; } = string.Empty;
|
||||
public string DireccionPuerta { get; set; } = string.Empty;
|
||||
public string DireccionBloque { get; set; } = string.Empty;
|
||||
public string DireccionEscalera { get; set; } = string.Empty;
|
||||
public string DireccionExtra { get; set; } = string.Empty;
|
||||
public string Municipio { get; set; } = string.Empty;
|
||||
public string Provincia { get; set; } = string.Empty;
|
||||
public string CodigoPostal { get; set; } = string.Empty;
|
||||
public string Pais { get; set; } = string.Empty;
|
||||
public string CamposFormularioJson { get; set; } = string.Empty;
|
||||
public string TextoOriginalReport { get; set; } = string.Empty;
|
||||
|
||||
public bool Confidencial { get; set; }
|
||||
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public bool EsActualizacion { get; set; }
|
||||
|
||||
public Guid ProcedureId { get; set; } = Guid.Empty;
|
||||
public Guid GroupId { get; set; } = Guid.Empty;
|
||||
|
||||
public string NombreDenuncia { get; set; } = string.Empty;
|
||||
public string EstadoDenuncia { get; set; } = string.Empty;
|
||||
public string ArchivoElegido { get; set; } = string.Empty;
|
||||
public DateTime FechaSubidaAGestiona { get; set; } = DateTime.MinValue;
|
||||
|
||||
public bool EnGestiona { get; set; }
|
||||
public bool EnRechazada { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string NombreResuelto => ResolveValue(Nombre, "nombre");
|
||||
|
||||
[JsonIgnore]
|
||||
public string PrimerApellidoResuelto => ResolveValue(PrimerApellido, "1 apellido", "primer apellido");
|
||||
|
||||
[JsonIgnore]
|
||||
public string SegundoApellidoResuelto => ResolveValue(SegundoApellido, "2 apellido", "segundo apellido");
|
||||
|
||||
[JsonIgnore]
|
||||
public string ApellidosResueltos
|
||||
{
|
||||
// Propiedades existentes
|
||||
public int Id_RegistroDenuncia { get; set; }
|
||||
public int Id_Denuncia { get; set; }
|
||||
public DateTime Fecha { get; set; }
|
||||
public string Expediente_Gestiona { get; set; }
|
||||
public int Id_Persona_Gestiona { get; set; }
|
||||
public string Etiqueta { get; set; }
|
||||
public string Estado { get; set; }
|
||||
public string Tipo_Denuncia { get; set; }
|
||||
public string? Nombre { get; set; }
|
||||
public string? Apellidos { get; set; }
|
||||
public string? Sexo { get; set; }
|
||||
public string? Dni { get; set; }
|
||||
public string Asunto { get; set; }
|
||||
public string A_Quien_Denuncia { get; set; }
|
||||
public string Descripcion_Denuncia { get; set; }
|
||||
public string Denunciado_Ante_Inst { get; set; }
|
||||
public string? Modalidad_Informacion { get; set; }
|
||||
public string Lugar_Hechos { get; set; }
|
||||
public DateTime Fecha_Hechos { get; set; }
|
||||
public string? Notificacion_Preferencia { get; set; }
|
||||
public string? Notificacion_Electronica { get; set; }
|
||||
public string? Correo_Electronico { get; set; }
|
||||
public string? Notificacion_Sms { get; set; }
|
||||
public bool Condiciones { get; set; }
|
||||
public string? Comments { get; set; }
|
||||
|
||||
// Nuevas propiedades
|
||||
public string NombreDenuncia { get; set; }
|
||||
public string EstadoDenuncia { get; set; }
|
||||
public string ArchivoElegido { get; set; }
|
||||
public DateTime FechaSubidaAGestiona { get; set; } // Nueva propiedad
|
||||
|
||||
// Constructor por defecto
|
||||
public DenunciasGestiona()
|
||||
get
|
||||
{
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(Apellidos))
|
||||
{
|
||||
return Apellidos.Trim();
|
||||
}
|
||||
|
||||
// Constructor parametrizado que inicializa todos los campos, incluida la nueva propiedad
|
||||
public DenunciasGestiona(
|
||||
int idRegistroDenuncia,
|
||||
int idDenuncia,
|
||||
DateTime fecha,
|
||||
string expedienteGestiona,
|
||||
int idPersonaGestiona,
|
||||
string etiqueta,
|
||||
string estado,
|
||||
string tipoDenuncia,
|
||||
string? nombre,
|
||||
string? apellidos,
|
||||
string? sexo,
|
||||
string? dni,
|
||||
string asunto,
|
||||
string aQuienDenuncia,
|
||||
string descripcionDenuncia,
|
||||
string denunciadoAnteInst,
|
||||
string? modalidadInformacion,
|
||||
string lugarHechos,
|
||||
DateTime fechaHechos,
|
||||
string? notificacionPreferencia,
|
||||
string? notificacionElectronica,
|
||||
string? correoElectronico,
|
||||
string? notificacionSms,
|
||||
bool condiciones,
|
||||
string? comments,
|
||||
string nombreDenuncia,
|
||||
string estadoDenuncia,
|
||||
string archivoElegido,
|
||||
DateTime fechaSubidaAGestiona)
|
||||
{
|
||||
Id_RegistroDenuncia = idRegistroDenuncia;
|
||||
Id_Denuncia = idDenuncia;
|
||||
Fecha = fecha;
|
||||
Expediente_Gestiona = expedienteGestiona;
|
||||
Id_Persona_Gestiona = idPersonaGestiona;
|
||||
Etiqueta = etiqueta;
|
||||
Estado = estado;
|
||||
Tipo_Denuncia = tipoDenuncia;
|
||||
Nombre = nombre;
|
||||
Apellidos = apellidos;
|
||||
Sexo = sexo;
|
||||
Dni = dni;
|
||||
Asunto = asunto;
|
||||
A_Quien_Denuncia = aQuienDenuncia;
|
||||
Descripcion_Denuncia = descripcionDenuncia;
|
||||
Denunciado_Ante_Inst = denunciadoAnteInst;
|
||||
Modalidad_Informacion = modalidadInformacion;
|
||||
Lugar_Hechos = lugarHechos;
|
||||
Fecha_Hechos = fechaHechos;
|
||||
Notificacion_Preferencia = notificacionPreferencia;
|
||||
Notificacion_Electronica = notificacionElectronica;
|
||||
Correo_Electronico = correoElectronico;
|
||||
Notificacion_Sms = notificacionSms;
|
||||
Condiciones = condiciones;
|
||||
Comments = comments;
|
||||
NombreDenuncia = nombreDenuncia;
|
||||
EstadoDenuncia = estadoDenuncia;
|
||||
ArchivoElegido = archivoElegido;
|
||||
FechaSubidaAGestiona = fechaSubidaAGestiona;
|
||||
return string.Join(
|
||||
' ',
|
||||
new[] { PrimerApellidoResuelto, SegundoApellidoResuelto }
|
||||
.Where(value => !string.IsNullOrWhiteSpace(value)));
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string RazonSocialResuelta => ResolveValue(RazonSocial, "razon social");
|
||||
|
||||
[JsonIgnore]
|
||||
public string DocumentoResuelto => ResolveValue(
|
||||
Dni,
|
||||
"nif dni nie",
|
||||
"dni",
|
||||
"nif",
|
||||
"nie",
|
||||
"cif",
|
||||
"otro documento identificativo");
|
||||
|
||||
[JsonIgnore]
|
||||
public bool EsAnonima
|
||||
{
|
||||
get
|
||||
{
|
||||
if (IndicaDenunciaIdentificada(Tipo_Denuncia))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Confidencial)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IndicaDenunciaAnonima(Tipo_Denuncia))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return string.IsNullOrWhiteSpace(DocumentoResuelto) &&
|
||||
string.IsNullOrWhiteSpace(NombreResuelto) &&
|
||||
string.IsNullOrWhiteSpace(RazonSocialResuelta);
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public string NombreDenuncianteMostrar =>
|
||||
EsPersonaJuridica
|
||||
? RazonSocialResuelta
|
||||
: string.Join(
|
||||
' ',
|
||||
new[] { NombreResuelto, PrimerApellidoResuelto, SegundoApellidoResuelto }
|
||||
.Where(value => !string.IsNullOrWhiteSpace(value)));
|
||||
|
||||
[JsonIgnore]
|
||||
public string ExpedienteGestionaMostrable
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(CodigoExpedienteGestiona))
|
||||
{
|
||||
return CodigoExpedienteGestiona.Trim();
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(Expediente_Gestiona))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
return string.Equals(Expediente_Gestiona, "Pendiente", StringComparison.OrdinalIgnoreCase)
|
||||
? "Pendiente"
|
||||
: "Pendiente de sincronizar";
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<ReportFieldEntry> GetCamposFormulario()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(CamposFormularioJson))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return JsonSerializer.Deserialize<List<ReportFieldEntry>>(CamposFormularioJson) ?? [];
|
||||
}
|
||||
catch
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCamposFormulario(IEnumerable<ReportFieldEntry> fields)
|
||||
{
|
||||
var list = fields?.ToList() ?? [];
|
||||
CamposFormularioJson = list.Count == 0
|
||||
? string.Empty
|
||||
: JsonSerializer.Serialize(list);
|
||||
}
|
||||
|
||||
public static bool IndicaDenunciaAnonima(string? tipoDenuncia)
|
||||
{
|
||||
var normalized = NormalizeLabel(tipoDenuncia);
|
||||
if (string.IsNullOrWhiteSpace(normalized))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IndicaDenunciaIdentificada(tipoDenuncia))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return normalized == "anonima" ||
|
||||
normalized == "anonimo" ||
|
||||
normalized.Contains("denuncia anonima", StringComparison.Ordinal) ||
|
||||
normalized.Contains("anonima", StringComparison.Ordinal) ||
|
||||
normalized.Contains("anonimo", StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
public static bool IndicaDenunciaIdentificada(string? tipoDenuncia)
|
||||
{
|
||||
var normalized = NormalizeLabel(tipoDenuncia);
|
||||
if (string.IsNullOrWhiteSpace(normalized))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return normalized.Contains("no anonima", StringComparison.Ordinal) ||
|
||||
normalized.Contains("no anonimo", StringComparison.Ordinal) ||
|
||||
normalized.Contains("deseo identificarme", StringComparison.Ordinal) ||
|
||||
normalized.Contains("quiero identificarme", StringComparison.Ordinal) ||
|
||||
normalized.Contains("identificarme", StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private string ResolveValue(string currentValue, params string[] fallbackLabels)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(currentValue))
|
||||
{
|
||||
return currentValue.Trim();
|
||||
}
|
||||
|
||||
var labels = fallbackLabels
|
||||
.Select(NormalizeLabel)
|
||||
.ToHashSet(StringComparer.Ordinal);
|
||||
|
||||
foreach (var field in GetCamposFormulario())
|
||||
{
|
||||
if (labels.Contains(NormalizeLabel(field.Label)) &&
|
||||
!string.IsNullOrWhiteSpace(field.Value))
|
||||
{
|
||||
return field.Value.Trim();
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static string NormalizeLabel(string? value)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var normalized = value.Normalize(NormalizationForm.FormD);
|
||||
var builder = new StringBuilder(normalized.Length);
|
||||
|
||||
foreach (var ch in normalized)
|
||||
{
|
||||
if (CharUnicodeInfo.GetUnicodeCategory(ch) != UnicodeCategory.NonSpacingMark)
|
||||
{
|
||||
builder.Append(char.ToLowerInvariant(ch));
|
||||
}
|
||||
}
|
||||
|
||||
return builder.ToString().Normalize(NormalizationForm.FormC).Trim();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace GestionaDenunciasAN.Models
|
||||
{
|
||||
public class ExpedienteTerceroDto
|
||||
{
|
||||
public string FileUrl { get; set; } = "";
|
||||
public string? CodigoExpediente { get; set; } // name / code / etc.
|
||||
public string? Asunto { get; set; } // subject / free_title
|
||||
public DateTimeOffset? FechaCreacion { get; set; }
|
||||
public string? Estado { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
// Models/FicherosDenuncias.cs
|
||||
using System;
|
||||
|
||||
namespace GestionaDenunciasAN.Models
|
||||
{
|
||||
@@ -13,7 +14,7 @@ namespace GestionaDenunciasAN.Models
|
||||
// Descripción del fichero (puede ser nula)
|
||||
public string? Descripcion { get; set; }
|
||||
|
||||
// Fecha de creación del fichero
|
||||
// Fecha de creación del fichero original
|
||||
public DateTime Fecha { get; set; }
|
||||
|
||||
// Observaciones
|
||||
@@ -28,12 +29,20 @@ namespace GestionaDenunciasAN.Models
|
||||
// Fichero completo en formato byte array (BLOB)
|
||||
public byte[] Fichero { get; set; }
|
||||
|
||||
// Constructor por defecto
|
||||
public FicherosDenuncias()
|
||||
{
|
||||
}
|
||||
// → Nuevo: marca si ya se subió a Gestión
|
||||
public bool Subido { get; set; }
|
||||
|
||||
// → Nuevo: fecha en que se subió por última vez
|
||||
public DateTime? FechaSubida { get; set; }
|
||||
|
||||
// Hash SHA-256 del contenido, para evitar re-subir adjuntos repetidos.
|
||||
public string ContentSha256 { get; set; } = string.Empty;
|
||||
|
||||
public bool EsReport =>
|
||||
string.Equals(NombreFichero, "report.txt", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
public FicherosDenuncias() { }
|
||||
|
||||
// Constructor parametrizado que inicializa todos los campos
|
||||
public FicherosDenuncias(
|
||||
int id_Fichero,
|
||||
int id_Tipo,
|
||||
@@ -42,7 +51,8 @@ namespace GestionaDenunciasAN.Models
|
||||
string observaciones,
|
||||
int id_Denuncia,
|
||||
string nombreFichero,
|
||||
byte[] fichero)
|
||||
byte[] fichero
|
||||
)
|
||||
{
|
||||
Id_Fichero = id_Fichero;
|
||||
Id_Tipo = id_Tipo;
|
||||
@@ -52,6 +62,8 @@ namespace GestionaDenunciasAN.Models
|
||||
Id_Denuncia = id_Denuncia;
|
||||
NombreFichero = nombreFichero;
|
||||
Fichero = fichero;
|
||||
Subido = false;
|
||||
FechaSubida = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record FileDownloadResult(byte[] Content, string FileName);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed class GestionaExpedienteInfo
|
||||
{
|
||||
public string FileUrl { get; set; } = string.Empty;
|
||||
public string? CodigoExpediente { get; set; }
|
||||
public string? FreeTitle { get; set; }
|
||||
}
|
||||
11
Antifraude.Net/GestionaDenunciasAN/Models/GestionaOptions.cs
Normal file
11
Antifraude.Net/GestionaDenunciasAN/Models/GestionaOptions.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace GestionaDenunciasAN.Models
|
||||
{
|
||||
public class GestionaOptions
|
||||
{
|
||||
public string ApiBase { get; set; } = null!;
|
||||
public string AccessToken { get; set; } = null!;
|
||||
public string UserLink { get; set; } = null!;
|
||||
public string GroupLink { get; set; } = null!;
|
||||
public string Location { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
3
Antifraude.Net/GestionaDenunciasAN/Models/GlSession.cs
Normal file
3
Antifraude.Net/GestionaDenunciasAN/Models/GlSession.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record GlSession(string Id, string Username, string? Role = null);
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed class GlobalLeaksStoredSession
|
||||
{
|
||||
public string Username { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string? SessionId { get; set; }
|
||||
public string? Role { get; set; }
|
||||
public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
|
||||
public bool HasActiveSession => !string.IsNullOrWhiteSpace(SessionId);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record ImportSummary(
|
||||
int TotalCandidates,
|
||||
int ImportedCount,
|
||||
IReadOnlyList<string> Errors,
|
||||
IReadOnlyList<int>? ImportedComplaintIds = null);
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record InboxUserState
|
||||
{
|
||||
public string Username { get; init; } = string.Empty;
|
||||
public DateTimeOffset? LastSuccessfulDownloadAtUtc { get; init; }
|
||||
public DateTimeOffset? LastDownloadedReportMomentUtc { get; init; }
|
||||
public bool HasPreviousDownloads => LastDownloadedReportMomentUtc is not null;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record LoginRequest(string Username, string Password, string Authcode);
|
||||
@@ -0,0 +1,3 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record LoginResponse(string Username);
|
||||
25
Antifraude.Net/GestionaDenunciasAN/Models/ReportDto.cs
Normal file
25
Antifraude.Net/GestionaDenunciasAN/Models/ReportDto.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record ReportDto
|
||||
{
|
||||
public string Id { get; init; } = string.Empty;
|
||||
public int? Progressive { get; init; }
|
||||
public string? ContextId { get; init; }
|
||||
public string? ContextName { get; init; }
|
||||
public string? CreationDate { get; init; }
|
||||
public string? UpdateDate { get; init; }
|
||||
public string? ExpirationDate { get; init; }
|
||||
public string? ReminderDate { get; init; }
|
||||
public string? AccessDate { get; init; }
|
||||
public string? LastAccess { get; init; }
|
||||
public string? Status { get; init; }
|
||||
public bool Updated { get; init; }
|
||||
public string? Label { get; init; }
|
||||
public bool DownloadedByCurrentUser { get; init; }
|
||||
public bool DownloadedByAnotherUser { get; init; }
|
||||
public string? LastDownloadedByUsername { get; init; }
|
||||
public string? LastDownloadedAt { get; init; }
|
||||
public bool AlreadyImported { get; init; }
|
||||
public bool AlreadyInGestiona { get; init; }
|
||||
public string? TrackingNote { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed class ReportFieldEntry
|
||||
{
|
||||
public int Order { get; set; }
|
||||
public string Section { get; set; } = string.Empty;
|
||||
public string Label { get; set; } = string.Empty;
|
||||
public string Value { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed record ReportSummaryDto
|
||||
{
|
||||
public string Id { get; init; } = string.Empty;
|
||||
public int? Progressive { get; init; }
|
||||
public string? CreationDate { get; init; }
|
||||
public string? UpdateDate { get; init; }
|
||||
public string? LastAccess { get; init; }
|
||||
public string? AccessDate { get; init; }
|
||||
public int? DaysSinceCreation { get; init; }
|
||||
public int? DaysSinceAccess { get; init; }
|
||||
public string? Status { get; init; }
|
||||
public string? Label { get; init; }
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed class ThirdPartyAddressData
|
||||
{
|
||||
public string? Street { get; set; }
|
||||
public string? Number { get; set; }
|
||||
public string? Floor { get; set; }
|
||||
public string? Door { get; set; }
|
||||
public string? Block { get; set; }
|
||||
public string? Stair { get; set; }
|
||||
public string? Municipality { get; set; }
|
||||
public string? Province { get; set; }
|
||||
public string? ZipCode { get; set; }
|
||||
public string? CountryCode { get; set; }
|
||||
public string? RoadTypeCode { get; set; } = "CL";
|
||||
|
||||
public bool HasAnyValue =>
|
||||
!string.IsNullOrWhiteSpace(Street) ||
|
||||
!string.IsNullOrWhiteSpace(Number) ||
|
||||
!string.IsNullOrWhiteSpace(Municipality) ||
|
||||
!string.IsNullOrWhiteSpace(Province) ||
|
||||
!string.IsNullOrWhiteSpace(ZipCode);
|
||||
|
||||
public static ThirdPartyAddressData? FromComplaint(DenunciasGestiona denuncia)
|
||||
{
|
||||
var data = new ThirdPartyAddressData
|
||||
{
|
||||
Street = denuncia.Direccion,
|
||||
RoadTypeCode = denuncia.DireccionTipoVia,
|
||||
Number = denuncia.DireccionNumero,
|
||||
Floor = denuncia.DireccionPiso,
|
||||
Door = denuncia.DireccionPuerta,
|
||||
Block = denuncia.DireccionBloque,
|
||||
Stair = denuncia.DireccionEscalera,
|
||||
Municipality = denuncia.Municipio,
|
||||
Province = denuncia.Provincia,
|
||||
ZipCode = denuncia.CodigoPostal,
|
||||
CountryCode = string.IsNullOrWhiteSpace(denuncia.Pais) ? denuncia.PaisOrigen : denuncia.Pais,
|
||||
};
|
||||
|
||||
return data.HasAnyValue ? data : null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
|
||||
namespace GestionaDenunciasAN.Models;
|
||||
|
||||
public sealed class ThirdPartyIdentityData
|
||||
{
|
||||
public bool IsAnonymous { get; set; }
|
||||
public bool IsLegalEntity { get; set; }
|
||||
public string DocumentId { get; set; } = string.Empty;
|
||||
public string FirstName { get; set; } = string.Empty;
|
||||
public string LastName { get; set; } = string.Empty;
|
||||
public string BusinessName { get; set; } = string.Empty;
|
||||
public string Email { get; set; } = string.Empty;
|
||||
public string CountryCode { get; set; } = string.Empty;
|
||||
public ThirdPartyAddressData? Address { get; set; }
|
||||
|
||||
public string DisplayName =>
|
||||
IsLegalEntity
|
||||
? BusinessName
|
||||
: string.Join(
|
||||
' ',
|
||||
new[] { FirstName, LastName }
|
||||
.Where(value => !string.IsNullOrWhiteSpace(value)));
|
||||
|
||||
public static ThirdPartyIdentityData FromComplaint(DenunciasGestiona denuncia)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(denuncia);
|
||||
|
||||
var isAnonymous = denuncia.EsAnonima ||
|
||||
string.Equals(
|
||||
denuncia.DocumentoResuelto?.Trim(),
|
||||
"00000000T",
|
||||
StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
return new ThirdPartyIdentityData
|
||||
{
|
||||
IsAnonymous = isAnonymous,
|
||||
IsLegalEntity = !isAnonymous && denuncia.EsPersonaJuridica,
|
||||
DocumentId = isAnonymous
|
||||
? "00000000T"
|
||||
: denuncia.DocumentoResuelto.Trim().ToUpperInvariant(),
|
||||
FirstName = isAnonymous ? "Anonimo" : denuncia.NombreResuelto.Trim(),
|
||||
LastName = isAnonymous ? "-" : BuildLastName(denuncia),
|
||||
BusinessName = isAnonymous ? string.Empty : denuncia.RazonSocialResuelta.Trim(),
|
||||
Email = (denuncia.Correo_Electronico ?? string.Empty).Trim(),
|
||||
CountryCode = string.IsNullOrWhiteSpace(denuncia.Pais) ? denuncia.PaisOrigen : denuncia.Pais,
|
||||
Address = isAnonymous ? null : ThirdPartyAddressData.FromComplaint(denuncia)
|
||||
};
|
||||
}
|
||||
|
||||
private static string BuildLastName(DenunciasGestiona denuncia)
|
||||
{
|
||||
var separated = string.Join(
|
||||
' ',
|
||||
new[] { denuncia.PrimerApellidoResuelto, denuncia.SegundoApellidoResuelto }
|
||||
.Where(value => !string.IsNullOrWhiteSpace(value))
|
||||
.Select(value => value.Trim()));
|
||||
|
||||
return string.IsNullOrWhiteSpace(separated)
|
||||
? denuncia.ApellidosResueltos.Trim()
|
||||
: separated;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
public class UserState
|
||||
{
|
||||
private readonly object _lock = new object();
|
||||
private string _token;
|
||||
private string _NombreUsu;
|
||||
private string _token = string.Empty;
|
||||
private string _NombreUsu = string.Empty;
|
||||
private bool _Mostrar;
|
||||
|
||||
public string Token
|
||||
|
||||
Reference in New Issue
Block a user