From f933f3a106c59a8db628cc108dbdcf7f3be9cbf0 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 14 Dec 2020 15:06:11 +0100 Subject: [PATCH 1/4] update conf WebConfigSetter --- MP-IO/MP-IO.csproj.user | 2 +- MP-MON/MP-MON.csproj.user | 2 +- MP-Site/MP-Site.csproj.user | 2 +- WebConfigSetter/Program.cs | 2 -- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/MP-IO/MP-IO.csproj.user b/MP-IO/MP-IO.csproj.user index e85dec40..391097c4 100644 --- a/MP-IO/MP-IO.csproj.user +++ b/MP-IO/MP-IO.csproj.user @@ -10,7 +10,7 @@ - Debug|Any CPU + Release|Any CPU MvcControllerEmptyScaffolder root/Common/MVC/Controller 600 diff --git a/MP-MON/MP-MON.csproj.user b/MP-MON/MP-MON.csproj.user index 8765882c..3bf3694e 100644 --- a/MP-MON/MP-MON.csproj.user +++ b/MP-MON/MP-MON.csproj.user @@ -19,7 +19,7 @@ - Debug|Any CPU + Release|Any CPU ApiControllerWithActionsScaffolder root/Controller diff --git a/MP-Site/MP-Site.csproj.user b/MP-Site/MP-Site.csproj.user index c2cb7f33..3679bec0 100644 --- a/MP-Site/MP-Site.csproj.user +++ b/MP-Site/MP-Site.csproj.user @@ -8,7 +8,7 @@ - Debug|Any CPU + Release|Any CPU ShowAllFiles IIS02 diff --git a/WebConfigSetter/Program.cs b/WebConfigSetter/Program.cs index a7e180a2..f56464d3 100644 --- a/WebConfigSetter/Program.cs +++ b/WebConfigSetter/Program.cs @@ -106,8 +106,6 @@ namespace WebConfigSetter processRequest(); Console.WriteLine(separatore); - Console.Write("Premere un tasto x uscire"); - Console.ReadLine(); } /// From cc13a02677b4c780cc184db855a713252ad2067f Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 14 Dec 2020 15:12:03 +0100 Subject: [PATCH 2/4] add deploy WebConfigSetter su Nexus --- Jenkinsfile | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e25a4a71..b95576f6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=1345']) { + withEnv(['NEXT_BUILD_NUMBER=1346']) { // env.versionNumber = VersionNumber(versionNumberString : '6.12.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '6.12.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO' @@ -152,6 +152,33 @@ pipeline { bat "e:\\nuget setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted" bat "e:\\nuget.exe push MapoSDK.${env.packVers}.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted" } + else if (env.BRANCH_NAME == "develop") { + // BUILD WCS! + bat "\"${tool 'MSBuild-16.0'}\" WebConfigSetter/WebConfigSetter.csproj -target:Build /p:Configuration=Release /p:Platform=\"x86\" /p:OutputPath=bin/ /m" + // publico WCS su NEXUS + env.classifier = "" + // rimuovo vecchio zip... + bat "del /f ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\*.zip || EXIT /B 0" + // Compressione in .zip dell'installer... + bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\WebConfigSetter.zip ${WORKSPACE}\\WebConfigSetter\\bin\\*" + // ora mi occupo delle operazioni di invio a NEXUS... + nexusArtifactUploader( + nexusVersion: 'nexus3', + protocol: 'http', + nexusUrl: 'nexus.steamware.net', + groupId: 'MAPO', + //version: "${env.versionNumber}", + version: "stable", + repository: 'utility', + credentialsId: 'bc9d8e92-4302-3266-817f-7b58501d12d5', + artifacts: [ + [artifactId: 'WebConfigSetter', + classifier: "${env.classifier}", + file: "Releases\\${env.BRANCH_NAME}\\WebConfigSetter.zip", + type: 'zip'] + ] + ) + } else { echo 'Nothing to deploy...' } From 9351000cb984828331329494ba603ebeb5d8511c Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 14 Dec 2020 15:14:21 +0100 Subject: [PATCH 3/4] eliminato step: pubblico a mano!!! --- Jenkinsfile | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b95576f6..39342e90 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -152,33 +152,6 @@ pipeline { bat "e:\\nuget setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-hosted" bat "e:\\nuget.exe push MapoSDK.${env.packVers}.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted" } - else if (env.BRANCH_NAME == "develop") { - // BUILD WCS! - bat "\"${tool 'MSBuild-16.0'}\" WebConfigSetter/WebConfigSetter.csproj -target:Build /p:Configuration=Release /p:Platform=\"x86\" /p:OutputPath=bin/ /m" - // publico WCS su NEXUS - env.classifier = "" - // rimuovo vecchio zip... - bat "del /f ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\*.zip || EXIT /B 0" - // Compressione in .zip dell'installer... - bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\WebConfigSetter.zip ${WORKSPACE}\\WebConfigSetter\\bin\\*" - // ora mi occupo delle operazioni di invio a NEXUS... - nexusArtifactUploader( - nexusVersion: 'nexus3', - protocol: 'http', - nexusUrl: 'nexus.steamware.net', - groupId: 'MAPO', - //version: "${env.versionNumber}", - version: "stable", - repository: 'utility', - credentialsId: 'bc9d8e92-4302-3266-817f-7b58501d12d5', - artifacts: [ - [artifactId: 'WebConfigSetter', - classifier: "${env.classifier}", - file: "Releases\\${env.BRANCH_NAME}\\WebConfigSetter.zip", - type: 'zip'] - ] - ) - } else { echo 'Nothing to deploy...' } From 4ce6fd85c7a500012b229a3ef7d883ada6a2361d Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Mon, 14 Dec 2020 15:46:21 +0100 Subject: [PATCH 4/4] update LAND x HwSwInfo con DB compreso --- MP-LAND/Controllers/HomeController.cs | 734 +++++++++++++------------- MP-LAND/MP-LAND.csproj | 2 +- MP-LAND/Views/Home/System.cshtml | 174 ------ MP-LAND/Views/Home/SystemInfo.cshtml | 160 ++++++ MP-LAND/Views/Shared/_Layout.cshtml | 100 ++-- 5 files changed, 586 insertions(+), 584 deletions(-) delete mode 100644 MP-LAND/Views/Home/System.cshtml create mode 100644 MP-LAND/Views/Home/SystemInfo.cshtml diff --git a/MP-LAND/Controllers/HomeController.cs b/MP-LAND/Controllers/HomeController.cs index 8175cbdf..9e2f6e79 100644 --- a/MP-LAND/Controllers/HomeController.cs +++ b/MP-LAND/Controllers/HomeController.cs @@ -13,381 +13,397 @@ using ZXing.QrCode; namespace MP.Controllers { - public class HomeController : Controller - { - public ActionResult Index() + public class HomeController : Controller { - ViewBag.Title = "MAPO"; - // x sicurezza leggo da web.config - ViewBag.Environment = WebConfigurationManager.AppSettings["Environment"]; - using (var ctx = new MoonProEntities()) - { - try - { - // esegue stored procedure come function, recuperando chiave desiderata... - ViewBag.Environment = ctx.stp_AKV_getByKey("Environment").ToList()[0].valString; - // imposto URL dei vari siti - ViewBag.UrlMpSite = ctx.stp_AKV_getByKey("UrlMpSite").ToList()[0].valString; - ViewBag.UrlMpAdmin = ctx.stp_AKV_getByKey("UrlMpAdmin").ToList()[0].valString; - ViewBag.UrlMpIO = ctx.stp_AKV_getByKey("UrlMpIO").ToList()[0].valString; - ViewBag.UrlMpMON = ctx.stp_AKV_getByKey("UrlMpMON").ToList()[0].valString; - ViewBag.UrlMpTAB = ctx.stp_AKV_getByKey("UrlMpTAB").ToList()[0].valString; - ViewBag.UrlMpCTrack = ctx.stp_AKV_getByKey("UrlMpCTrack").ToList()[0].valString; - // importo verifica abilitazione CTrack - !!!FARE!!! vero check key auth! - ViewBag.CTrack_Enb = (ctx.stp_AKV_getByKey("CTRACK").ToList()[0].valString != ""); - } - catch (Exception exc) - { - logger.lg.scriviLog(string.Format("Eccezione in composizione HOME page LAND:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION); - // Default: NO CTrack - ViewBag.CTrack_Enb = false; - } - } - return View(); - } - /// - /// info steamware - /// - /// - public ActionResult About() - { - ViewBag.Title = "MES | SCADA | IOT"; - ViewBag.Message = "Soluzione integrata per la gestione della produzione"; + #region Protected Methods - return View(); - } - /// - /// contatti - /// - /// - public ActionResult Contact() - { - ViewBag.Title = "MAPO"; - ViewBag.Message = "Per contattarci"; - return View(); - } - /// - /// System INFO - /// - /// - public ActionResult System() - { - ViewBag.Title = "MAPO System Info"; - ViewBag.Message = "HW & SW details"; - return View(); - } - /// - /// Gestione download aggiornamenti - /// - /// - /// - public ActionResult Packages(string results) - { - ViewBag.Title = "Steamware's MAPO Suite"; - ViewBag.Message = "Ultime release applicazioni"; - UpdateInfoEventArgs updArgs = new UpdateInfoEventArgs(); - // Recupero info ADM... - updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("ADM")); - if (updArgs.IsUpdateAvailable) - { - ViewBag.VersMpAdmin = updArgs.CurrentVersion; - } - else - { - ViewBag.VersMpAdmin = "ND"; - ViewBag.AdmDisabled = "disabled"; - } - // Recupero info IO... - updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("IO")); - if (updArgs.IsUpdateAvailable) - { - ViewBag.VersMpIO = updArgs.CurrentVersion; - } - else - { - ViewBag.VersMpIO = "ND"; - ViewBag.IODisabled = "disabled"; - } - // Recupero info LAND... - updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("LAND")); - if (updArgs.IsUpdateAvailable) - { - ViewBag.VersMpLand = updArgs.CurrentVersion; - } - else - { - ViewBag.VersMpLand = "ND"; - ViewBag.LandDisabled = "disabled"; - } - // Recupero info MON... - updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("MON")); - if (updArgs.IsUpdateAvailable) - { - ViewBag.VersMpMon = updArgs.CurrentVersion; - } - else - { - ViewBag.VersMpMon = "ND"; - ViewBag.MonDisabled = "disabled"; - } - // Recupero info SITE... - updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("SITE")); - if (updArgs.IsUpdateAvailable) - { - ViewBag.VersMpSite = updArgs.CurrentVersion; - } - else - { - ViewBag.VersMpSite = "ND"; - ViewBag.SiteDisabled = "disabled"; - } - // Recupero info TAB... - updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("TAB")); - if (updArgs.IsUpdateAvailable) - { - ViewBag.VersMpTab = updArgs.CurrentVersion; - } - else - { - ViewBag.VersMpTab = "ND"; - ViewBag.TabDisabled = "disabled"; - } - // Recupero info CTRACK... - updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("CTRACK")); - if (updArgs.IsUpdateAvailable) - { - ViewBag.VersMpCTrack = updArgs.CurrentVersion; - } - else - { - ViewBag.VersMpCTrack = "ND"; - ViewBag.TabDisabled = "disabled"; - } - // salvo risultati... - ViewBag.Results = results; - // fix visibilità CTrack - using (var ctx = new MoonProEntities()) - { - try + /// + /// Path locale dove scaricare gli installer + /// + protected string localDownloadPath(string package) { - // importo verifica abilitazione CTrack - !!!FARE!!! vero check key auth! - ViewBag.CTrack_Enb = (ctx.stp_AKV_getByKey("CTRACK").ToList()[0].valString != ""); + return string.Format(@"{0}{1}\{2}", memLayer.ML.CRS("downloadPath"), package, memLayer.ML.CRS("appVers")); } - catch + + /// + /// URLK stringa di UPDATE... + /// + protected string updateUrl(string package) { - ViewBag.CTrack_Enb = false; + return string.Format("http://seriate.steamware.net:8083/SWS/MAPO/{0}/{1}/manifest.xml", package, memLayer.ML.CRS("appVers")); } - } - // VIEW! - return View(); - } - /// - /// Gestione configurazioni applicativi (DB) - /// - /// - /// - public ActionResult ConfigMan(string sorgente) - { - ViewBag.Title = "Steamware's MAPO Suite - Configurations"; - // cerco file se disponibile... - string filePath = Path.Combine(Server.MapPath("~/FileUpload"), "web.config"); - bool fileExist = (fileMover.obj.fileExist(Server.MapPath("~/FileUpload"), "web.config")); - if (fileExist) - { - ViewBag.Message = "File web.config presente"; - // leggo il file di conf caricato... - System.Configuration.Configuration rootWebConfig = WebConfigurationManager.OpenWebConfiguration("~/FileUpload/web.config"); + #endregion Protected Methods - if (sorgente != "" && sorgente != null) + #region Public Methods + + /// + /// info steamware + /// + /// + public ActionResult About() { - // resetto tab import - memLayer.ML.taConfigTmp.reset(sorgente); - // carico dati! - var settings = rootWebConfig.AppSettings.Settings; - foreach (var item in settings.AllKeys) - { - memLayer.ML.taConfigTmp.insertQuery(sorgente, item, settings[item].Value, string.Format("{0}|{1}", sorgente, item)); - } - // salvo in viewbag gli elenchi 0/1/2 (tutte, nuove, modificate) + ViewBag.Title = "MES | SCADA | IOT"; + ViewBag.Message = "Soluzione integrata per la gestione della produzione"; - using (var ctx = new MoonProEntities()) - { - try + return View(); + } + + /// + /// Gestione configurazioni applicativi (DB) + /// + /// + /// + public ActionResult ConfigMan(string sorgente) + { + ViewBag.Title = "Steamware's MAPO Suite - Configurations"; + + // cerco file se disponibile... + string filePath = Path.Combine(Server.MapPath("~/FileUpload"), "web.config"); + bool fileExist = (fileMover.obj.fileExist(Server.MapPath("~/FileUpload"), "web.config")); + if (fileExist) { - // esegue stored procedure come function, recuperando chiave desiderata... - var elConfig = ctx.ConfigTmp.ToList(); - ViewBag.elConfig = elConfig; + ViewBag.Message = "File web.config presente"; + // leggo il file di conf caricato... + System.Configuration.Configuration rootWebConfig = WebConfigurationManager.OpenWebConfiguration("~/FileUpload/web.config"); + + if (sorgente != "" && sorgente != null) + { + // resetto tab import + memLayer.ML.taConfigTmp.reset(sorgente); + // carico dati! + var settings = rootWebConfig.AppSettings.Settings; + foreach (var item in settings.AllKeys) + { + memLayer.ML.taConfigTmp.insertQuery(sorgente, item, settings[item].Value, string.Format("{0}|{1}", sorgente, item)); + } + // salvo in viewbag gli elenchi 0/1/2 (tutte, nuove, modificate) + + using (var ctx = new MoonProEntities()) + { + try + { + // esegue stored procedure come function, recuperando chiave desiderata... + var elConfig = ctx.ConfigTmp.ToList(); + ViewBag.elConfig = elConfig; + } + catch + { } + } + + ViewBag.keyList = "CARICATO!"; + } } - catch - { } - } - - ViewBag.keyList = "CARICATO!"; - } - } - else - { - ViewBag.Message = "Attenzione: nessun file presente!"; - } - // VIEW! - return View((object)ViewBag.elConfig); - } - - [HttpPost] - public ActionResult UploadFile(HttpPostedFileBase file, string sorgente) - { - if (file != null && file.ContentLength > 0 && sorgente != "") - { - try - { - // forzo nome SEMPRE a web.config - //string path = Path.Combine(Server.MapPath("~/FileUpload"), Path.GetFileName(file.FileName).ToLower()); - string path = Path.Combine(Server.MapPath("~/FileUpload"), "web.config"); - file.SaveAs(path); - ViewBag.Message = "File Caricato!"; - // ora processo import del sorgente selezionato... - - - - - - } - catch (Exception ex) - { - ViewBag.Message = "ERROR:" + ex.Message.ToString(); - } - } - else - { - ViewBag.Message = "Non è stato selezionato alcun file."; - } - return RedirectToAction("ConfigMan", "Home", new { sorgente }); - } - - - // GET: Home/Download/Caller (ALL|ADM|IO|LAND|MON|SITE|TAB|CTRACK) - public ActionResult Download(string caller) - { - string resultsMsg = ""; - // in base al caller scarico il file installazione richiesto... - if (caller == null) - { - caller = "ALL"; - } - // ora verifico COSA devo scaricare... - if (updateUrl(caller) != "") - { - // se è ALL scarico tuttoi... - if (caller == "ALL") - { - Stopwatch stopWatch = new Stopwatch(); - stopWatch.Start(); - int done = 0; - // scarico TUTTI... - done += UpdateMan.obj.downloadLatest(updateUrl("ADM"), localDownloadPath("ADM"), "ADM"); - done += UpdateMan.obj.downloadLatest(updateUrl("IO"), localDownloadPath("IO"), "IO"); - done += UpdateMan.obj.downloadLatest(updateUrl("LAND"), localDownloadPath("LAND"), "LAND"); - done += UpdateMan.obj.downloadLatest(updateUrl("MON"), localDownloadPath("MON"), "MON"); - done += UpdateMan.obj.downloadLatest(updateUrl("SITE"), localDownloadPath("SITE"), "SITE"); - done += UpdateMan.obj.downloadLatest(updateUrl("TAB"), localDownloadPath("TAB"), "TAB"); - done += UpdateMan.obj.downloadLatest(updateUrl("CTRACK"), localDownloadPath("CTRACK"), "CTRACK"); - stopWatch.Stop(); - // calcolo elapsed time come TimeSpan value. - TimeSpan ts = stopWatch.Elapsed; - resultsMsg = string.Format("OK: {0} Package downloaded, {1:0.000} sec", done, ts.TotalSeconds); - } - else - { - // scarico singolo target... - UpdateMan.obj.downloadLatest(updateUrl(caller), localDownloadPath(caller), caller); - resultsMsg = string.Format("OK: {0} DOWNLOADED | {1} --> {2}", caller, updateUrl(caller), localDownloadPath(caller)); - } - } - // ...chiamo action - return RedirectToAction("Packages", "Home", new { results = resultsMsg }); - } - - /// - /// Gestione QRCode utenti TAB - /// - /// - public ActionResult UserListQR(string id, string From, string Lenght) - { - int lenght = 0; - int from = 0; - int.TryParse(Lenght, out lenght); - int.TryParse(From, out from); - ViewBag.Title = "QR link"; - ViewBag.Message = WebConfigurationManager.AppSettings["Cliente"]; - ViewBag.BaseUrl = WebConfigurationManager.AppSettings["baseAuthUrl"]; - ViewBag.Environment = WebConfigurationManager.AppSettings["Environment"]; - using (var ctx = new MoonProEntities()) - { - try - { - // esegue stored procedure come function, recuperando chiave desiderata... - var elOperatori = ctx.AnagraficaOperatori.ToList(); - if (from + lenght > 0) - { - // seleziono sottoelenco SE ammissibile... - int numRec = elOperatori.Count; - lenght = lenght == 0 ? numRec : lenght; - from = from > numRec ? 0 : from; - if (from < numRec) + else { - lenght = from + lenght < numRec ? lenght : numRec - from; - elOperatori = elOperatori.GetRange(from, lenght); + ViewBag.Message = "Attenzione: nessun file presente!"; } - } - ViewBag.elOperatori = elOperatori; + // VIEW! + return View((object)ViewBag.elConfig); } - catch - { } - } - return View((object)ViewBag.elOperatori); - } - /// - /// Restituisce un QR code dato valore - /// - /// - /// - public ActionResult QR(string valore) - { - QrCodeEncodingOptions options = new QrCodeEncodingOptions - { - DisableECI = true, - CharacterSet = "UTF-8", - Width = 600, - Height = 600, - Margin = 0 - }; - var writer = new BarcodeWriter(); - writer.Format = BarcodeFormat.QR_CODE; - writer.Options = options; - // scrivo bitmap - var pixelData = writer.Write(valore); - // Return Image - MemoryStream ms = new MemoryStream(); - pixelData.Save(ms, ImageFormat.Png); - ms.Position = 0; - return new FileStreamResult(ms, "image/png"); - } + /// + /// contatti + /// + /// + public ActionResult Contact() + { + ViewBag.Title = "MAPO"; + ViewBag.Message = "Per contattarci"; + return View(); + } - /// - /// Path locale dove scaricare gli installer - /// - protected string localDownloadPath(string package) - { - return string.Format(@"{0}{1}\{2}", memLayer.ML.CRS("downloadPath"), package, memLayer.ML.CRS("appVers")); + // GET: Home/Download/Caller (ALL|ADM|IO|LAND|MON|SITE|TAB|CTRACK) + public ActionResult Download(string caller) + { + string resultsMsg = ""; + // in base al caller scarico il file installazione richiesto... + if (caller == null) + { + caller = "ALL"; + } + // ora verifico COSA devo scaricare... + if (updateUrl(caller) != "") + { + // se è ALL scarico tuttoi... + if (caller == "ALL") + { + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); + int done = 0; + // scarico TUTTI... + done += UpdateMan.obj.downloadLatest(updateUrl("ADM"), localDownloadPath("ADM"), "ADM"); + done += UpdateMan.obj.downloadLatest(updateUrl("IO"), localDownloadPath("IO"), "IO"); + done += UpdateMan.obj.downloadLatest(updateUrl("LAND"), localDownloadPath("LAND"), "LAND"); + done += UpdateMan.obj.downloadLatest(updateUrl("MON"), localDownloadPath("MON"), "MON"); + done += UpdateMan.obj.downloadLatest(updateUrl("SITE"), localDownloadPath("SITE"), "SITE"); + done += UpdateMan.obj.downloadLatest(updateUrl("TAB"), localDownloadPath("TAB"), "TAB"); + done += UpdateMan.obj.downloadLatest(updateUrl("CTRACK"), localDownloadPath("CTRACK"), "CTRACK"); + stopWatch.Stop(); + // calcolo elapsed time come TimeSpan value. + TimeSpan ts = stopWatch.Elapsed; + resultsMsg = string.Format("OK: {0} Package downloaded, {1:0.000} sec", done, ts.TotalSeconds); + } + else + { + // scarico singolo target... + UpdateMan.obj.downloadLatest(updateUrl(caller), localDownloadPath(caller), caller); + resultsMsg = string.Format("OK: {0} DOWNLOADED | {1} --> {2}", caller, updateUrl(caller), localDownloadPath(caller)); + } + } + // ...chiamo action + return RedirectToAction("Packages", "Home", new { results = resultsMsg }); + } + + public ActionResult Index() + { + ViewBag.Title = "MAPO"; + // x sicurezza leggo da web.config + ViewBag.Environment = WebConfigurationManager.AppSettings["Environment"]; + using (var ctx = new MoonProEntities()) + { + try + { + // esegue stored procedure come function, recuperando chiave desiderata... + ViewBag.Environment = ctx.stp_AKV_getByKey("Environment").ToList()[0].valString; + // imposto URL dei vari siti + ViewBag.UrlMpSite = ctx.stp_AKV_getByKey("UrlMpSite").ToList()[0].valString; + ViewBag.UrlMpAdmin = ctx.stp_AKV_getByKey("UrlMpAdmin").ToList()[0].valString; + ViewBag.UrlMpIO = ctx.stp_AKV_getByKey("UrlMpIO").ToList()[0].valString; + ViewBag.UrlMpMON = ctx.stp_AKV_getByKey("UrlMpMON").ToList()[0].valString; + ViewBag.UrlMpTAB = ctx.stp_AKV_getByKey("UrlMpTAB").ToList()[0].valString; + ViewBag.UrlMpCTrack = ctx.stp_AKV_getByKey("UrlMpCTrack").ToList()[0].valString; + // importo verifica abilitazione CTrack - !!!FARE!!! vero check key auth! + ViewBag.CTrack_Enb = (ctx.stp_AKV_getByKey("CTRACK").ToList()[0].valString != ""); + } + catch (Exception exc) + { + logger.lg.scriviLog(string.Format("Eccezione in composizione HOME page LAND:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION); + // Default: NO CTrack + ViewBag.CTrack_Enb = false; + } + } + return View(); + } + + /// + /// Gestione download aggiornamenti + /// + /// + /// + public ActionResult Packages(string results) + { + ViewBag.Title = "Steamware's MAPO Suite"; + ViewBag.Message = "Ultime release applicazioni"; + UpdateInfoEventArgs updArgs = new UpdateInfoEventArgs(); + // Recupero info ADM... + updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("ADM")); + if (updArgs.IsUpdateAvailable) + { + ViewBag.VersMpAdmin = updArgs.CurrentVersion; + } + else + { + ViewBag.VersMpAdmin = "ND"; + ViewBag.AdmDisabled = "disabled"; + } + // Recupero info IO... + updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("IO")); + if (updArgs.IsUpdateAvailable) + { + ViewBag.VersMpIO = updArgs.CurrentVersion; + } + else + { + ViewBag.VersMpIO = "ND"; + ViewBag.IODisabled = "disabled"; + } + // Recupero info LAND... + updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("LAND")); + if (updArgs.IsUpdateAvailable) + { + ViewBag.VersMpLand = updArgs.CurrentVersion; + } + else + { + ViewBag.VersMpLand = "ND"; + ViewBag.LandDisabled = "disabled"; + } + // Recupero info MON... + updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("MON")); + if (updArgs.IsUpdateAvailable) + { + ViewBag.VersMpMon = updArgs.CurrentVersion; + } + else + { + ViewBag.VersMpMon = "ND"; + ViewBag.MonDisabled = "disabled"; + } + // Recupero info SITE... + updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("SITE")); + if (updArgs.IsUpdateAvailable) + { + ViewBag.VersMpSite = updArgs.CurrentVersion; + } + else + { + ViewBag.VersMpSite = "ND"; + ViewBag.SiteDisabled = "disabled"; + } + // Recupero info TAB... + updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("TAB")); + if (updArgs.IsUpdateAvailable) + { + ViewBag.VersMpTab = updArgs.CurrentVersion; + } + else + { + ViewBag.VersMpTab = "ND"; + ViewBag.TabDisabled = "disabled"; + } + // Recupero info CTRACK... + updArgs = UpdateMan.obj.getUpdateInfo(updateUrl("CTRACK")); + if (updArgs.IsUpdateAvailable) + { + ViewBag.VersMpCTrack = updArgs.CurrentVersion; + } + else + { + ViewBag.VersMpCTrack = "ND"; + ViewBag.TabDisabled = "disabled"; + } + // salvo risultati... + ViewBag.Results = results; + // fix visibilità CTrack + using (var ctx = new MoonProEntities()) + { + try + { + // importo verifica abilitazione CTrack - !!!FARE!!! vero check key auth! + ViewBag.CTrack_Enb = (ctx.stp_AKV_getByKey("CTRACK").ToList()[0].valString != ""); + } + catch + { + ViewBag.CTrack_Enb = false; + } + } + // VIEW! + return View(); + } + + /// + /// Restituisce un QR code dato valore + /// + /// + /// + public ActionResult QR(string valore) + { + QrCodeEncodingOptions options = new QrCodeEncodingOptions + { + DisableECI = true, + CharacterSet = "UTF-8", + Width = 600, + Height = 600, + Margin = 0 + }; + var writer = new BarcodeWriter(); + writer.Format = BarcodeFormat.QR_CODE; + writer.Options = options; + // scrivo bitmap + var pixelData = writer.Write(valore); + + // Return Image + MemoryStream ms = new MemoryStream(); + pixelData.Save(ms, ImageFormat.Png); + ms.Position = 0; + return new FileStreamResult(ms, "image/png"); + } + + /// + /// System INFO + /// + /// + public ActionResult SystemInfo() + { + ViewBag.Title = "MAPO System Info"; + ViewBag.Message = "HW & SW details"; + + // imposto i vari dati da mostrare a video senza indicare come bypassare... + string connStr = memLayer.ML.confReadString("DbConfConnectionString"); + var currHwSwInfo = HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()); + ViewBag.DbNameExample = connStr.Substring(0, connStr.IndexOf(";Persist Security")); + ViewBag.CodModulo = memLayer.ML.confReadString("CodModulo"); + ViewBag.HwSwInfo = currHwSwInfo; + return View(); + } + + [HttpPost] + public ActionResult UploadFile(HttpPostedFileBase file, string sorgente) + { + if (file != null && file.ContentLength > 0 && sorgente != "") + { + try + { + // forzo nome SEMPRE a web.config + //string path = Path.Combine(Server.MapPath("~/FileUpload"), Path.GetFileName(file.FileName).ToLower()); + string path = Path.Combine(Server.MapPath("~/FileUpload"), "web.config"); + file.SaveAs(path); + ViewBag.Message = "File Caricato!"; + // ora processo import del sorgente selezionato... + } + catch (Exception ex) + { + ViewBag.Message = "ERROR:" + ex.Message.ToString(); + } + } + else + { + ViewBag.Message = "Non è stato selezionato alcun file."; + } + return RedirectToAction("ConfigMan", "Home", new { sorgente }); + } + + /// + /// Gestione QRCode utenti TAB + /// + /// + public ActionResult UserListQR(string id, string From, string Lenght) + { + int lenght = 0; + int from = 0; + int.TryParse(Lenght, out lenght); + int.TryParse(From, out from); + ViewBag.Title = "QR link"; + ViewBag.Message = WebConfigurationManager.AppSettings["Cliente"]; + ViewBag.BaseUrl = WebConfigurationManager.AppSettings["baseAuthUrl"]; + ViewBag.Environment = WebConfigurationManager.AppSettings["Environment"]; + using (var ctx = new MoonProEntities()) + { + try + { + // esegue stored procedure come function, recuperando chiave desiderata... + var elOperatori = ctx.AnagraficaOperatori.ToList(); + if (from + lenght > 0) + { + // seleziono sottoelenco SE ammissibile... + int numRec = elOperatori.Count; + lenght = lenght == 0 ? numRec : lenght; + from = from > numRec ? 0 : from; + if (from < numRec) + { + lenght = from + lenght < numRec ? lenght : numRec - from; + elOperatori = elOperatori.GetRange(from, lenght); + } + } + ViewBag.elOperatori = elOperatori; + } + catch + { } + } + return View((object)ViewBag.elOperatori); + } + + #endregion Public Methods } - /// - /// URLK stringa di UPDATE... - /// - protected string updateUrl(string package) - { - return string.Format("http://seriate.steamware.net:8083/SWS/MAPO/{0}/{1}/manifest.xml", package, memLayer.ML.CRS("appVers")); - } - } } \ No newline at end of file diff --git a/MP-LAND/MP-LAND.csproj b/MP-LAND/MP-LAND.csproj index 0d1cba0b..518f2f1c 100644 --- a/MP-LAND/MP-LAND.csproj +++ b/MP-LAND/MP-LAND.csproj @@ -496,7 +496,7 @@ - + diff --git a/MP-LAND/Views/Home/System.cshtml b/MP-LAND/Views/Home/System.cshtml deleted file mode 100644 index e548db53..00000000 --- a/MP-LAND/Views/Home/System.cshtml +++ /dev/null @@ -1,174 +0,0 @@ -
-
-
-
-
-

