From 7aa1ded434d56ef54428545f86bee4dcd6476c27 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 27 Dec 2022 16:19:09 +0100 Subject: [PATCH] fix controlli null valori uri --- MP.INVE/Components/ListQrOpr.razor.cs | 2 +- MP.INVE/Pages/Invio.razor.cs | 2 +- MP.INVE/Pages/Jumper.razor | 2 +- MP.INVE/Pages/Jumper.razor.cs | 24 ++++++++++++++++++------ 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/MP.INVE/Components/ListQrOpr.razor.cs b/MP.INVE/Components/ListQrOpr.razor.cs index 00a84acc..f3f0fdc7 100644 --- a/MP.INVE/Components/ListQrOpr.razor.cs +++ b/MP.INVE/Components/ListQrOpr.razor.cs @@ -65,7 +65,7 @@ namespace MP.INVE.Components get { string answ = ""; - answ = $"{BaseUrlTab}MatrOpr={idOperatore}&UserAuthKey={authKey}&IdSessione=0&IdMag=0"; + answ = $"{BaseUrlTab}MatrOpr={idOperatore}&UserAuthKey={authKey}"; return answ; } } diff --git a/MP.INVE/Pages/Invio.razor.cs b/MP.INVE/Pages/Invio.razor.cs index 9bbbb39b..8a5fae9a 100644 --- a/MP.INVE/Pages/Invio.razor.cs +++ b/MP.INVE/Pages/Invio.razor.cs @@ -40,7 +40,7 @@ namespace MP.INVE.Pages get { string answ = ""; - answ = $"{BaseUrlTab}IdSessione={sessID}&IdMag={codMag}&MatrOpr=0&UserAuthKey=0"; + answ = $"{BaseUrlTab}IdSessione={sessID}&IdMag={codMag}"; return answ; } } diff --git a/MP.INVE/Pages/Jumper.razor b/MP.INVE/Pages/Jumper.razor index 680dc112..d50d059f 100644 --- a/MP.INVE/Pages/Jumper.razor +++ b/MP.INVE/Pages/Jumper.razor @@ -19,7 +19,7 @@ else @json @if (rawScan != "") { - @if (idOpr == "0") + @if (string.IsNullOrEmpty(idOpr)) { } diff --git a/MP.INVE/Pages/Jumper.razor.cs b/MP.INVE/Pages/Jumper.razor.cs index b574639a..a1c092e6 100644 --- a/MP.INVE/Pages/Jumper.razor.cs +++ b/MP.INVE/Pages/Jumper.razor.cs @@ -48,12 +48,25 @@ namespace MP.INVE.Pages var uri = NavManager.ToAbsoluteUri(NavManager.Uri); if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("MatrOpr", out var _matrOpr) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("UserAuthKey", out var _authKey) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idSessione", out var _inveSessionId) && QueryHelpers.ParseQuery(uri.Query).TryGetValue("idMag", out var _codMag)) { - idOpr = _matrOpr; - authKey = _authKey; - codMag = _codMag; - inveSessionId = int.Parse(_inveSessionId); + if (!string.IsNullOrEmpty(_matrOpr)) + { + idOpr = _matrOpr; + } + if (!string.IsNullOrEmpty(_authKey)) + { + authKey = _authKey; + } + if (!string.IsNullOrEmpty(_codMag)) + { + codMag = _codMag; + } + if (inveSessionId != 0) + { + inveSessionId = int.Parse(_inveSessionId); + } + } - if (idOpr != "0" && authKey != "0") + if (!string.IsNullOrEmpty(idOpr) && !string.IsNullOrEmpty(authKey)) { isFullUrl = true; string pw = MIService.DeriptData(authKey); @@ -100,7 +113,6 @@ namespace MP.INVE.Pages var uriProc1 = newScan.Split("?"); //eseguo split su "&" e divido il rimanente del link ottenendo cosė le variabili singole var uriProc2 = uriProc1[1].Split("&"); - //eseguo split su "=" ottenendo il valore delle variabili string[] uriProc3; for (int i = 0; i < uriProc2.Length; i++)