From b75ebfb61066fef8bae4e95434eac7768555c5b7 Mon Sep 17 00:00:00 2001 From: "Samuele E. Locatelli" Date: Fri, 1 Mar 2019 12:50:57 +0100 Subject: [PATCH] Ok OrgCode... --- MConnectSDK/MConnectClient.cs | 22 +++++++++++++++++- MConnectSDK/Utils.cs | 42 +++++++++++++++++++++++++++++++++++ TestClient/MainForm.cs | 18 ++++++++------- 3 files changed, 73 insertions(+), 9 deletions(-) diff --git a/MConnectSDK/MConnectClient.cs b/MConnectSDK/MConnectClient.cs index 0b67ebd..c26f61d 100644 --- a/MConnectSDK/MConnectClient.cs +++ b/MConnectSDK/MConnectClient.cs @@ -432,6 +432,25 @@ namespace MConnectSDK } } /// + /// Restituisce codice organizzazione + /// + public string organizationCode + { + get + { + string answ = ""; + if (_currParam.testMode) + { + answ = verifResp.organizationCode; + } + else + { + /// TBD!!! qui la VERA CHIAMATA + } + return answ; + } + } + /// /// Effettua lo step 1 di chiamata x ottenere il TOKEN iniziale /// private void doTokenStep() @@ -479,6 +498,7 @@ namespace MConnectSDK Random r = new Random(); int access = r.Next(1, 999999999); int refresh = r.Next(1, 999999999); + int orgCod = r.Next(1, 999); // salvo token verifResp = new verificationSuccessResponse() { @@ -487,7 +507,7 @@ namespace MConnectSDK token_type = "default", expires = 60000, client_id = _ClientID, - organizationCode = "ABC" + organizationCode = string.Format("A{0:000}", orgCod) }; } else diff --git a/MConnectSDK/Utils.cs b/MConnectSDK/Utils.cs index 4aec060..fb998ae 100644 --- a/MConnectSDK/Utils.cs +++ b/MConnectSDK/Utils.cs @@ -164,4 +164,46 @@ /// offline } + /// + /// Classe info UTENTE + /// + public class userData + { + /// + /// Codice dell'ORGANIZATION (es asfd) + /// + public string organizationCode; + /// + /// Codice utente (es asfd.0002) + /// + public string user_id = ""; + /// + /// Indica se sia attivo + /// + public bool isActive = false; + /// + /// Indica se sia ADMIN + /// + public bool isAdmin = false; + /// + /// UserName (univoco) + /// + public string UserName = ""; + /// + /// Email + /// + public string Email = ""; + /// + /// Cognome + /// + public string Cognome = ""; + /// + /// Nome + /// + public string Nome = ""; + /// + /// URL immagine utente (es http://{{BASE_URL}}/{{Org_code }}/user/img/{{IMG_URL}}.png)) + /// + public string ImgUrl = ""; + } } diff --git a/TestClient/MainForm.cs b/TestClient/MainForm.cs index f88639c..eeff7cd 100644 --- a/TestClient/MainForm.cs +++ b/TestClient/MainForm.cs @@ -296,16 +296,18 @@ namespace TestClient { await Task.Run(() => { - //MCC = new MConnectClient(txtMConnectID.Text.Trim(), txtClientID.Text.Trim(), param); - //reqStatus = MCC.init(); + string orgCode = MCC.organizationCode; - //// sistemo retVal - //saveTokenResp(); + synchronizationContext.Post(new SendOrPostCallback(o => + { + StringBuilder sb = new StringBuilder(); + sb.AppendLine("--------------------------------------------------"); + sb.AppendLine("ORGANIZATION CODE: " + orgCode); + sb.AppendLine("--------------------------------------------------"); + lblConsole.Text = sb.ToString(); - //synchronizationContext.Post(new SendOrPostCallback(o => - //{ - // refreshRequestStatus(); - //}), ""); + refreshRequestStatus(); + }), ""); }); } ///