@ViewBag.Title

-
-
-

@ViewBag.Message

-
-
-
-
-
-
- -
-
-
-
-
-
-
-
Module
-
-

@SteamWare.memLayer.ML.confReadString("CodModulo")

-
-
-
-
.net framework
-
-

@SteamWare.HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()).runtimeImg

-
-
-
-
Main Assembly
-
-

@SteamWare.HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()).mainAssembly

-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
Server Stats
-
-

-

@SteamWare.HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()).ServerStats
-

-
-
-
-
IIS Stats
-
-

-

@SteamWare.HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()).IISStats
-

-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
Redis Servers Data
-
-

-

@SteamWare.HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()).redisServersData
-

-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
Browser size data
-
-

-

@SteamWare.HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()).paretoBrowserSize
-

-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
Elenco librerie
- @SteamWare.HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()).numLibraries -
-

-

@SteamWare.HwSwInfo.man(System.Reflection.Assembly.GetExecutingAssembly()).librariesVers
-

-
-
-
-
-
- @*
-
-
- -
-
-
-
-

-

-

-
-
-
*@ -
-
-
-
-
-
-
-
- - - - diff --git a/MP-LAND/Views/Home/SystemInfo.cshtml b/MP-LAND/Views/Home/SystemInfo.cshtml new file mode 100644 index 00000000..80af5840 --- /dev/null +++ b/MP-LAND/Views/Home/SystemInfo.cshtml @@ -0,0 +1,160 @@ +
+
+
+
+
+

