8c75556240
- spostamento aree conf server in apposito blocco - implementaizone compatibile con WebConfigSetter
131 lines
3.6 KiB
Plaintext
131 lines
3.6 KiB
Plaintext
@using MP.AppAuth.Models
|
|
@using MP.Land.Data
|
|
@using Microsoft.Extensions.Configuration
|
|
|
|
@inject IConfiguration Configuration
|
|
@inject AppAuthService DataService
|
|
@inject LicenseService LicServ
|
|
|
|
@if (authOk()) // disegno box cliccabile e programma attivato
|
|
{
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<a target="_blank" href="@(fullUrl(CurrItem.AppUrl))" class="btn btn-outline-info btn-block" title="Apri">
|
|
<i class="@(traduci($"{CurrItem.AppName}-ICON"))"></i>
|
|
<h3 class="mb-0">@CurrItem.AppName </h3>
|
|
</a>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row text-dark">
|
|
<div class="col-4 text-left">
|
|
<b>@(traduci($"{CurrItem.AppName}-TITLE"))</b>
|
|
<div class="border-bottom"></div>
|
|
<div class="badge badge-success"> Licenza Attiva</div>
|
|
</div>
|
|
<div class="col-8 border-left text-left">
|
|
@(traduci($"{CurrItem.AppName}-LIST"))
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
else // disegno box non cliccabile e licenza mancante
|
|
{
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<button class="btn btn-outline-secondary btn-block" title="Manca Licenza" disabled>
|
|
<i class="@(traduci($"{CurrItem.AppName}-ICON"))"></i>
|
|
<h3 class="mb-0">@CurrItem.AppName</h3>
|
|
</button>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row text-muted">
|
|
<div class="col-4 text-left">
|
|
<b>@(traduci($"{CurrItem.AppName}-TITLE"))</b>
|
|
<div class="border-bottom"></div>
|
|
<div class="badge badge-danger"> Licenza Mancante</div>
|
|
</div>
|
|
<div class="col-8 border-left text-left">
|
|
@(traduci($"{CurrItem.AppName}-LIST"))
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
}
|
|
|
|
@code {
|
|
|
|
[Parameter]
|
|
public UpdMan CurrItem { get; set; }
|
|
|
|
protected List<AnagKeyValueModel> AKVList
|
|
{
|
|
get
|
|
{
|
|
return LicServ.AKVList;
|
|
}
|
|
set
|
|
{
|
|
LicServ.AKVList = value;
|
|
}
|
|
}
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
// check init AKV
|
|
if (AKVList == null || AKVList.Count == 0)
|
|
{
|
|
AKVList = await DataService.AnagKeyValList();
|
|
LicServ.InitAkv();
|
|
}
|
|
}
|
|
|
|
|
|
protected string getAKVString(string nomeVar)
|
|
{
|
|
string answ = "";
|
|
if (AKVList != null)
|
|
{
|
|
var currRec = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar);
|
|
if (currRec != null)
|
|
{
|
|
answ = currRec.ValString;
|
|
}
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
protected AnagKeyValueModel getAKVRec(string nomeVar)
|
|
{
|
|
AnagKeyValueModel answ = new AnagKeyValueModel();
|
|
if (AKVList != null)
|
|
{
|
|
answ = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar);
|
|
}
|
|
return answ;
|
|
}
|
|
|
|
protected bool authOk()
|
|
{
|
|
bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey);
|
|
if (allOk)
|
|
{
|
|
allOk = LicServ.checkLicenseActive(CurrItem.LicenseKey);
|
|
}
|
|
return allOk;
|
|
}
|
|
|
|
protected string fullUrl(string relUrl)
|
|
{
|
|
return $"{Configuration["ServerConf:BaseUrl"]}{relUrl}";
|
|
}
|
|
|
|
protected MarkupString traduci(string lemma)
|
|
{
|
|
MarkupString answ;
|
|
string rawHtml = DataService.Traduci(lemma, "IT");
|
|
answ = new MarkupString(rawHtml);
|
|
return answ;
|
|
}
|
|
} |