From e21d2c187cbaa62e31f095b24e93a1d866ead4ca Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Tue, 26 May 2020 11:04:37 +0200 Subject: [PATCH] Aggiunto ctrack seriate --- Jenkinsfile | 2 +- ZCode/Controllers/HomeController.cs | 195 ++++++++++++++-------------- 2 files changed, 100 insertions(+), 97 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a922f7c..91c54ae 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=77']) { + withEnv(['NEXT_BUILD_NUMBER=78']) { // env.versionNumber = VersionNumber(versionNumberString : '1.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '1.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'ZCode' diff --git a/ZCode/Controllers/HomeController.cs b/ZCode/Controllers/HomeController.cs index fd83150..6c8d3e5 100644 --- a/ZCode/Controllers/HomeController.cs +++ b/ZCode/Controllers/HomeController.cs @@ -11,58 +11,58 @@ using System.Reflection; namespace QR_GEN.Controllers { - public class HomeController : Controller - { - /// - /// Struct x richiesta serializzata/deserializzata - /// - public struct qrRequest + public class HomeController : Controller { - public string valore; - } - /// - /// Payload da deserializzare json - /// - public struct qrPayload - { - public string baseUrl { get; set; } - public string[] parameters { get; set; } - } + /// + /// Struct x richiesta serializzata/deserializzata + /// + public struct qrRequest + { + public string valore; + } + /// + /// Payload da deserializzare json + /// + public struct qrPayload + { + public string baseUrl { get; set; } + public string[] parameters { get; set; } + } - public ActionResult Index() - { - var assembly = Assembly.GetCallingAssembly(); - ViewBag.Version = assembly.GetName().Version; - string company = "Steamware"; - object[] attribs = assembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), true); - if (attribs.Length > 0) - { - company = ((AssemblyCompanyAttribute)attribs[0]).Company; - } - ViewBag.CopyRight = company; - return View(); - } + public ActionResult Index() + { + var assembly = Assembly.GetCallingAssembly(); + ViewBag.Version = assembly.GetName().Version; + string company = "Steamware"; + object[] attribs = assembly.GetCustomAttributes(typeof(AssemblyCompanyAttribute), true); + if (attribs.Length > 0) + { + company = ((AssemblyCompanyAttribute)attribs[0]).Company; + } + ViewBag.CopyRight = company; + return View(); + } - public RedirectResult steamware() - { - return Redirect("https://www.steamware.net"); - } - /// - /// Restituisce un QR code dato valore - /// - /// id x impostare SITO x jumper - /// valore delle opzioni da embeddare - /// - public ActionResult QR_site(string id, string val) - { - string cmdArg = ""; - // se vuoto stea,ware... - if (id == null || id == "") - { - cmdArg = "www.steamware.net"; - } + public RedirectResult steamware() + { + return Redirect("https://www.steamware.net"); + } + /// + /// Restituisce un QR code dato valore + /// + /// id x impostare SITO x jumper + /// valore delle opzioni da embeddare + /// + public ActionResult QR_site(string id, string val) + { + string cmdArg = ""; + // se vuoto stea,ware... + if (id == null || id == "") + { + cmdArg = "www.steamware.net"; + } #if false // se arriva modo json --> deserializzo if (id.IndexOf("{") >= 0) @@ -78,57 +78,60 @@ namespace QR_GEN.Controllers id = HttpUtility.UrlDecode(id); #endif - // valutare se usare file web.config, file .ini, file conf generico... + // valutare se usare file web.config, file .ini, file conf generico... - string tgtUrl = ""; - // se l' + string tgtUrl = ""; + // se l' + + // in base a richiesta compongo stringa ... + switch (id) + { + case "CTRACK_ELET_SCAL": + tgtUrl = @"ctrack.steamware.net/elet-scal/jumper?USER_NAME=info@elettronicascalvina.it&UserAuthkey=asdfbqhewrqg7802345bhasdfg78&CodOpr="; + break; + case "CTRACK_ELET_SCAL_UFF": + tgtUrl = @"http://192.168.1.117/CTRACK/jumper?USER_NAME=info@elettronicascalvina.it&UserAuthkey=asdfbqhewrqg7802345bhasdfg78&CodOpr="; + break; + case "CTRACK_SERIATE": + tgtUrl = @"http://10.74.82.219/CTRACK/jumper?USER_NAME=info@elettronicascalvina.it&UserAuthkey=asdfbqhewrqg7802345bhasdfg78&CodOpr="; + break; + case "CTRACK_COLCOM": + tgtUrl = @"http://192.168.0.113/MP/CTRACK/jumper?USER_NAME=opr_mon&UserAuthkey=AK_sdurb4930r2d&CodOpr="; + break; + case "JSON": + // devo DESERIALIZZARE... + var obj = JsonConvert.DeserializeObject(val); + // metto tutto in tgtUrl... + tgtUrl = string.Format(obj.baseUrl, obj.parameters); + // svuoto val... + val = ""; + break; + default: + break; + } + cmdArg = string.Format("{0}{1}", tgtUrl, val); + // creo! + 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(cmdArg); + + // Return Image + MemoryStream ms = new MemoryStream(); + pixelData.Save(ms, ImageFormat.Png); + ms.Position = 0; + return new FileStreamResult(ms, "image/png"); + } - // in base a richiesta compongo stringa ... - switch (id) - { - case "CTRACK_ELET_SCAL": - tgtUrl = @"ctrack.steamware.net/elet-scal/jumper?USER_NAME=info@elettronicascalvina.it&UserAuthkey=asdfbqhewrqg7802345bhasdfg78&CodOpr="; - break; - case "CTRACK_ELET_SCAL_UFF": - tgtUrl = @"http://192.168.1.117/CTRACK/jumper?USER_NAME=info@elettronicascalvina.it&UserAuthkey=asdfbqhewrqg7802345bhasdfg78&CodOpr="; - break; - case "CTRACK_COLCOM": - tgtUrl = @"http://192.168.0.113/MP/CTRACK/jumper?USER_NAME=opr_mon&UserAuthkey=AK_sdurb4930r2d&CodOpr="; - break; - case "JSON": - // devo DESERIALIZZARE... - var obj = JsonConvert.DeserializeObject(val); - // metto tutto in tgtUrl... - tgtUrl = string.Format(obj.baseUrl, obj.parameters); - // svuoto val... - val = ""; - break; - default: - break; - } - cmdArg = string.Format("{0}{1}", tgtUrl, val); - // creo! - 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(cmdArg); - // Return Image - MemoryStream ms = new MemoryStream(); - pixelData.Save(ms, ImageFormat.Png); - ms.Position = 0; - return new FileStreamResult(ms, "image/png"); } - - - } } \ No newline at end of file