diff --git a/Antifraude.Net/GestionPersonalWeb/Components/App.razor b/Antifraude.Net/GestionPersonalWeb/Components/App.razor index 4a6bf25..fb173dc 100644 --- a/Antifraude.Net/GestionPersonalWeb/Components/App.razor +++ b/Antifraude.Net/GestionPersonalWeb/Components/App.razor @@ -8,7 +8,7 @@ - + diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Layout/MainLayout.razor b/Antifraude.Net/GestionPersonalWeb/Components/Layout/MainLayout.razor index d9a68b8..d2050e5 100644 --- a/Antifraude.Net/GestionPersonalWeb/Components/Layout/MainLayout.razor +++ b/Antifraude.Net/GestionPersonalWeb/Components/Layout/MainLayout.razor @@ -13,7 +13,7 @@ - + diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Pages/InfoPers.razor b/Antifraude.Net/GestionPersonalWeb/Components/Pages/InfoPers.razor index 42fee09..d047244 100644 --- a/Antifraude.Net/GestionPersonalWeb/Components/Pages/InfoPers.razor +++ b/Antifraude.Net/GestionPersonalWeb/Components/Pages/InfoPers.razor @@ -9,6 +9,7 @@ @using System.Linq.Expressions @using Serialize.Linq.Serializers @using System.Net.Http.Headers +@using System.Text @using bdAntifraude.clases @using bdAntifraude.db @using System.Reflection @@ -37,7 +38,24 @@ + + +

Varias localidades comparten este mismo código postal, seleccione a la que se refiere

