Agregado cambio para obtener diferentes logos y acceder a bds
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||||
@inject UserState userState
|
@inject UserState userState
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
|
@using bdHerramientaCACOA.db
|
||||||
|
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
@@ -43,8 +44,10 @@
|
|||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#topMenu" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#topMenu" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="https://www.cacoa.es/">
|
<a class="navbar-brand" href="@urlWeb">
|
||||||
<img src="Content/Imagenes/logo_CACOA_alta.jpg" style="height: 40px" />
|
@* <img src="Content/Imagenes/logo_CACOA_alta.jpg" style="height: 40px" class="logoCacoa" /> *@
|
||||||
|
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" style="height: 50px; width:220px;" class="logoCacoa" />
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse navbar-collapse" id="topMenu">
|
<div class="collapse navbar-collapse" id="topMenu">
|
||||||
@@ -119,16 +122,32 @@
|
|||||||
|
|
||||||
|
|
||||||
string? urlAnterior = "";
|
string? urlAnterior = "";
|
||||||
|
public tsHerramientasCACOA bd;
|
||||||
|
private byte[] logoColegioArray = [];
|
||||||
|
string urlWeb = "";
|
||||||
|
|
||||||
bool urlVaida = true;
|
bool urlVaida = true;
|
||||||
string rutaActual = "";
|
string rutaActual = "";
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
|
||||||
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
|
||||||
|
// Redirigir al home si no hay token y la ruta no es pública
|
||||||
|
logoColegioArray = bd.ficheros.Where(x => x.NombreFichero == "LogoColegio2").Select(x => x.Fichero).First();
|
||||||
|
|
||||||
|
urlWeb = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLWEBCOLEGIO")).ValorAlfabetico1;
|
||||||
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||||
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
string urlColegio = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLCOLEGIO")).ValorAlfabetico1;
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(urlAnterior))
|
if (!string.IsNullOrEmpty(urlAnterior))
|
||||||
@@ -139,7 +158,7 @@
|
|||||||
|
|
||||||
if (rutaActual != "Denegado")
|
if (rutaActual != "Denegado")
|
||||||
{
|
{
|
||||||
if (!urlAnterior.Contains("cacoa.es"))
|
if (!urlAnterior.Contains(urlColegio))
|
||||||
{
|
{
|
||||||
Navigation.NavigateTo("/Denegado", true);
|
Navigation.NavigateTo("/Denegado", true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
@inject IHttpContextAccessor HttpContextAccessor
|
@inject IHttpContextAccessor HttpContextAccessor
|
||||||
@inject NavigationManager Navigation
|
@inject NavigationManager Navigation
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
|
@using bdHerramientaCACOA.db
|
||||||
|
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
@@ -42,6 +43,7 @@
|
|||||||
|
|
||||||
|
|
||||||
string? urlAnterior = "";
|
string? urlAnterior = "";
|
||||||
|
public tsHerramientasCACOA bd;
|
||||||
|
|
||||||
bool urlVaida = true;
|
bool urlVaida = true;
|
||||||
string rutaActual = "";
|
string rutaActual = "";
|
||||||
@@ -49,32 +51,33 @@
|
|||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender)
|
// if (firstRender)
|
||||||
{
|
// {
|
||||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
// urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||||
|
// bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
// string urlColegio = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLCOLEGIO")).ValorAlfabetico1;
|
||||||
|
|
||||||
|
// if (!string.IsNullOrEmpty(urlAnterior))
|
||||||
|
// {
|
||||||
|
|
||||||
|
// rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(urlAnterior))
|
// if (rutaActual != "Denegado")
|
||||||
{
|
// {
|
||||||
|
// if (!urlAnterior.Contains(urlColegio))
|
||||||
|
// {
|
||||||
|
// Navigation.NavigateTo("/Denegado", true);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
if (rutaActual != "Denegado")
|
// Navigation.NavigateTo("/Denegado", true);
|
||||||
{
|
// }
|
||||||
if (!urlAnterior.Contains("cacoa.es") )
|
// StateHasChanged();
|
||||||
{
|
// }
|
||||||
Navigation.NavigateTo("/Denegado", true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Navigation.NavigateTo("/Denegado", true);
|
|
||||||
}
|
|
||||||
StateHasChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||||
@inject UserState userState
|
@inject UserState userState
|
||||||
@inject IJSRuntime JS
|
@inject IJSRuntime JS
|
||||||
|
@using bdHerramientaCACOA.db
|
||||||
|
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
@@ -43,8 +44,10 @@
|
|||||||
<button class="navbar-toggler" type="button" onclick="cambiar()">
|
<button class="navbar-toggler" type="button" onclick="cambiar()">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="https://www.cacoa.es/">
|
<a class="navbar-brand" href="@urlWeb">
|
||||||
<img src="Content/Imagenes/logo_CACOA_alta.jpg" style="height: 40px" class="logoCacoa" />
|
@* <img src="Content/Imagenes/logo_CACOA_alta.jpg" style="height: 40px" class="logoCacoa" /> *@
|
||||||
|
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" style="height: 40px" class="logoCacoa" />
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse navbar-collapse" id="topMenu">
|
<div class="collapse navbar-collapse" id="topMenu">
|
||||||
@@ -115,39 +118,39 @@
|
|||||||
|
|
||||||
|
|
||||||
string? urlAnterior = "";
|
string? urlAnterior = "";
|
||||||
|
public tsHerramientasCACOA bd;
|
||||||
bool urlVaida = true;
|
bool urlVaida = true;
|
||||||
string rutaActual = "";
|
string rutaActual = "";
|
||||||
|
string urlWeb = "";
|
||||||
|
private byte[] logoColegioArray = [];
|
||||||
|
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
{
|
{
|
||||||
if (firstRender)
|
if (firstRender)
|
||||||
{
|
{
|
||||||
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
|
||||||
|
urlAnterior = await JS.InvokeAsync<string>("eval", "document.referrer");
|
||||||
|
string urlColegio = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLCOLEGIO")).ValorAlfabetico1;
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(urlAnterior))
|
if (!string.IsNullOrEmpty(urlAnterior))
|
||||||
{
|
{
|
||||||
|
|
||||||
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||||
|
|
||||||
|
|
||||||
if (rutaActual != "Denegado")
|
if (rutaActual != "Denegado")
|
||||||
{
|
{
|
||||||
if (!urlAnterior.Contains("cacoa.es"))
|
if (!urlAnterior.Contains(urlColegio))
|
||||||
{
|
{
|
||||||
Navigation.NavigateTo("/Denegado", true);
|
Navigation.NavigateTo("/Denegado", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Navigation.NavigateTo("/Denegado", true);
|
Navigation.NavigateTo("/Denegado", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (userState.idUser == 0 )
|
if (userState.idUser == 0 )
|
||||||
{
|
{
|
||||||
Navigation.NavigateTo("/", true);
|
Navigation.NavigateTo("/", true);
|
||||||
@@ -159,8 +162,12 @@
|
|||||||
protected override async Task OnInitializedAsync()
|
protected override async Task OnInitializedAsync()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Redirigir al home si no hay token y la ruta no es pública
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
|
||||||
|
// Redirigir al home si no hay token y la ruta no es pública
|
||||||
|
logoColegioArray = bd.ficheros.Where(x => x.NombreFichero == "LogoColegio2").Select(x => x.Fichero).First();
|
||||||
|
|
||||||
|
urlWeb = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLWEBCOLEGIO")).ValorAlfabetico1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<InputText @bind-Value="casa.NombreSimulacion" class="form-control inputForm formatoMoneda inputTabla " style="text-align:left;font-weight:bold;"></InputText>
|
<InputText @bind-Value="casa.NombreSimulacion" class="form-control inputForm formatoMoneda inputTabla " style="text-align:left;font-weight:bold;"></InputText>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex ml-auto impriManual">
|
<div class="d-flex ml-auto impriManual">
|
||||||
@* <button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button> *@
|
<button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button>
|
||||||
<button @onclick="VerManual" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-book pe-2"></i>Manual</button>
|
<button @onclick="VerManual" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-book pe-2"></i>Manual</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -376,7 +376,6 @@
|
|||||||
|
|
||||||
public async Task imprimir()
|
public async Task imprimir()
|
||||||
{
|
{
|
||||||
|
|
||||||
var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css");
|
var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css");
|
||||||
var cssContent = await File.ReadAllTextAsync(cssPath);
|
var cssContent = await File.ReadAllTextAsync(cssPath);
|
||||||
|
|
||||||
@@ -389,15 +388,18 @@
|
|||||||
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN' crossorigin='anonymous'>
|
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css' rel='stylesheet' integrity='sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN' crossorigin='anonymous'>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{contenidoHtml}
|
{contenidoHtml}
|
||||||
</body>
|
</body>
|
||||||
</html>";
|
</html>";
|
||||||
|
|
||||||
|
var logoByte = bd.ficheros.First(x => x.NombreFichero.Contains("LogoColegio2")).Fichero;
|
||||||
|
|
||||||
var arrayPDF = PdfService.GenerarPdf(fullHtml);
|
string logo64 = Convert.ToBase64String(logoByte);
|
||||||
|
|
||||||
|
var arrayPDF = PdfService.GenerarPdf(fullHtml, logo64);
|
||||||
|
|
||||||
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
||||||
|
|
||||||
await JSA.InvokeVoidAsync("descargarPdf", "SimulacionHerramientaCASA_"+ DateTime.Now , base64Pdf);
|
await JSA.InvokeVoidAsync("descargarPdf", "SimulacionHerramientaCASA_" + DateTime.Now , base64Pdf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
<InputText @bind-Value="urban.NombreSimulacion" class="form-control inputForm formatoMoneda inputTabla " style="text-align:left;font-weight:bold;"></InputText>
|
<InputText @bind-Value="urban.NombreSimulacion" class="form-control inputForm formatoMoneda inputTabla " style="text-align:left;font-weight:bold;"></InputText>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex ml-auto impriManual">
|
<div class="d-flex ml-auto impriManual">
|
||||||
@* <button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button> *@
|
<button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button>
|
||||||
<button @onclick="VerManual" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-book pe-2"></i>Manual</button>
|
<button @onclick="VerManual" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-book pe-2"></i>Manual</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -372,7 +372,11 @@
|
|||||||
</html>";
|
</html>";
|
||||||
|
|
||||||
|
|
||||||
var arrayPDF = PdfService.GenerarPdf(fullHtml);
|
var logoByte = bd.ficheros.First(x => x.NombreFichero.Contains("LogoColegio2")).Fichero;
|
||||||
|
|
||||||
|
string logo64 = Convert.ToBase64String(logoByte);
|
||||||
|
|
||||||
|
var arrayPDF = PdfService.GenerarPdf(fullHtml, logo64);
|
||||||
|
|
||||||
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<div id="DespachoImprimir" class="pagePrincipal d-flex flex-column align-items-center">
|
|
||||||
|
|
||||||
|
<div id="DespachoImprimir" class="pagePrincipal d-flex flex-column align-items-center">
|
||||||
<div class="col-12 mx-auto mb-5">
|
<div class="col-12 mx-auto mb-5">
|
||||||
@* ENCABEZADO DE LA PAGINA *@
|
@* ENCABEZADO DE LA PAGINA *@
|
||||||
<div class="EncabezadoImprimir">
|
<div class="EncabezadoImprimir">
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
<InputText @bind-Value="objetoLicitaciones.Descripcion" class="form-control inputForm formatoMoneda inputTabla " style="text-align:left;font-weight:bold;"></InputText>
|
<InputText @bind-Value="objetoLicitaciones.Descripcion" class="form-control inputForm formatoMoneda inputTabla " style="text-align:left;font-weight:bold;"></InputText>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex ml-auto impriManual">
|
<div class="d-flex ml-auto impriManual">
|
||||||
@* <button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button> *@
|
<button @onclick="imprimir" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Imprimir</button>
|
||||||
<button @onclick="VerManual" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-book pe-2"></i>Manual</button>
|
<button @onclick="VerManual" class="btnBlue d-flex align-items-center ms-1" style="background-color: #65b7c3 !important;"> <i class="fas fa-book pe-2"></i>Manual</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -540,7 +540,11 @@
|
|||||||
</html>";
|
</html>";
|
||||||
|
|
||||||
|
|
||||||
var arrayPDF = PdfService.GenerarPdf(fullHtml);
|
var logoByte = bd.ficheros.First(x => x.NombreFichero.Contains("LogoColegio2")).Fichero;
|
||||||
|
|
||||||
|
string logo64 = Convert.ToBase64String(logoByte);
|
||||||
|
|
||||||
|
var arrayPDF = PdfService.GenerarPdf(fullHtml, logo64);
|
||||||
|
|
||||||
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
||||||
|
|
||||||
|
|||||||
@@ -611,7 +611,11 @@
|
|||||||
</html>";
|
</html>";
|
||||||
|
|
||||||
|
|
||||||
var arrayPDF = PdfService.GenerarPdf(fullHtml);
|
var logoByte = bd.ficheros.First(x => x.NombreFichero.Contains("LogoColegio2")).Fichero;
|
||||||
|
|
||||||
|
string logo64 = Convert.ToBase64String(logoByte);
|
||||||
|
|
||||||
|
var arrayPDF = PdfService.GenerarPdf(fullHtml, logo64);
|
||||||
|
|
||||||
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
string base64Pdf = Convert.ToBase64String(arrayPDF);
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,9 @@
|
|||||||
<div class="back">
|
<div class="back">
|
||||||
<div class="div-center">
|
<div class="div-center">
|
||||||
<div class="d-block mt-4">
|
<div class="d-block mt-4">
|
||||||
<img src="Content/Imagenes/CACOA-6.png" height="49" />
|
@* <img src="Content/Imagenes/CACOA-6.png" height="49" /> *@
|
||||||
|
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" height="49" />
|
||||||
|
|
||||||
<h4 class="mt-2">Acceso Denegado</h4>
|
<h4 class="mt-2">Acceso Denegado</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -22,12 +24,27 @@
|
|||||||
Por favor vuelva a acceder desde la web
|
Por favor vuelva a acceder desde la web
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<a href="https://www.cacoa.es" class="enlaceCACOA">Ir a la web del CACOA</a>
|
<a href="@urlWeb" class="enlaceCACOA">@textoURL</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
public tsHerramientasCACOA bd;
|
||||||
|
private byte[] logoColegioArray = [];
|
||||||
|
|
||||||
|
private string urlWeb = "";
|
||||||
|
private string textoURL = "";
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
logoColegioArray = bd.ficheros.First(x => x.NombreFichero == "LogoColegio").Fichero;
|
||||||
|
|
||||||
|
var datosURL = bd.enumeraciones.First(x => x.Codigo.Contains("CW.URLWEBCOLEGIO"));
|
||||||
|
urlWeb = datosURL.ValorAlfabetico1;
|
||||||
|
textoURL = datosURL.ValorAlfabetico2;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
@page "/"
|
@page "/"
|
||||||
@using HerramientaCASA.Model
|
@using HerramientaCASA.Model
|
||||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||||
|
@using Microsoft.EntityFrameworkCore
|
||||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||||
@rendermode InteractiveServer
|
@rendermode InteractiveServer
|
||||||
@layout LoginLayout
|
@layout LoginLayout
|
||||||
@@ -14,7 +15,9 @@
|
|||||||
<div class="back">
|
<div class="back">
|
||||||
<div class="div-center arealogin">
|
<div class="div-center arealogin">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<img src="Content/Imagenes/CACOA-6.png" height="49" />
|
@* <img src="Content/Imagenes/CACOA-6.png" height="49" /> *@
|
||||||
|
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" height="49" />
|
||||||
|
|
||||||
<h4 class="mt-2">Acceso a la Herramienta</h4>
|
<h4 class="mt-2">Acceso a la Herramienta</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<EditForm Model="login" FormName="loginForm" OnValidSubmit="Acceder">
|
<EditForm Model="login" FormName="loginForm" OnValidSubmit="Acceder">
|
||||||
@@ -57,7 +60,7 @@
|
|||||||
private string mensajeError = "";
|
private string mensajeError = "";
|
||||||
private bool recuerda = false;
|
private bool recuerda = false;
|
||||||
|
|
||||||
|
private byte[] logoColegioArray = [];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -65,6 +68,7 @@
|
|||||||
{
|
{
|
||||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
|
||||||
|
logoColegioArray = bd.ficheros.Where(x => x.NombreFichero == "LogoColegio").Select(x => x.Fichero).First();
|
||||||
|
|
||||||
await ProtectedLocalStore.SetAsync("idUsuario", 0);
|
await ProtectedLocalStore.SetAsync("idUsuario", 0);
|
||||||
await ProtectedLocalStore.SetAsync("EsAdmin", false);
|
await ProtectedLocalStore.SetAsync("EsAdmin", false);
|
||||||
@@ -85,6 +89,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async void logoColegio()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private async void checkCambiado(bool e)
|
private async void checkCambiado(bool e)
|
||||||
{
|
{
|
||||||
recuerda = e;
|
recuerda = e;
|
||||||
|
|||||||
@@ -12,8 +12,8 @@
|
|||||||
<div class="back">
|
<div class="back">
|
||||||
<div class="div-center">
|
<div class="div-center">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<img src="Content/Imagenes/CACOA-6.png" height="49" />
|
<img src="data:image;base64, @System.Convert.ToBase64String(logoColegioArray)" height="49" />
|
||||||
<h4 class="mt-2">Crear Clave de acceso</h4>
|
<h4 class="mt-2">Crear Clave de acceso</h4>
|
||||||
<hr />
|
<hr />
|
||||||
<p>Se va a generar una clave de acceso para acceder a la herramienta, tenga en cuenta que como no se almacena ningún dato de caracter personal le recomendamos que guarde la clave y contraseña para poder utilizarla.</p>
|
<p>Se va a generar una clave de acceso para acceder a la herramienta, tenga en cuenta que como no se almacena ningún dato de caracter personal le recomendamos que guarde la clave y contraseña para poder utilizarla.</p>
|
||||||
<form id="formLogin">
|
<form id="formLogin">
|
||||||
@@ -32,10 +32,13 @@
|
|||||||
private string? nuevaPassword = "";
|
private string? nuevaPassword = "";
|
||||||
public tsHerramientasCACOA bd;
|
public tsHerramientasCACOA bd;
|
||||||
private string mensajeError = "";
|
private string mensajeError = "";
|
||||||
|
private byte[] logoColegioArray = [];
|
||||||
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
logoColegioArray = bd.ficheros.Where(x => x.NombreFichero == "LogoColegio").Select(x => x.Fichero).First();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using HerramientaCASA.Components;
|
|||||||
using HerramientaCASA.Model;
|
using HerramientaCASA.Model;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||||
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
|
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using DinkToPdf;
|
using DinkToPdf;
|
||||||
using DinkToPdf.Contracts;
|
using DinkToPdf.Contracts;
|
||||||
|
using DocumentFormat.OpenXml.Packaging;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
namespace HerramientaCASA
|
namespace HerramientaCASA
|
||||||
{
|
{
|
||||||
@@ -12,11 +13,15 @@ namespace HerramientaCASA
|
|||||||
_converter = converter;
|
_converter = converter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] GenerarPdf(string html)
|
public byte[] GenerarPdf(string html, string logoBase64)
|
||||||
{
|
{
|
||||||
var doc = new HtmlToPdfDocument()
|
var headerPath = Path.Combine(Path.GetTempPath(), $"header_{Guid.NewGuid()}.html");
|
||||||
|
File.WriteAllText(headerPath, rellenarHeader(logoBase64));
|
||||||
|
try
|
||||||
{
|
{
|
||||||
GlobalSettings = {
|
var doc = new HtmlToPdfDocument()
|
||||||
|
{
|
||||||
|
GlobalSettings = {
|
||||||
PaperSize = PaperKind.A4,
|
PaperSize = PaperKind.A4,
|
||||||
Orientation = Orientation.Portrait,
|
Orientation = Orientation.Portrait,
|
||||||
Margins= new MarginSettings
|
Margins= new MarginSettings
|
||||||
@@ -27,21 +32,58 @@ namespace HerramientaCASA
|
|||||||
Bottom = 10
|
Bottom = 10
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Objects = {
|
Objects = {
|
||||||
new ObjectSettings() {
|
new ObjectSettings() {
|
||||||
HtmlContent = html,
|
HtmlContent = html,
|
||||||
HeaderSettings = new HeaderSettings
|
HeaderSettings = new HeaderSettings
|
||||||
{
|
{
|
||||||
HtmUrl = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Imprimir", "HeaderImprimir.html")
|
HtmUrl = headerPath
|
||||||
}
|
},
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return _converter.Convert(doc);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (headerPath != null && File.Exists(headerPath))
|
||||||
|
{
|
||||||
|
File.Delete(headerPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
return _converter.Convert(doc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string rellenarHeader(string logoBase64)
|
||||||
|
{
|
||||||
|
string html = "";
|
||||||
|
|
||||||
|
html = $"<!DOCTYPE html>\r\n" +
|
||||||
|
$"<html>\r\n" +
|
||||||
|
$"<head>\r\n" +
|
||||||
|
$"<meta charset='utf-8' />\r\n" +
|
||||||
|
$"<title></title>\r\n"+
|
||||||
|
$"</head>\r\n"+
|
||||||
|
$"<body style='margin:0px !important;'>\r\n" +
|
||||||
|
$"<div style='height:55px; width:100%; font-size:12px; color:#078b98; font-weight:bold; background-color: #D7ECEF; display:flex;'>\r\n"+
|
||||||
|
$"<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" +
|
||||||
|
$"</td>\r\n"+
|
||||||
|
$"<td style='text-align: right; width: 50%; padding: 10px;'>\r\n"+
|
||||||
|
$"Costes Asociados a los Servicios de Arquitectura - CASA\r\n"+
|
||||||
|
$"</td>\r\n"+
|
||||||
|
$"</tr>\r\n"+
|
||||||
|
$"</table>\r\n"+
|
||||||
|
$"</div>\r\n"+
|
||||||
|
$"</body>\r\n"+
|
||||||
|
$"</html>";
|
||||||
|
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// Convierte HTML a PDF (bytes) usando HtmlRenderer.PdfSharpCore, inyectando site.css.
|
// /// Convierte HTML a PDF (bytes) usando HtmlRenderer.PdfSharpCore, inyectando site.css.
|
||||||
|
|||||||
@@ -8,8 +8,14 @@
|
|||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
//"WriteConnection": "Server=localhost;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;",
|
//"WriteConnection": "Server=localhost;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;",
|
||||||
//"ReadOnlyConnection": "Server=localhost;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;"
|
//"ReadOnlyConnection": "Server=localhost;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;"
|
||||||
|
|
||||||
|
// CONEXIÓN CACOA
|
||||||
"WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;",
|
"WriteConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;",
|
||||||
"ReadOnlyConnection": "Server=77.229.174.85;Port=22222;Database=herramientascacoa;User Id=cacoa;Password=cacoa2018-;"
|
"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-;"
|
||||||
},
|
},
|
||||||
"AllowedHosts": "*"
|
"AllowedHosts": "*"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset='utf-8' />
|
||||||
<title></title>
|
<title></title>
|
||||||
</head>
|
</head>
|
||||||
<body style="margin:0px !important;">
|
<body style='margin:0px !important;'>
|
||||||
<div style='height:55px; width:100%; font-size:12px; color:#078b98; font-weight:bold; background-color: #D7ECEF; display:flex;'>
|
<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;'>
|
<table style='width:100%; border:0; border-collapse:collapse;'>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -19,3 +19,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user