diff --git a/QR-GEN/Controllers/HomeController.cs b/QR-GEN/Controllers/HomeController.cs index b115d7e..c09e9ea 100644 --- a/QR-GEN/Controllers/HomeController.cs +++ b/QR-GEN/Controllers/HomeController.cs @@ -4,6 +4,8 @@ using System.Web; using System.Web.Mvc; using ZXing; using ZXing.QrCode; +using Newtonsoft.Json; +using System.Collections.Generic; namespace QR_GEN.Controllers { @@ -16,6 +18,14 @@ namespace QR_GEN.Controllers { public string valore; } + /// + /// Payload da deserializzare json + /// + public struct qrPayload + { + public string baseUrl { get; set; } + public string[] parameters { get; set; } + } public ActionResult Index() { @@ -91,6 +101,8 @@ namespace QR_GEN.Controllers id = richiesta.valore; } #endif + + #if false // url decode... id = HttpUtility.UrlDecode(id); @@ -99,6 +111,8 @@ namespace QR_GEN.Controllers // valutare se usare file web.config, file .ini, file conf generico... string tgtUrl = ""; + // se l' + // in base a richiesta compongo stringa ... switch (id) { @@ -111,6 +125,14 @@ namespace QR_GEN.Controllers 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; } diff --git a/QR-GEN/QR-GEN.csproj b/QR-GEN/QR-GEN.csproj index 34f7147..73017a9 100644 --- a/QR-GEN/QR-GEN.csproj +++ b/QR-GEN/QR-GEN.csproj @@ -47,15 +47,12 @@ 4 - - ..\packages\Microsoft.AspNet.TelemetryCorrelation.1.0.4\lib\net45\Microsoft.AspNet.TelemetryCorrelation.dll - ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll - ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll + ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll diff --git a/QR-GEN/Web.config b/QR-GEN/Web.config index a5c65a9..1abe9fb 100644 --- a/QR-GEN/Web.config +++ b/QR-GEN/Web.config @@ -14,7 +14,6 @@ - @@ -54,9 +53,7 @@ - - - + diff --git a/QR-GEN/packages.config b/QR-GEN/packages.config index 1fa03f4..006118f 100644 --- a/QR-GEN/packages.config +++ b/QR-GEN/packages.config @@ -8,7 +8,6 @@ - @@ -17,7 +16,7 @@ - +