+ + @if (lposiblesLocal != null) + { + @foreach (var enumera in lposiblesLocal) + { + + } + } + +
+ + + +
@@ -61,152 +79,233 @@
-
- -
- - -
- -
- - - - @if (lSexo != null) - { - @foreach (var enumera in lSexo) - { - - } - } - + + + +
+ +
+ + +
@GetExternalValidationMessage(nameof(persona.NIF))
+
+ +
+ + -
- -
- +
+ +
+ + +
+ +
+ + +
@GetExternalValidationMessage(nameof(persona.FECHANACIMIENTO))
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
@GetExternalValidationMessage(nameof(persona.APELLIDOS))
+
+ +
+ + +
@GetExternalValidationMessage(nameof(persona.NOMBRE))
+
+ +
+ + +
@GetExternalValidationMessage(nameof(persona.NIVEL))
+
+ +
+ + +
+ +
+ - - - @if (lTiposPers != null) - { - @foreach (var enumera in lTiposPers) - { - - } - } - + +
+ +
+ + +
+ +
+ + + +
+
+ + +
- @* *@ -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - - - @if (lTipoContra != null) - { - @foreach (var enumera in lTipoContra) - { - - } - } - - @* *@ -
- -
- +
+
+
+ + +
+
+ + +
@GetExternalValidationMessage(nameof(persona.DOMICILIO))
+
+
+ + +
@GetExternalValidationMessage(nameof(persona.CODIGOPOSTAL))
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
+
+
- - - @if (lGrupo != null) - { - @foreach (var enumera in lGrupo) - { - - } - } - - @* *@ -
- -
- - - - @if (lCuentaCoti != null) - { - @foreach (var enumera in lCuentaCoti) - { - - } - } - - @* *@ -
- -
- - - - @if (lDepartamento != null) - { - @foreach (var enumera in lDepartamento) - { - - } - } - - @* *@ -
-
- - - - @if (lOcupacion != null) - { - @foreach (var enumera in lOcupacion) - { - - } - } - - @* *@ -
-
+
@@ -355,8 +454,9 @@ private EditContext editContext = new EditContext(persona); private ValidationMessageStore? messageStore; private string errorMessage = ""; - + private int CPSELECT { get; set; } private List lTiposPers = new List(); + public List lposiblesLocal = new List(); private List lTipoContra = new List(); private List lGrupo = new List(); private List lCuentaCoti = new List(); @@ -365,12 +465,233 @@ private List lSexo = new List(); private Tabs tabsDtsPer { get; set; } = new Tabs(); private Modal popupConfirmacion = default!; + private Modal popupCodigoPostal = default!; + public string nomProv { get; set; } + public string nomMuni { get; set; } + public string nomProvNoti { get; set; } + public string nomMuniNoti { get; set; } + public string origenCP { get; set; } + public EventCallback OnValidationStateChanged { get; set; } List mensajes = new List(); + List listaIdentificadores = new List(); + private void ValidarSelect(ChangeEventArgs e, string fieldName) + { + if (e?.Value?.ToString() != "") + { + int value = int.Parse(e?.Value?.ToString()!); + + persona?.GetType()?.GetProperty(fieldName)?.SetValue(persona, value); + + } + else + { + persona?.GetType()?.GetProperty(fieldName)?.SetValue(persona, null); + } + OnValidationStateChanged.InvokeAsync(fieldName); + } + private void ValidarYActualizar(string fieldName) + { + OnValidationStateChanged.InvokeAsync(fieldName); + } + private void ValidarTodos() + { + messageStore?.Clear(); + foreach (var field in persona.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + ValidarCampo(field.Name); + } + } + private void ValidarCampo(string fieldName) + { + FieldIdentifier field; + var rr = listaIdentificadores.FirstOrDefault(x => x.FieldName == fieldName); + if (rr.FieldName != null) + { + field = rr; + } + else + { + field = new FieldIdentifier(persona, fieldName); + listaIdentificadores.Add(field); + } + + messageStore?.Clear(field); + + switch (fieldName) + { + case nameof(persona.NIF): + var nif = persona.NIF; + if (string.IsNullOrWhiteSpace(persona.NIF)) + { + messageStore?.Add(field, "El DNI es obligatorio."); + } + else if (!tsUtilidades.Utilidades.ValidateNif(ref nif)) + { + messageStore?.Add(field, "El DNI es incorrecto."); + } + persona.NIF = nif; + break; + case nameof(persona.NOMBRE): + if (string.IsNullOrWhiteSpace(persona.NOMBRE)) + { + messageStore?.Add(field, "El Nombre es obligatorio"); + } + else if (persona.NOMBRE.Length > 45) + { + messageStore?.Add(field, "El Nombre no puede ser mayor de 45 caracteres"); + } + break; + case nameof(persona.APELLIDOS): + if (string.IsNullOrWhiteSpace(persona.APELLIDOS)) + { + messageStore?.Add(field, "El Apellido es obligatorio"); + } + else if (persona.APELLIDOS.Length > 100) + { + messageStore?.Add(field, "El Apellido no puede ser mayor de 45 caracteres"); + } + break; + case nameof(persona.IDSEXO): + if (persona.IDSEXO == null) + { + messageStore?.Add(field, "El Sexo es obligatorio"); + } + break; + + } + + if (fieldName == nameof(persona.CODIGOPOSTAL) && string.IsNullOrWhiteSpace(persona.CODIGOPOSTAL)) + messageStore?.Add(field, "El código postal en la sección de contacto es obligatorio."); + if (fieldName == nameof(persona.CORREOELECTRONICO) && + !string.IsNullOrWhiteSpace(persona.CORREOELECTRONICO) && + !persona.CORREOELECTRONICO.Contains("@")) + messageStore?.Add(field, "El correo debe ser válido."); + + + editContext.NotifyValidationStateChanged(); + } + private async void cerrarPopupCP() + { + await popupCodigoPostal.HideAsync(); + } + private async Task SeleccionarCP(string cp, string origen) + { + origenCP = origen; + var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer()); + string codigoPostal = cp; + Expression> filtroPue = x => x.CODIGOPOSTAL == codigoPostal; + var PueExpression = serializer.SerializeText(filtroPue); + var PuejsonContent = JsonConvert.SerializeObject(new { Expression = PueExpression }); + var Puecontent = new StringContent(PuejsonContent, Encoding.UTF8, "application/json"); + var Pueresponse = await cliente.PostAsync("/api/CODIGOSPOSTALES/CodigosPostalesFiltrado", Puecontent); + var PueCont = await Pueresponse.Content.ReadAsStringAsync(); + if (!Pueresponse.IsSuccessStatusCode) + { + Console.WriteLine($"Error al obtener CODIGOSPOSTALES: {Pueresponse.StatusCode}, {PueCont}"); + return; + } + lposiblesLocal = JsonConvert.DeserializeObject>(PueCont) ?? new List(); + + if (lposiblesLocal.Count == 0 && cp == "") + { + if (origenCP == "contacto") + { + persona.CODIGOPOSTAL = null; + persona.CODIGOMUNICIPIO = null; + nomMuni = ""; + nomProv = ""; + } + if (origenCP == "Notificaciones") + { + persona.CODIGOPOSTALNOTIFICACIONES = null; + persona.CODIGOMUNICIPIONOTIFICACION = null; + nomMuniNoti = ""; + nomProvNoti = ""; + } + StateHasChanged(); + } + else if (lposiblesLocal.Count == 0) + { + if (origenCP == "contacto") + { + persona.CODIGOPOSTAL = null; + persona.CODIGOMUNICIPIO = null; + nomMuni = ""; + nomProv = ""; + } + if (origenCP == "Notificaciones") + { + persona.CODIGOPOSTALNOTIFICACIONES = null; + persona.CODIGOMUNICIPIONOTIFICACION = null; + nomMuniNoti = ""; + nomProvNoti = ""; + } + mensajes.Add(new ToastMessage + { + Type = ToastType.Danger, + + Message = "Código postal no válido", + + }); + editContext.NotifyValidationStateChanged(); + StateHasChanged(); + } + else if (lposiblesLocal.Count == 1) + { + if (origenCP == "contacto") + { + persona.CODIGOPOSTAL = lposiblesLocal.First().CODIGOPOSTAL; + persona.CODIGOMUNICIPIO = lposiblesLocal.First().CODIGOMUNICIPIO; + nomMuni = lposiblesLocal.First().CODIGOMUNICIPIONavigation.NOMBRE; + nomProv = lposiblesLocal.First().CODIGOMUNICIPIONavigation.CODIGOPROVINCIANavigation.NOMBRE; + StateHasChanged(); + } + if (origenCP == "Notificaciones") + { + persona.CODIGOPOSTALNOTIFICACIONES = lposiblesLocal.First().CODIGOPOSTAL; + persona.CODIGOMUNICIPIONOTIFICACION = lposiblesLocal.First().CODIGOMUNICIPIO; + nomMuniNoti = lposiblesLocal.First().CODIGOMUNICIPIONavigation.NOMBRE; + nomProvNoti = lposiblesLocal.First().CODIGOMUNICIPIONavigation.CODIGOPROVINCIANavigation.NOMBRE; + StateHasChanged(); + } + } + else + { + + await popupCodigoPostal.ShowAsync(); + } + + + } + private void setCP() + { + + + var seleccionado = lposiblesLocal.FirstOrDefault(x => x.IDCODIGOPOSTAL == CPSELECT); + if (origenCP == "contacto") + { + persona.CODIGOPOSTAL = seleccionado.CODIGOPOSTAL; + persona.CODIGOMUNICIPIO = seleccionado.CODIGOMUNICIPIO; + nomMuni = seleccionado.CODIGOMUNICIPIONavigation.NOMBRE; + nomProv = seleccionado.CODIGOMUNICIPIONavigation.CODIGOPROVINCIANavigation.NOMBRE; + cerrarPopupCP(); + StateHasChanged(); + } + if (origenCP == "Notificaciones") + { + persona.CODIGOPOSTALNOTIFICACIONES = seleccionado.CODIGOPOSTAL; + persona.CODIGOMUNICIPIONOTIFICACION = seleccionado.CODIGOMUNICIPIO; + nomMuniNoti = seleccionado.CODIGOMUNICIPIONavigation.NOMBRE; + nomProvNoti = seleccionado.CODIGOMUNICIPIONavigation.CODIGOPROVINCIANavigation.NOMBRE; + cerrarPopupCP(); + StateHasChanged(); + } + } private async Task GuardarPersona() { CerrarConfirmacion(); cliente = Utilidades.ObtenerCliente(UserState.Token, HttpClientFactory); - // ValidarTodos(); + ValidarTodos(); if (!editContext.GetValidationMessages().Any()) { @@ -445,10 +766,11 @@ Message = html, }); + editContext.NotifyValidationStateChanged(); } - } + } private async Task CerrarConfirmacion() { await popupConfirmacion.HideAsync(); @@ -526,6 +848,10 @@ var resultContent = await response.Content.ReadAsStringAsync(); persona = JsonConvert.DeserializeObject(resultContent) ?? throw new Exception("Error al deserializar los datos de la persona."); lblNombre = persona.NOMBRE + " " + persona.APELLIDOS; + nomMuni = persona.NombrePoblacion; + nomProv = persona.NombreProvincia; + nomMuniNoti = persona.NombrePoblacionNotificaciones; + nomProvNoti = persona.NombreProvinciaNotificaciones; editContext = new EditContext(persona); messageStore = new ValidationMessageStore(editContext); @@ -581,6 +907,17 @@ Console.WriteLine($"Error al cargar la foto: {ex.Message}"); } } + + private string GetCssClass(string fieldName) + { + if (messageStore == null) + { + return ""; + } + + var field = new FieldIdentifier(persona, fieldName); + return messageStore != null && messageStore[field].Any() ? "is-invalid" : string.Empty; + } private async Task ProcesarImagen(InputFileChangeEventArgs e) { try @@ -627,6 +964,16 @@ Console.WriteLine($"Error al procesar la imagen: {ex.Message}"); } } + private string GetExternalValidationMessage(string fieldName) + { + if (messageStore == null) + { + return ""; + } + + var field = new FieldIdentifier(persona, fieldName); + return messageStore[field]?.FirstOrDefault() ?? string.Empty; + } diff --git a/Antifraude.Net/GestionPersonalWeb/Components/Pages/ListTrabajadores.razor b/Antifraude.Net/GestionPersonalWeb/Components/Pages/ListTrabajadores.razor index b7e38fe..550428c 100644 --- a/Antifraude.Net/GestionPersonalWeb/Components/Pages/ListTrabajadores.razor +++ b/Antifraude.Net/GestionPersonalWeb/Components/Pages/ListTrabajadores.razor @@ -49,6 +49,9 @@ *@
+
@@ -255,6 +258,7 @@ @code { private List listPersonas = new List(); private List personas = new List(); + private string textBtnTodos { get; set; } private string _filter = ""; public string Filter { @@ -268,10 +272,8 @@ } } } - // Tamaño de página private int pageSize = 6; - // Calcula el total de páginas basado en la lista filtrada private int TotalPaginas => (int)Math.Ceiling((double)listPersonas.Count / pageSize); // Índice inicial y final de elementos para la página actual @@ -311,6 +313,7 @@ { NavigationManager.NavigateTo("/InfoPersonas", forceLoad: true); } + private string HashRed(string id) { string link = "/infoPers?cl=" + tsUtilidades.crypt.FEncS( @@ -330,39 +333,48 @@ if (!verTodosActive) { verTodosActive = true; - var token = UserState.Token; - var client = HttpClientFactory.CreateClient(); - client.BaseAddress = new Uri(Utilidades.urlSwagger()); - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); - client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + // var token = UserState.Token; + // var client = HttpClientFactory.CreateClient(); + // client.BaseAddress = new Uri(Utilidades.urlSwagger()); + // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); + // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); - var resultPersonas = await client.GetAsync("/PERSONAS"); - var resultContent = await resultPersonas.Content.ReadAsStringAsync(); - personas = JsonConvert.DeserializeObject>(resultContent) - ?? new List(); + // var resultPersonas = await client.GetAsync("/PERSONAS"); + // var resultContent = await resultPersonas.Content.ReadAsStringAsync(); + // personas = JsonConvert.DeserializeObject>(resultContent) + // ?? new List(); + + // personas = personas + // .OrderBy(x => x.APELLIDOS) + // .ThenBy(x => x.NOMBRE) + // .ThenByDescending(x => x.FECHAALTA) + // .ToList(); + listPersonas = personas; } else { verTodosActive = false; - var token = UserState.Token; - var client = HttpClientFactory.CreateClient(); - client.BaseAddress = new Uri(Utilidades.urlSwagger()); - client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); - client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + // var token = UserState.Token; + // var client = HttpClientFactory.CreateClient(); + // client.BaseAddress = new Uri(Utilidades.urlSwagger()); + // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); + // client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); - var resultPersonas = await client.GetAsync("/api/PERSONAS"); - var resultContent = await resultPersonas.Content.ReadAsStringAsync(); - personas = JsonConvert.DeserializeObject>(resultContent) - ?? new List(); + // var resultPersonas = await client.GetAsync("/api/PERSONAS"); + // var resultContent = await resultPersonas.Content.ReadAsStringAsync(); + // personas = JsonConvert.DeserializeObject>(resultContent) + // ?? new List(); + + // personas = personas + // .OrderBy(x => x.APELLIDOS) + // .ThenBy(x => x.NOMBRE) + // .ThenByDescending(x => x.FECHAALTA) + // .ToList(); + listPersonas = personas.Where(x => x.FECHABAJA == null).ToList(); } - personas = personas - .OrderBy(x => x.APELLIDOS) - .ThenBy(x => x.NOMBRE) - .ThenByDescending(x => x.FECHAALTA) - .ToList(); - listPersonas = personas; + UserState.CurrentPage = 1; Filter = ""; } @@ -430,7 +442,7 @@ .ThenByDescending(x => x.FECHAALTA) .ToList(); - listPersonas = personas; + listPersonas = personas.Where(x => x.FECHABAJA == null).ToList(); } private async Task btnExportarPDF() { diff --git a/Antifraude.Net/GestionPersonalWeb/wwwroot/Content/Site.css b/Antifraude.Net/GestionPersonalWeb/wwwroot/Content/Site.css index 8a860b8..c2d9b3d 100644 --- a/Antifraude.Net/GestionPersonalWeb/wwwroot/Content/Site.css +++ b/Antifraude.Net/GestionPersonalWeb/wwwroot/Content/Site.css @@ -188,7 +188,7 @@ border: 1px solid #ccc; text-align: center; cursor: pointer; - max-width: 230px; + /*max-width: 230px;*/ width:100%; margin-bottom:15px; aspect-ratio: 1/1 diff --git a/Antifraude.Net/GestionPersonalWeb/wwwroot/Content/imagenes/faviconOAAF.png b/Antifraude.Net/GestionPersonalWeb/wwwroot/Content/imagenes/faviconOAAF.png new file mode 100644 index 0000000..b66778c Binary files /dev/null and b/Antifraude.Net/GestionPersonalWeb/wwwroot/Content/imagenes/faviconOAAF.png differ diff --git a/Antifraude.Net/RegistroPersonalAN/Components/App.razor b/Antifraude.Net/RegistroPersonalAN/Components/App.razor index 0a078b3..c28e877 100644 --- a/Antifraude.Net/RegistroPersonalAN/Components/App.razor +++ b/Antifraude.Net/RegistroPersonalAN/Components/App.razor @@ -8,7 +8,7 @@ - + diff --git a/Antifraude.Net/RegistroPersonalAN/Components/Layout/EmptyLayout.razor b/Antifraude.Net/RegistroPersonalAN/Components/Layout/EmptyLayout.razor index fad1723..b0f1ce8 100644 --- a/Antifraude.Net/RegistroPersonalAN/Components/Layout/EmptyLayout.razor +++ b/Antifraude.Net/RegistroPersonalAN/Components/Layout/EmptyLayout.razor @@ -1,5 +1,12 @@ @inherits LayoutComponentBase + + + + + + +
@Body diff --git a/Antifraude.Net/RegistroPersonalAN/Components/Layout/MainLayout.razor b/Antifraude.Net/RegistroPersonalAN/Components/Layout/MainLayout.razor index 7eb71af..093de13 100644 --- a/Antifraude.Net/RegistroPersonalAN/Components/Layout/MainLayout.razor +++ b/Antifraude.Net/RegistroPersonalAN/Components/Layout/MainLayout.razor @@ -13,7 +13,7 @@ - + @@ -29,7 +29,12 @@ + + + + + @if (UserState.Mostrar == true) { diff --git a/Antifraude.Net/RegistroPersonalAN/wwwroot/Content/imagenes/faviconOAAF.png b/Antifraude.Net/RegistroPersonalAN/wwwroot/Content/imagenes/faviconOAAF.png new file mode 100644 index 0000000..b66778c Binary files /dev/null and b/Antifraude.Net/RegistroPersonalAN/wwwroot/Content/imagenes/faviconOAAF.png differ diff --git a/Antifraude.Net/SwaggerAntifraude/Controllers/CODIGOSPOSTALESController.cs b/Antifraude.Net/SwaggerAntifraude/Controllers/CODIGOSPOSTALESController.cs index f62a36f..297ef59 100644 --- a/Antifraude.Net/SwaggerAntifraude/Controllers/CODIGOSPOSTALESController.cs +++ b/Antifraude.Net/SwaggerAntifraude/Controllers/CODIGOSPOSTALESController.cs @@ -77,5 +77,48 @@ namespace SwaggerAntifraude.Controllers return StatusCode(500, $"Error interno del servidor: {ex.Message}"); } } + + [Authorize(Policy = "LecturaPolicy")] + [HttpPost("CodigosPostalesFiltrado")] // Cambié a POST ya que estás usando [FromBody] + public virtual async Task CodigosPostalesFiltrado([FromBody] ExpressionWrapper request) + { + try + { + using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false)) + { + // Crear el deserializador + var serializer = new ExpressionSerializer(new Serialize.Linq.Serializers.JsonSerializer()); + + // Deserializar la expresión + var deserializedExpression = serializer.DeserializeText(request.Expression) as Expression>; + if (deserializedExpression == null) + { + return BadRequest("La expresión deserializada es nula o incorrecta."); + } + + + + var entities = await context.Set() + .Where(deserializedExpression) + .Include(v => v.CODIGOMUNICIPIONavigation) + .ThenInclude(x => x.CODIGOPROVINCIANavigation)// Incluyendo la navegación principal + .AsNoTracking() + .ToListAsync(); + + + // Verificar si el resultado es vacío + if (entities.Count == 0) + { + Console.WriteLine("La consulta no devolvió resultados."); + } + + return Ok(entities); + } + } + catch (Exception ex) + { + return StatusCode(500, $"Error interno del servidor: {ex.Message}"); + } + } } } diff --git a/Antifraude.Net/SwaggerAntifraude/Controllers/PERSONASController.cs b/Antifraude.Net/SwaggerAntifraude/Controllers/PERSONASController.cs index eb86e1c..e9f561d 100644 --- a/Antifraude.Net/SwaggerAntifraude/Controllers/PERSONASController.cs +++ b/Antifraude.Net/SwaggerAntifraude/Controllers/PERSONASController.cs @@ -111,9 +111,13 @@ namespace SwaggerAntifraude.Controllers .Include(n => n.NOMINATRABAJADORCABECERA) .ThenInclude(pr => pr.PERIODOSSILTRA) .ThenInclude(y => y.IDCONTRATONavigation) - .Include(n => n.NOMINATRABAJADORCABECERA) + .Include(n => n.NOMINATRABAJADORCABECERA) .ThenInclude(pr => pr.PERIODOSSILTRA) .ThenInclude(y => y.IDESTADONavigation) + .Include(n => n.NOMINATRABAJADORCABECERA) + .ThenInclude(y => y.IDSINDICATO1Navigation) + .Include(n => n.NOMINATRABAJADORCABECERA) + .ThenInclude(y => y.IDSINDICATO2Navigation) .Include(pue => pue.OTRASRETRIBUCIONES) .Include(cp => cp.PERMISOSSINRETRIBUCION) .ThenInclude(cpro => cpro.IDNOMINAORIGENDEDATOSNavigation) diff --git a/Antifraude.Net/SwaggerAntifraude/appsettings.json b/Antifraude.Net/SwaggerAntifraude/appsettings.json index 16a73d3..8de5b19 100644 --- a/Antifraude.Net/SwaggerAntifraude/appsettings.json +++ b/Antifraude.Net/SwaggerAntifraude/appsettings.json @@ -5,15 +5,15 @@ "Audience": "TuDominio.com", "ExpiresInMinutes": 60 }, - //"ConnectionStrings": { - // "WriteConnection": "DATA SOURCE=192.168.41.203:21521/XE;PASSWORD=antifraude2022;PERSIST SECURITY INFO=True;USER ID=ANTIFRAUDEDESARROLLO", - // "ReadOnlyConnection": "DATA SOURCE=192.168.41.203:21521/XE;PASSWORD=antifraude2022;PERSIST SECURITY INFO=True;USER ID=ANTIFRAUDEDESARROLLO" - //}, - //PRODUCCION "ConnectionStrings": { - "WriteConnection": "DATA SOURCE=192.168.41.203:21521/XE;PASSWORD=antifraude2022;PERSIST SECURITY INFO=True;USER ID=ANTIFRAUDE", - "ReadOnlyConnection": "DATA SOURCE=192.168.41.203:21521/XE;PASSWORD=antifraude2022;PERSIST SECURITY INFO=True;USER ID=ANTIFRAUDE" + "WriteConnection": "DATA SOURCE=192.168.41.203:21521/XE;PASSWORD=antifraude2022;PERSIST SECURITY INFO=True;USER ID=ANTIFRAUDEDESARROLLO", + "ReadOnlyConnection": "DATA SOURCE=192.168.41.203:21521/XE;PASSWORD=antifraude2022;PERSIST SECURITY INFO=True;USER ID=ANTIFRAUDEDESARROLLO" }, + //PRODUCCION + //"ConnectionStrings": { + // "WriteConnection": "DATA SOURCE=192.168.41.203:21521/XE;PASSWORD=antifraude2022;PERSIST SECURITY INFO=True;USER ID=ANTIFRAUDE", + // "ReadOnlyConnection": "DATA SOURCE=192.168.41.203:21521/XE;PASSWORD=antifraude2022;PERSIST SECURITY INFO=True;USER ID=ANTIFRAUDE" + //}, "Logging": { "LogLevel": { "Default": "Information", diff --git a/Antifraude.Net/bdAntifraude/extensiones/PERSONAS.cs b/Antifraude.Net/bdAntifraude/extensiones/PERSONAS.cs index c994fa6..2bcdb57 100644 --- a/Antifraude.Net/bdAntifraude/extensiones/PERSONAS.cs +++ b/Antifraude.Net/bdAntifraude/extensiones/PERSONAS.cs @@ -130,5 +130,54 @@ namespace bdAntifraude.db } } + public string NombrePoblacionNotificaciones + { + get + { + var municipio = this.CODIGOMUNICIPIONOTIFICACIONNavigation; + if (municipio == null) + { + return ""; + } + else + { + if (this.CODIGOPOSTALNOTIFICACIONES != null && + municipio.CODIGOSPOSTALES.Any(x => x.CODIGOPOSTAL == this.CODIGOPOSTALNOTIFICACIONES)) + { + var cp = municipio.CODIGOSPOSTALES + .First(x => x.CODIGOPOSTAL == this.CODIGOPOSTALNOTIFICACIONES); + + if (cp.DESCRIPCIONADICIONAL != null) + { + return municipio.NOMBRE + " (" + cp.DESCRIPCIONADICIONAL + ")"; + } + else + { + return municipio.NOMBRE; + } + } + else + { + return ""; + } + } + } + } + public string NombreProvinciaNotificaciones + { + get + { + var municipio = this.CODIGOMUNICIPIONOTIFICACIONNavigation; + + if (municipio == null) + { + return ""; + } + else + { + return municipio.CODIGOPROVINCIANavigation.NOMBRE; + } + } + } } } \ No newline at end of file