funciona todo
This commit is contained in:
@@ -145,17 +145,15 @@
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
string urlColegio = bd.enumeraciones.FirstOrDefault(x => x.Codigo.Contains("CW.URLCOLEGIO")).ValorAlfabetico1;
|
||||
|
||||
urlAnterior = await JS.InvokeAsync<string>("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)
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<p class="form-text">
|
||||
Se ha agotado la sesión o se ha accedido a la aplicación desde fuera de la Web del CACOA.<br />
|
||||
Se ha agotado la sesión o se ha accedido a la aplicación desde fuera de la Web principal.<br />
|
||||
Por favor vuelva a acceder desde la web
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -55,7 +55,6 @@ builder.Services.AddSession(options =>
|
||||
options.Cookie.IsEssential = true;
|
||||
});
|
||||
builder.Services.AddHttpClient();
|
||||
|
||||
builder.Services.AddBlazorBootstrap();
|
||||
builder.Services.AddAntiforgery();
|
||||
builder.Services.AddSingleton<UserState>();
|
||||
@@ -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 = $"<!DOCTYPE html>\r\n" +
|
||||
$"<html>\r\n" +
|
||||
@@ -144,7 +142,7 @@ app.MapGet("/HeaderPdf", () =>
|
||||
$"<table style='width:100%; border:0; border-collapse:collapse;'>\r\n" +
|
||||
$" <tr>\r\n" +
|
||||
$"<td style='text-align: left; width: 50%; padding-left: 10px; padding-top:8px;'>\r\n" +
|
||||
$"<img style='height: 40px; border-radius: 10px !important;' src='data:image/jpeg;base64,{logoBase64}' alt='Image'>\r\n" +
|
||||
//$"<img style='height: 40px; border-radius: 10px !important;' src='data:image/jpeg;base64,{logoBase64}' alt='Image'>\r\n" +
|
||||
$"</td>\r\n" +
|
||||
$"<td style='text-align: right; width: 50%; padding: 10px;'>\r\n" +
|
||||
$"Costes Asociados a los Servicios de Arquitectura - CASA\r\n" +
|
||||
|
||||
@@ -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;
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -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": "*"
|
||||
}
|
||||
|
||||
21
HerramientaCASA/wwwroot/Imprimir/HeaderCACOA.html
Normal file
21
HerramientaCASA/wwwroot/Imprimir/HeaderCACOA.html
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,21 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset='utf-8' />
|
||||
<title></title>
|
||||
</head>
|
||||
<body style='margin:0px !important;'>
|
||||
<div style='height:55px; width:100%; font-size:12px; color:#078b98; font-weight:bold; background-color: #D7ECEF; display:flex;'>
|
||||
<table style='width:100%; border:0; border-collapse:collapse;'>
|
||||
<tr>
|
||||
<td style='text-align: left; width: 50%; padding-left: 10px; padding-top:8px;'>
|
||||
<!--<img style='height: 40px; border-radius: 10px !important;' src='https://localhost/Imprimir/logoImprimir.jpeg' alt='Image'>-->
|
||||
</td>
|
||||
<td style='text-align: right; width: 50%; padding: 10px;'>
|
||||
Costes Asociados a los Servicios de Arquitectura - CASA
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user