diff --git a/MP-IO/Controllers/IOBController.cs b/MP-IO/Controllers/IOBController.cs index 33aff9a9..7c5a979b 100644 --- a/MP-IO/Controllers/IOBController.cs +++ b/MP-IO/Controllers/IOBController.cs @@ -132,12 +132,12 @@ namespace MP_IO.Controllers { DataLayer DataLayerObj = new DataLayer(); // deserializzo come un dictionary generico di oggetti rawDataType/string - BaseRawTransf receivedData = new BaseRawTransf(); + List receivedData = new List(); // procedo a deserializzare in blocco l'oggetto... try { // deserializzo. - receivedData = JsonConvert.DeserializeObject(content); + receivedData = JsonConvert.DeserializeObject>(content); } catch (Exception exc) { @@ -149,26 +149,30 @@ namespace MP_IO.Controllers { try { - // per ora salvo su REDIS ultimo x tipo - DataLayerObj.lastRawTrasfData = JsonConvert.SerializeObject(receivedData.mesContent); - - // !!! FixMe ToDo fare - // deserializzazione e salvataggio su MongoDB - // salvataggio su tab RawTrasf su DB IS - - // in base al tipo processo... - switch (receivedData.mesType) + foreach (var item in receivedData) { - case rawTransfType.ND: - break; - case rawTransfType.IcoelBatch: - break; - case rawTransfType.IcoelVarInfo: - break; - default: - break; + + // per ora salvo su REDIS ultimo x tipo + DataLayerObj.lastRawTrasfData = JsonConvert.SerializeObject(item.mesContent); + + // !!! FixMe ToDo fare + // deserializzazione e salvataggio su MongoDB + // salvataggio su tab RawTrasf su DB IS + + // in base al tipo processo... + switch (item.mesType) + { + case rawTransfType.ND: + break; + case rawTransfType.IcoelBatch: + break; + case rawTransfType.IcoelVarInfo: + break; + default: + break; + } + insDone++; } - insDone++; // se vuoto --> OK! if (string.IsNullOrEmpty(answ)) { diff --git a/MapoSDK/Objects.cs b/MapoSDK/Objects.cs index f2657aa5..672284d7 100644 --- a/MapoSDK/Objects.cs +++ b/MapoSDK/Objects.cs @@ -167,6 +167,44 @@ namespace MapoSDK /// public rawTransfType mesType { get; set; } = rawTransfType.ND; + /// + /// Costruttore senza parametri + /// + public BaseRawTransf() + { + this.dataRif = DateTime.Now; + this.mesContent = ""; + this.mesType = rawTransfType.ND; + } + + /// + /// Costruttore oggetto + /// + /// + /// + /// + public BaseRawTransf(DateTime dataRif, object mesContent, rawTransfType mesType) + { + this.dataRif = dataRif; + this.mesContent = mesContent; + this.mesType = mesType; + } + + #endregion Public Properties + + + } + + + /// + /// Array valori tipo BaseRawTransf inviati come JSon + /// + public class rawTransfJsonPayload + { + #region Public Properties + + public List rawTransfData { get; set; } + #endregion Public Properties }