marco
This commit is contained in:
parent
35c6727dbf
commit
963d0af4ad
15
Controllers/DownloadController.cs
Normal file
15
Controllers/DownloadController.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace VirtualTask.Controllers
|
||||
{
|
||||
public class DownloadController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
SessionHelper helper = new SessionHelper(this);
|
||||
string aziendaDownload = helper.GetStringValue("aziendaDownload");
|
||||
ViewBag.aziendaDownload = aziendaDownload;
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,15 +53,30 @@ namespace VirtualTask.Controllers
|
||||
string risultato = response.Content.ReadAsStringAsync().Result;
|
||||
loginOut = JsonConvert.DeserializeObject<LoginOut>(risultato);
|
||||
|
||||
helper.SetStringValue("tok", loginOut.Tok);
|
||||
helper.SetStringValue("apiUrl", apiUrl);
|
||||
helper.SetStringValue("tenant", model.Tenant);
|
||||
helper.SetStringValue("tenant2", loginOut.Tenant);
|
||||
helper.SetStringValue("tecnico", model.Username);
|
||||
helper.SetStringValue("admin", loginOut.Tcsuper != null ? loginOut.Tcsuper : "N");
|
||||
helper.SetStringValue("time_sheet", loginOut.Config!=null && loginOut.Config.time_sheet != null && loginOut.Config.time_sheet ==true? "S" : "N");
|
||||
string azienda = loginOut != null && !string.IsNullOrEmpty(loginOut.Tenant) ? loginOut.Tenant : string.Empty;
|
||||
string ten = model != null && !string.IsNullOrEmpty(model.Tenant) ? model.Tenant : string.Empty;
|
||||
string tok = loginOut != null && !string.IsNullOrEmpty(loginOut.Tok) ? loginOut.Tok : string.Empty;
|
||||
string usr = model != null && !string.IsNullOrEmpty(model.Username) ? model.Username : string.Empty;
|
||||
|
||||
return RedirectToAction("Index", "Home");
|
||||
helper.SetStringValue("tok", tok);
|
||||
helper.SetStringValue("apiUrl", apiUrl);
|
||||
helper.SetStringValue("tenant", ten);
|
||||
helper.SetStringValue("tenant2", azienda);
|
||||
helper.SetStringValue("tecnico", usr);
|
||||
helper.SetStringValue("admin", (loginOut!=null && loginOut.Tcsuper != null) ? loginOut.Tcsuper : "N");
|
||||
helper.SetStringValue("time_sheet", loginOut != null && loginOut.Config!=null && loginOut.Config.time_sheet != null && loginOut.Config.time_sheet ==true? "S" : "N");
|
||||
|
||||
if (!string.IsNullOrEmpty(azienda) && azienda.Equals(Clienti.Marrocco))
|
||||
{
|
||||
string err = "Utente non abilitato all'area riservata.";
|
||||
helper.SetStringValue("errMsg", err);
|
||||
ViewBag.Error = err;
|
||||
return View();
|
||||
}
|
||||
else
|
||||
{
|
||||
return RedirectToAction("Index", "Home");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -93,6 +108,129 @@ namespace VirtualTask.Controllers
|
||||
{
|
||||
return View();
|
||||
}
|
||||
#region Login per download apk
|
||||
/// <summary></summary>
|
||||
public static class Clienti
|
||||
{
|
||||
/// <summary></summary>
|
||||
public const string Marrocco = "MARRO";
|
||||
|
||||
/// <summary></summary>
|
||||
public const string Ferrari = "FERRA";
|
||||
|
||||
/// <summary>Zucchetti Sicilia</summary>
|
||||
public const string Sicilia = "LABSE";
|
||||
|
||||
/// <summary>Discovery</summary>
|
||||
public const string Discovery = "DISCO";
|
||||
|
||||
/// <summary>Sarom</summary>
|
||||
public const string Sarom = "SAROM";
|
||||
|
||||
/// <summary>Sinergo</summary>
|
||||
public const string Sinergo = "SINER";
|
||||
|
||||
/// <summary>Gitoga</summary>
|
||||
public const string Gitoga = "GITSR";
|
||||
|
||||
/// <summary>Lifta</summary>
|
||||
public const string Lifta = "LIFTA";
|
||||
|
||||
/// <summary>Siet</summary>
|
||||
public const string Siet = "SIET2";
|
||||
|
||||
/// <summary>PMS</summary>
|
||||
public const string PMS = "PMS00";
|
||||
|
||||
/// <summary>VT app</summary>
|
||||
public const string VT = "VIRTU";
|
||||
|
||||
/// <summary>Lift-web</summary>
|
||||
public const string LW = "DEMO";
|
||||
|
||||
/// <summary>Tedesco Impianti</summary>
|
||||
public const string Tedesco = "TEDES";
|
||||
|
||||
/// <summary>Syscom</summary>
|
||||
public const string Syscom = "A0001";
|
||||
|
||||
}
|
||||
public IActionResult LoginDownload()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
[HttpPost]
|
||||
public IActionResult LoginDownload(Login model)
|
||||
{
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
helper = new SessionHelper(this);
|
||||
string url = apiUrl + "loginTechnicalVT";
|
||||
Uri baseAddress = new Uri(url);
|
||||
client.BaseAddress = baseAddress;
|
||||
ViewBag.Error = string.Empty;
|
||||
ViewBag.Admin = string.Empty;
|
||||
|
||||
LoginOut loginOut = new LoginOut();
|
||||
string data = JsonConvert.SerializeObject(model);
|
||||
StringContent content = new StringContent(data, Encoding.UTF8, "application/json");
|
||||
HttpResponseMessage response = client.PostAsync(baseAddress, content).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string risultato = response.Content.ReadAsStringAsync().Result;
|
||||
loginOut = JsonConvert.DeserializeObject<LoginOut>(risultato);
|
||||
|
||||
string azienda = loginOut != null && !string.IsNullOrEmpty(loginOut.Tenant) ? loginOut.Tenant : string.Empty;
|
||||
|
||||
helper.SetStringValue("tok", loginOut.Tok);
|
||||
helper.SetStringValue("apiUrl", apiUrl);
|
||||
helper.SetStringValue("tenant", azienda);
|
||||
helper.SetStringValue("tenant2", loginOut.Tenant);
|
||||
helper.SetStringValue("tecnico", model.Username);
|
||||
helper.SetStringValue("admin", loginOut.Tcsuper != null ? loginOut.Tcsuper : "N");
|
||||
helper.SetStringValue("time_sheet", loginOut.Config != null && loginOut.Config.time_sheet != null && loginOut.Config.time_sheet == true ? "S" : "N");
|
||||
|
||||
if(!string.IsNullOrEmpty(azienda)&& azienda.Equals(Clienti.Marrocco))
|
||||
{
|
||||
helper.SetStringValue("aziendaDownload", azienda);
|
||||
return RedirectToAction("Index", "Download");
|
||||
}
|
||||
else
|
||||
{
|
||||
string err = "Utente non abilitato al download.";
|
||||
helper.SetStringValue("errMsg", err);
|
||||
ViewBag.Error = err;
|
||||
return View();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
errMes = response.Content.ReadAsStringAsync().Result;
|
||||
loginOut = JsonConvert.DeserializeObject<LoginOut>(errMes);
|
||||
|
||||
helper.SetStringValue("errMsg", loginOut.err_detail);
|
||||
ViewBag.Error = loginOut.err_detail;
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var Elemento in ModelState.Values)
|
||||
{
|
||||
foreach (var Errore in Elemento.Errors)
|
||||
{
|
||||
string ErroreRilevato = Errore.ErrorMessage;
|
||||
}
|
||||
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
public IActionResult Logout()
|
||||
{
|
||||
helper = new SessionHelper(this);
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
using Microsoft.AspNetCore.StaticFiles;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
@ -28,6 +30,13 @@ app.UseStaticFiles();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
var provider = new FileExtensionContentTypeProvider();
|
||||
provider.Mappings[".apk"] = "application/vnd.android.package-archive";
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
ContentTypeProvider = provider
|
||||
});
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
//app.MapControllerRoute(
|
||||
|
||||
130
Views/Download/Index.cshtml
Normal file
130
Views/Download/Index.cshtml
Normal file
@ -0,0 +1,130 @@
|
||||
@*
|
||||
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
|
||||
*@
|
||||
@{
|
||||
Layout = "~/Views/Shared/_Layout2.cshtml";
|
||||
string version = "1.29";
|
||||
bool MarroccoVisible = false;
|
||||
bool DiscoveryVisible = false;
|
||||
bool SyscomVisible = false;
|
||||
|
||||
string aziendaDownload = !string.IsNullOrEmpty(ViewBag.aziendaDownload) ? ViewBag.aziendaDownload:string.Empty;
|
||||
if (aziendaDownload.Equals("MARRO"))
|
||||
{
|
||||
MarroccoVisible = true;
|
||||
}
|
||||
else if (aziendaDownload.Equals("DISCO"))
|
||||
{
|
||||
DiscoveryVisible = true;
|
||||
}
|
||||
else if (aziendaDownload.Equals("SYSCO"))
|
||||
{
|
||||
SyscomVisible = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@if(MarroccoVisible){
|
||||
<br>
|
||||
<!-- Basic Bootstrap Table -->
|
||||
|
||||
<div class="row"> </div>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div style="width:5%;"> </div>
|
||||
<div class="card" style="width:90%;">
|
||||
<h5 class="card-header">Area Download per MARROCCO SPA</h5>
|
||||
<div class="table-responsive text-nowrap">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Applicazione</th>
|
||||
<th>Versione</th>
|
||||
<th>Link</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-border-bottom-0">
|
||||
<tr>
|
||||
<td><i class="bx bxl-angular bx-sm text-danger me-3"></i> <span class="fw-medium">Applicazione interventi</span></td>
|
||||
<td>@version</td>
|
||||
<td><a href="~/APP/1_29/app-env_marrocco_1_29.apk" download="app-env_marrocco_1_29.apk">Download APP</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:5%;"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row"> </div>
|
||||
|
||||
<!--/ Basic Bootstrap Table -->
|
||||
} else if(DiscoveryVisible)
|
||||
{
|
||||
<!-- Basic Bootstrap Table -->
|
||||
<div class="row"> </div>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div style="width:5%;"> </div>
|
||||
<div class="card" style="width:90%;">
|
||||
<h5 class="card-header">Area Download per DISCOVERY SPA</h5>
|
||||
<div class="table-responsive text-nowrap">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Applicazione</th>
|
||||
<th>Versione</th>
|
||||
<th>Link</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-border-bottom-0">
|
||||
<tr>
|
||||
<td><i class="bx bxl-angular bx-sm text-danger me-3"></i> <span class="fw-medium">Applicazione interventi</span></td>
|
||||
<td>@version</td>
|
||||
<td><a href="~/APP/1_29/app-env_discovery_1_29.apk" download="app-env_discovery_1_29.apk">Download APP</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:5%;"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row"> </div>
|
||||
|
||||
}
|
||||
else if (SyscomVisible)
|
||||
{
|
||||
<!-- Basic Bootstrap Table -->
|
||||
<div class="row"> </div>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div style="width:5%;"> </div>
|
||||
<div class="card" style="width:90%;">
|
||||
<h5 class="card-header">Area Download per SYS COM PROJECT S.R.L</h5>
|
||||
<div class="table-responsive text-nowrap">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Applicazione</th>
|
||||
<th>Versione</th>
|
||||
<th>Link</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="table-border-bottom-0">
|
||||
<tr>
|
||||
<td><i class="bx bxl-angular bx-sm text-danger me-3"></i> <span class="fw-medium">Applicazione interventi</span></td>
|
||||
<td>@version</td>
|
||||
<td><a href="~/APP/1_29/app-env_syscom_1_29.apk" download="app-env_syscom_1_29.apk">Download APP</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width:5%;"> </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row"> </div>
|
||||
|
||||
}
|
||||
47
Views/Login/LoginDownload.cshtml
Normal file
47
Views/Login/LoginDownload.cshtml
Normal file
@ -0,0 +1,47 @@
|
||||
@model VirtualTask.Models.Login
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Download APP";
|
||||
Layout = "~/Views/Shared/_Layout2.cshtml";
|
||||
}
|
||||
|
||||
|
||||
<div class="col-lg-8 col-md-12 col-sm-12 col-12">
|
||||
<div class="agy-contact-form">
|
||||
<h4 class="agy-sub-heading">Login download</h4>
|
||||
<form asp-action="LoginDownload">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
|
||||
<input type="hidden" id="Tenant" value="VIRTU" name="Tenant" />
|
||||
<div class="row">
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12">
|
||||
<div class="agy-field-holder">
|
||||
<input asp-for="Username" class="agy-form-field require" placeholder="Username" />
|
||||
<span asp-validation-for="Username" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12"> </div>
|
||||
<div class="col-lg-6 col-md-6 col-sm-12 col-12">
|
||||
<div class="agy-field-holder">
|
||||
<input asp-for="Password" class="agy-form-field require" placeholder="Password" />
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-12 col-md-12 col-sm-12 col-12">
|
||||
<input type="submit" value="Login" class="agy-btn submitForm" />
|
||||
<div class="response"></div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4" style="color:red;">
|
||||
@ViewBag.Error
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
||||
@ -80,4 +80,11 @@
|
||||
</p>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -14,4 +14,7 @@
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
|
||||
<PackageReference Include="X.PagedList.Mvc.Core" Version="8.4.7" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="wwwroot\APP\1_29\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -6,27 +6,27 @@
|
||||
}
|
||||
},
|
||||
"ApplicationInsights": {
|
||||
"rootUrlApi": "https://api.poloinformatico.it:9000/api/Polo/",
|
||||
"rootUrlApi2": "https://api.poloinformatico.it:9000/VIRTU/",
|
||||
|
||||
//PRODUZIONE
|
||||
"rootWebLoghi": "C:\\ZAPIPOLO\\api_polo\\wwwroot\\VIRTU\\",
|
||||
//"rootUrlApi": "https://api.poloinformatico.it:9000/api/Polo/",
|
||||
//"rootUrlApi2": "https://api.poloinformatico.it:9000/VIRTU/",
|
||||
//"rootWebLoghi": "C:\\ZAPIPOLO\\api_polo\\wwwroot\\VIRTU\\",
|
||||
"rootUrl": "https://virtualtask.it/",
|
||||
|
||||
//TEST
|
||||
//"rootWebLoghi": "C:\\Users\\audif\\source\\repos\\VirtualTask\\wwwroot\\VIRTU\\",
|
||||
"rootUrlApi": "http://testapi.poloinformatico.it:9001/api/Polo/",
|
||||
"rootUrlApi2": "http://testapi.poloinformatico.it:9001/VIRTU/",
|
||||
"rootWebLoghi": "C:\\Users\\audif\\source\\repos\\VirtualTask\\wwwroot\\VIRTU\\",
|
||||
//"rootUrl": "https://localhost:7140/",
|
||||
|
||||
|
||||
|
||||
|
||||
"mittenteMail": "info@virtualtask.it",
|
||||
"nomeMail": "Supporto Virtual Task",
|
||||
"pwdMail": "Polo2023!",
|
||||
"subjectMail": "Richiesta App di test",
|
||||
"subjectMailRiepilogo": "Registrazione completata",
|
||||
"rootUrl": "https://virtualtask.it/"
|
||||
|
||||
|
||||
//"rootUrlApi": "http://testapi.poloinformatico.it:9001/api/Polo/",
|
||||
//"rootUrlApi2": "http://testapi.poloinformatico.it:9001/VIRTU/",
|
||||
//"rootUrl": "https://localhost:7140/"
|
||||
"subjectMailRiepilogo": "Registrazione completata"
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
|
||||
BIN
wwwroot/APP/1_29/app-env_discovery_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_discovery_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_ferrari_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_ferrari_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_gitoga_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_gitoga_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_labse_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_labse_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_lifted_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_lifted_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_marrocco_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_marrocco_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_polo_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_polo_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_sarom_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_sarom_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_siet_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_siet_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_sinergo_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_sinergo_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_syscom_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_syscom_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_tedesco_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_tedesco_1_29.apk
Normal file
Binary file not shown.
BIN
wwwroot/APP/1_29/app-env_vt_1_29.apk
Normal file
BIN
wwwroot/APP/1_29/app-env_vt_1_29.apk
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user