diff --git a/HerramientaCASA/Components/Layout/ConfiguracionLayout.razor b/HerramientaCASA/Components/Layout/ConfiguracionLayout.razor index 598c71b..1932289 100644 --- a/HerramientaCASA/Components/Layout/ConfiguracionLayout.razor +++ b/HerramientaCASA/Components/Layout/ConfiguracionLayout.razor @@ -145,17 +145,15 @@ { if (firstRender) { - urlAnterior = await JS.InvokeAsync("eval", "document.referrer"); bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false); - string urlColegio = bd.enumeraciones.FirstOrDefault(x => x.Codigo.Contains("CW.URLCOLEGIO")).ValorAlfabetico1; + urlAnterior = await JS.InvokeAsync("eval", "document.referrer"); + string urlColegio = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLCOLEGIO")).ValorAlfabetico1; if (!string.IsNullOrEmpty(urlAnterior)) { - rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri); - if (rutaActual != "Denegado") { if (urlColegio != null && !urlAnterior.Contains(urlColegio)) @@ -163,7 +161,10 @@ Navigation.NavigateTo("/Denegado", true); } } - + } + else + { + Navigation.NavigateTo("/Denegado", true); } if (userState.idUser == 0) diff --git a/HerramientaCASA/Components/Pages/Login/Denegado.razor b/HerramientaCASA/Components/Pages/Login/Denegado.razor index 160797b..e1f0ca0 100644 --- a/HerramientaCASA/Components/Pages/Login/Denegado.razor +++ b/HerramientaCASA/Components/Pages/Login/Denegado.razor @@ -20,7 +20,7 @@

- Se ha agotado la sesión o se ha accedido a la aplicación desde fuera de la Web del CACOA.
+ Se ha agotado la sesión o se ha accedido a la aplicación desde fuera de la Web principal.
Por favor vuelva a acceder desde la web

diff --git a/HerramientaCASA/Components/Pages/Login/Login.razor b/HerramientaCASA/Components/Pages/Login/Login.razor index 2f773d4..9923bd3 100644 --- a/HerramientaCASA/Components/Pages/Login/Login.razor +++ b/HerramientaCASA/Components/Pages/Login/Login.razor @@ -99,8 +99,9 @@ } private async Task Acceder() { - if (login.codigo == -534610 && login.password == "sRg1406.") - // if (login.codigo == -1 && login.password == "-1") + var adminUser = bd.enumeraciones.First(x=> x.Codigo=="CW.ADMIN"); + + if (login.codigo == adminUser.ValorNumerico1 && login.password == adminUser.ValorAlfabetico1) { await ProtectedLocalStore.SetAsync("idUsuario", -1); await ProtectedLocalStore.SetAsync("EsAdmin", true); diff --git a/HerramientaCASA/Program.cs b/HerramientaCASA/Program.cs index 4b01a66..dc58f34 100644 --- a/HerramientaCASA/Program.cs +++ b/HerramientaCASA/Program.cs @@ -55,7 +55,6 @@ builder.Services.AddSession(options => options.Cookie.IsEssential = true; }); builder.Services.AddHttpClient(); - builder.Services.AddBlazorBootstrap(); builder.Services.AddAntiforgery(); builder.Services.AddSingleton(); @@ -82,7 +81,6 @@ if (string.IsNullOrEmpty(writeConnectionString) || string.IsNullOrEmpty(readOnly } tsHerramientasCACOA.EstableceCBD(writeConnectionString, readOnlyConnectionString); - app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSession(); @@ -125,13 +123,13 @@ app.Use(async (context, next) => app.MapGet("/HeaderPdf", () => { - var bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: true); + //var bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: true); - var logoByte = bd.ficheros - .FirstOrDefault(x => x.NombreFichero.Contains("LogoColegio2")) - .Fichero; + //var logoByte = bd.ficheros + // .FirstOrDefault(x => x.NombreFichero == "LogoColegio2") + // .Fichero; - var logoBase64 = Convert.ToBase64String(logoByte); + //var logoBase64 = Convert.ToBase64String(logoByte); string html = $"\r\n" + $"\r\n" + @@ -144,7 +142,7 @@ app.MapGet("/HeaderPdf", () => $"\r\n" + $" \r\n" + $"\r\n" + $"
\r\n" + - $"Image\r\n" + + //$"Image\r\n" + $"\r\n" + $"Costes Asociados a los Servicios de Arquitectura - CASA\r\n" + diff --git a/HerramientaCASA/ServicioPDF.cs b/HerramientaCASA/ServicioPDF.cs index b8a36f2..b01e989 100644 --- a/HerramientaCASA/ServicioPDF.cs +++ b/HerramientaCASA/ServicioPDF.cs @@ -25,6 +25,13 @@ namespace HerramientaCASA { try { + + var bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false); + + string nombreColegio = bd.enumeraciones.First(x=> x.Codigo == "CW.NOMBRECOLEGIO").ValorAlfabetico1; + + string headerNombre = "Header" + nombreColegio + ".html"; + var doc = new HtmlToPdfDocument() { GlobalSettings = { @@ -43,9 +50,8 @@ namespace HerramientaCASA HtmlContent = html, HeaderSettings = new HeaderSettings { - HtmUrl = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Imprimir", "HeaderImprimir.html") - //HtmUrl = "https://localhost:7275/HeaderPdf" - //HtmUrl = obtenerURL() + HtmUrl = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Imprimir", headerNombre) + //HtmUrl = "https://casa3coacyle.cacoa.es/HeaderPdf" }, } } @@ -59,21 +65,15 @@ namespace HerramientaCASA } } - public string obtenerURL() - { - string url = ""; - var bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false); + //public string obtenerURL() + //{ + // string url = ""; + // var bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false); - if (_env.IsDevelopment()) - { - url = "https://localhost:7275/HeaderPdf"; - } - else - { - url = bd.enumeraciones.First(x => x.Codigo.Contains("CW.DOMINIO")).ValorAlfabetico1 + "/HeaderPdf"; - } + + // url = bd.enumeraciones.First(x => x.Codigo.Contains("CW.DOMINIO")).ValorAlfabetico1 + "/HeaderPdf"; - return url; - } + // return url; + //} } } \ No newline at end of file diff --git a/HerramientaCASA/appsettings.json b/HerramientaCASA/appsettings.json index 08e3571..2ef5b11 100644 --- a/HerramientaCASA/appsettings.json +++ b/HerramientaCASA/appsettings.json @@ -14,11 +14,11 @@ //"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;" // CONEXIÓN COACYLE - //"WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;", - //"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;", + "WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;", + "ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;" - "WriteConnection": "Server=localhost;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;", - "ReadOnlyConnection": "Server=localhost;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;" + //"WriteConnection": "Server=localhost;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;", + //"ReadOnlyConnection": "Server=localhost;Port=22222;Database=herramientascoacyle;User Id=cacoa;Password=cacoa2018-;" }, "AllowedHosts": "*" } diff --git a/HerramientaCASA/wwwroot/Imprimir/HeaderCACOA.html b/HerramientaCASA/wwwroot/Imprimir/HeaderCACOA.html new file mode 100644 index 0000000..3af8b77 --- /dev/null +++ b/HerramientaCASA/wwwroot/Imprimir/HeaderCACOA.html @@ -0,0 +1,21 @@ + + + + + + + +
+ + + + + +
+ Image + + Costes Asociados a los Servicios de Arquitectura - CASA +
+
+ + \ No newline at end of file diff --git a/HerramientaCASA/wwwroot/Imprimir/header.html b/HerramientaCASA/wwwroot/Imprimir/HeaderCOACYLE.html similarity index 99% rename from HerramientaCASA/wwwroot/Imprimir/header.html rename to HerramientaCASA/wwwroot/Imprimir/HeaderCOACYLE.html index e8fbddd..0a062c6 100644 --- a/HerramientaCASA/wwwroot/Imprimir/header.html +++ b/HerramientaCASA/wwwroot/Imprimir/HeaderCOACYLE.html @@ -8,7 +8,7 @@
-
+ Image diff --git a/HerramientaCASA/wwwroot/Imprimir/HeaderImprimir.html b/HerramientaCASA/wwwroot/Imprimir/HeaderImprimir.html deleted file mode 100644 index 16b0b74..0000000 --- a/HerramientaCASA/wwwroot/Imprimir/HeaderImprimir.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - -
- - - - - -
- - - Costes Asociados a los Servicios de Arquitectura - CASA -
-
- - \ No newline at end of file