diff --git a/Controllers/DownloadController.cs b/Controllers/DownloadController.cs new file mode 100644 index 0000000..722ee2e --- /dev/null +++ b/Controllers/DownloadController.cs @@ -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(); + } + } +} diff --git a/Controllers/LoginController.cs b/Controllers/LoginController.cs index c7b3067..83f8dee 100644 --- a/Controllers/LoginController.cs +++ b/Controllers/LoginController.cs @@ -53,15 +53,30 @@ namespace VirtualTask.Controllers string risultato = response.Content.ReadAsStringAsync().Result; loginOut = JsonConvert.DeserializeObject(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 + /// + public static class Clienti + { + /// + public const string Marrocco = "MARRO"; + + /// + public const string Ferrari = "FERRA"; + + /// Zucchetti Sicilia + public const string Sicilia = "LABSE"; + + /// Discovery + public const string Discovery = "DISCO"; + + /// Sarom + public const string Sarom = "SAROM"; + + /// Sinergo + public const string Sinergo = "SINER"; + + /// Gitoga + public const string Gitoga = "GITSR"; + + /// Lifta + public const string Lifta = "LIFTA"; + + /// Siet + public const string Siet = "SIET2"; + + /// PMS + public const string PMS = "PMS00"; + + /// VT app + public const string VT = "VIRTU"; + + /// Lift-web + public const string LW = "DEMO"; + + /// Tedesco Impianti + public const string Tedesco = "TEDES"; + + /// Syscom + 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(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(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); diff --git a/Program.cs b/Program.cs index a0b75ba..455b146 100644 --- a/Program.cs +++ b/Program.cs @@ -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( diff --git a/Views/Download/Index.cshtml b/Views/Download/Index.cshtml new file mode 100644 index 0000000..6bbfc40 --- /dev/null +++ b/Views/Download/Index.cshtml @@ -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){ +
+ + +
 
+
+
+
 
+
+
Area Download per MARROCCO SPA
+
+ + + + + + + + + + + + + + + +
ApplicazioneVersioneLink
Applicazione interventi@versionDownload APP
+
+
+
 
+
+
+
 
+ + +} else if(DiscoveryVisible) +{ + +
 
+
+
+
 
+
+
Area Download per DISCOVERY SPA
+
+ + + + + + + + + + + + + + + +
ApplicazioneVersioneLink
Applicazione interventi@versionDownload APP
+
+
+
 
+
+
+
 
+ +} +else if (SyscomVisible) +{ + +
 
+
+
+
 
+
+
Area Download per SYS COM PROJECT S.R.L
+
+ + + + + + + + + + + + + + + +
ApplicazioneVersioneLink
Applicazione interventi@versionDownload APP
+
+
+
 
+
+
+
 
+ +} diff --git a/Views/Login/LoginDownload.cshtml b/Views/Login/LoginDownload.cshtml new file mode 100644 index 0000000..cbcc858 --- /dev/null +++ b/Views/Login/LoginDownload.cshtml @@ -0,0 +1,47 @@ +@model VirtualTask.Models.Login + +@{ + ViewData["Title"] = "Download APP"; + Layout = "~/Views/Shared/_Layout2.cshtml"; +} + + +
+
+

Login download

+
+
+ + +
+
+
+ + +
+
+
 
+
+
+ + +
+
+
+ +
+
+
+
+
+
+ +
+
+ @ViewBag.Error +
+
+ +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/Views/Portale/VT_Page1.cshtml b/Views/Portale/VT_Page1.cshtml index 818d255..14cebc6 100644 --- a/Views/Portale/VT_Page1.cshtml +++ b/Views/Portale/VT_Page1.cshtml @@ -80,4 +80,11 @@

*@ - \ No newline at end of file + + + + + + + + diff --git a/VirtualTask.csproj b/VirtualTask.csproj index fe9d865..00ca32e 100644 --- a/VirtualTask.csproj +++ b/VirtualTask.csproj @@ -14,4 +14,7 @@ + + + diff --git a/appsettings.json b/appsettings.json index c2363f9..9d55d3f 100644 --- a/appsettings.json +++ b/appsettings.json @@ -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": "*" } diff --git a/wwwroot/APP/1_29/app-env_discovery_1_29.apk b/wwwroot/APP/1_29/app-env_discovery_1_29.apk new file mode 100644 index 0000000..93c86e4 Binary files /dev/null and b/wwwroot/APP/1_29/app-env_discovery_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_ferrari_1_29.apk b/wwwroot/APP/1_29/app-env_ferrari_1_29.apk new file mode 100644 index 0000000..6c6079f Binary files /dev/null and b/wwwroot/APP/1_29/app-env_ferrari_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_gitoga_1_29.apk b/wwwroot/APP/1_29/app-env_gitoga_1_29.apk new file mode 100644 index 0000000..57881a8 Binary files /dev/null and b/wwwroot/APP/1_29/app-env_gitoga_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_labse_1_29.apk b/wwwroot/APP/1_29/app-env_labse_1_29.apk new file mode 100644 index 0000000..e389bd3 Binary files /dev/null and b/wwwroot/APP/1_29/app-env_labse_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_lifted_1_29.apk b/wwwroot/APP/1_29/app-env_lifted_1_29.apk new file mode 100644 index 0000000..bad8c79 Binary files /dev/null and b/wwwroot/APP/1_29/app-env_lifted_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_marrocco_1_29.apk b/wwwroot/APP/1_29/app-env_marrocco_1_29.apk new file mode 100644 index 0000000..5bbb3c2 Binary files /dev/null and b/wwwroot/APP/1_29/app-env_marrocco_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_polo_1_29.apk b/wwwroot/APP/1_29/app-env_polo_1_29.apk new file mode 100644 index 0000000..d3b0d4c Binary files /dev/null and b/wwwroot/APP/1_29/app-env_polo_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_sarom_1_29.apk b/wwwroot/APP/1_29/app-env_sarom_1_29.apk new file mode 100644 index 0000000..4f90edf Binary files /dev/null and b/wwwroot/APP/1_29/app-env_sarom_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_siet_1_29.apk b/wwwroot/APP/1_29/app-env_siet_1_29.apk new file mode 100644 index 0000000..a4cd456 Binary files /dev/null and b/wwwroot/APP/1_29/app-env_siet_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_sinergo_1_29.apk b/wwwroot/APP/1_29/app-env_sinergo_1_29.apk new file mode 100644 index 0000000..0065b47 Binary files /dev/null and b/wwwroot/APP/1_29/app-env_sinergo_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_syscom_1_29.apk b/wwwroot/APP/1_29/app-env_syscom_1_29.apk new file mode 100644 index 0000000..6cf569c Binary files /dev/null and b/wwwroot/APP/1_29/app-env_syscom_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_tedesco_1_29.apk b/wwwroot/APP/1_29/app-env_tedesco_1_29.apk new file mode 100644 index 0000000..fbcb7e3 Binary files /dev/null and b/wwwroot/APP/1_29/app-env_tedesco_1_29.apk differ diff --git a/wwwroot/APP/1_29/app-env_vt_1_29.apk b/wwwroot/APP/1_29/app-env_vt_1_29.apk new file mode 100644 index 0000000..a48114f Binary files /dev/null and b/wwwroot/APP/1_29/app-env_vt_1_29.apk differ