@ViewBag.Title

+
+
+

@ViewBag.Message

+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
Module
+
+

@ViewBag.CodModulo

+
+
+
+
Main DB Conf
+
+

@ViewBag.DbNameExample

+
+
+
+
.net framework
+
+

@ViewBag.HwSwInfo.runtimeImg

+
+
+
+
Main Assembly
+
+

@ViewBag.HwSwInfo.mainAssembly

+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
Server Stats
+
+

+

@ViewBag.HwSwInfo.ServerStats
+

+
+
+
+
IIS Stats
+
+

+

@ViewBag.HwSwInfo.IISStats
+

+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
Redis Servers Data
+
+

+

@ViewBag.HwSwInfo.redisServersData
+

+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
Browser size data
+
+

+

@ViewBag.HwSwInfo.paretoBrowserSize
+

+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
Elenco librerie
+ @ViewBag.HwSwInfo.numLibraries +
+

+

@ViewBag.HwSwInfo.librariesVers
+

+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/MP-LAND/Views/Shared/_Layout.cshtml b/MP-LAND/Views/Shared/_Layout.cshtml index 8cac6d33..966d1417 100644 --- a/MP-LAND/Views/Shared/_Layout.cshtml +++ b/MP-LAND/Views/Shared/_Layout.cshtml @@ -1,58 +1,58 @@  - - - @ViewBag.Title - MP LAND - @Styles.Render("~/Content/css") - @Scripts.Render("~/bundles/modernizr") + + + @ViewBag.Title - MP LAND + @Styles.Render("~/Content/css") + @Scripts.Render("~/bundles/modernizr") -