diff --git a/MP-MON/Controllers/MSEController.cs b/MP-MON/Controllers/MSEController.cs
index b7d9bbe0..e5ce6bd1 100644
--- a/MP-MON/Controllers/MSEController.cs
+++ b/MP-MON/Controllers/MSEController.cs
@@ -9,112 +9,138 @@ using System.Web.Mvc;
namespace MP_MON.Controllers
{
- public class MSEController : Controller
- {
- DataLayer DataLayerObj = new DataLayer();
- private MapoMonEntities db = new MapoMonEntities();
+ public class MSEController : Controller
+ {
+ #region Private Fields
- // GET: StatusMap
- public ActionResult StatusMap(string baseCss)
- {
- memLayer.ML.setSessionVal("IdxMacchina", "***ALL***");
- return SingleStatus(baseCss, "***ALL***");
- }
+ private DataLayer DataLayerObj = new DataLayer();
+ private MapoMonEntities db = new MapoMonEntities();
- ///
- /// Output MSE in formato string/json
- ///
- public string getData(string id)
- {
- int dataRefresh = 2000;
- string answ = "";
- answ = DataLayerObj.currMSE;
- if (!string.IsNullOrEmpty(answ))
- {
- List dati = getDbSaveRedis(dataRefresh);
- }
- return answ;
- }
- // GET: StatusMap
- public ActionResult SingleStatus(string baseCss, string IdxMacchina)
- {
- int dataRefresh = 2000;
- // salvo idxMacc in sessione se c'è...
- if (!string.IsNullOrEmpty(IdxMacchina))
- {
- memLayer.ML.setSessionVal("IdxMacchina", IdxMacchina);
- }
- else
- {
- IdxMacchina = memLayer.ML.StringSessionObj("IdxMacchina");
- }
- try
- {
- dataRefresh = Convert.ToInt32(System.Web.Configuration.WebConfigurationManager.AppSettings["dataRefreshMs"]);
- }
- catch
- { }
- List dati = new List();
- string currMse = DataLayerObj.currMSE;
- if (!string.IsNullOrEmpty(currMse))
- {
- try
+ #endregion Private Fields
+
+ #region Private Methods
+
+ ///
+ /// Restituisce dati da DB (e li salva su REDIS...)
+ ///
+ /// Parametro x procedura ricalcolo MSE
+ private List getDbSaveRedis(int dataRefresh)
{
- dati = JsonConvert.DeserializeObject>(currMse);
+ List dati = new List();
+ // se non c'è rileggo...
+ logger.lg.scriviLog("Recuperata MSE da DB");
+ dati = db.stp_MSE_getData(dataRefresh).ToList();
+ // serializzo
+ DataLayerObj.currMSE = JsonConvert.SerializeObject(dati);
+ return dati;
}
- catch (Exception exc)
+
+ #endregion Private Methods
+
+ #region Protected Methods
+
+ protected override void Dispose(bool disposing)
{
- dati = getDbSaveRedis(dataRefresh);
- logger.lg.scriviLog(string.Format("Recuperata MSE da DB{0}{1}", Environment.NewLine, exc));
+ if (disposing)
+ {
+ db.Dispose();
+ }
+ base.Dispose(disposing);
}
- }
- else
- {
- dati = getDbSaveRedis(dataRefresh);
- }
- // filtro dati SOLO PER la macchina che mi interessa... SE C'E'...
- string reqView = "_StatusMap";
- if (IdxMacchina != "***ALL***")
- {
- dati = dati.Where(e => e.IdxMacchina == IdxMacchina).ToList();
- reqView = "_StatusMapSingle";
- }
- ViewBag.baseCss = baseCss;
- ViewBag.IdxMacchina = IdxMacchina;
- // aggiungo il controllo del NUM MAX col x singola riga
- int maxCol = 6;
- try
- {
- maxCol = memLayer.ML.cdvi("MON_maxCol");
- }
- catch
- { }
- ViewBag.maxCol = maxCol;
- return PartialView(reqView, dati);
- }
- ///
- /// Restituisce dati da DB (e li salva su REDIS...)
- ///
- /// Parametro x procedura ricalcolo MSE
- private List getDbSaveRedis(int dataRefresh)
- {
- List dati = new List();
- // se non c'è rileggo...
- logger.lg.scriviLog("Recuperata MSE da DB");
- dati = db.stp_MSE_getData(dataRefresh).ToList();
- // serializzo
- DataLayerObj.currMSE = JsonConvert.SerializeObject(dati);
- return dati;
- }
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- {
- db.Dispose();
- }
- base.Dispose(disposing);
- }
+ #endregion Protected Methods
- }
-}
+ #region Public Methods
+
+ ///
+ /// Output MSE in formato string/json
+ ///
+ public string getData(string id)
+ {
+ int dataRefresh = 2000;
+ string answ = "";
+ answ = DataLayerObj.currMSE;
+ if (!string.IsNullOrEmpty(answ))
+ {
+ List dati = getDbSaveRedis(dataRefresh);
+ }
+ return answ;
+ }
+
+ // GET: StatusMap
+ public ActionResult SingleStatus(string baseCss, string IdxMacchina)
+ {
+ int dataRefresh = 2000;
+ // salvo idxMacc in sessione se c'è...
+ if (!string.IsNullOrEmpty(IdxMacchina))
+ {
+ memLayer.ML.setSessionVal("IdxMacchina", IdxMacchina);
+ }
+ else
+ {
+ IdxMacchina = memLayer.ML.StringSessionObj("IdxMacchina");
+ }
+ try
+ {
+ dataRefresh = Convert.ToInt32(System.Web.Configuration.WebConfigurationManager.AppSettings["dataRefreshMs"]);
+ }
+ catch
+ { }
+ List dati = new List();
+ string currMse = DataLayerObj.currMSE;
+ if (!string.IsNullOrEmpty(currMse))
+ {
+ try
+ {
+ dati = JsonConvert.DeserializeObject>(currMse);
+ }
+ catch (Exception exc)
+ {
+ dati = getDbSaveRedis(dataRefresh);
+ logger.lg.scriviLog(string.Format("Recuperata MSE da DB{0}{1}", Environment.NewLine, exc));
+ }
+ }
+ else
+ {
+ dati = getDbSaveRedis(dataRefresh);
+ }
+ // filtro dati SOLO PER la macchina che mi interessa... SE C'E'...
+ string reqView = "_StatusMap";
+ if (IdxMacchina != "***ALL***")
+ {
+ // se ho elenco macchine idxMacc|idxMacc
+ if (IdxMacchina.IndexOf("|") > 0)
+ {
+ dati = dati.Where(e => IdxMacchina.IndexOf(e.IdxMacchina) >= 0).ToList();
+ reqView = "_StatusMapSingle";
+ }
+ else
+ {
+ dati = dati.Where(e => e.IdxMacchina == IdxMacchina).ToList();
+ reqView = "_StatusMapSingle";
+ }
+ }
+ ViewBag.baseCss = baseCss;
+ ViewBag.IdxMacchina = IdxMacchina;
+ // aggiungo il controllo del NUM MAX col x singola riga
+ int maxCol = 6;
+ try
+ {
+ maxCol = memLayer.ML.cdvi("MON_maxCol");
+ }
+ catch
+ { }
+ ViewBag.maxCol = maxCol;
+ return PartialView(reqView, dati);
+ }
+
+ // GET: StatusMap
+ public ActionResult StatusMap(string baseCss)
+ {
+ memLayer.ML.setSessionVal("IdxMacchina", "***ALL***");
+ return SingleStatus(baseCss, "***ALL***");
+ }
+
+ #endregion Public Methods
+ }
+}
\ No newline at end of file
diff --git a/MP-MON/MP-MON.csproj b/MP-MON/MP-MON.csproj
index 2a7731e4..c3c8f818 100644
--- a/MP-MON/MP-MON.csproj
+++ b/MP-MON/MP-MON.csproj
@@ -389,6 +389,7 @@
MapoModel.Designer.cs
+ MapoModel.edmx
@@ -532,7 +533,7 @@
-
+ Designer
diff --git a/MP-MON/Views/MSE/_StatusMap.cshtml b/MP-MON/Views/MSE/_StatusMap.cshtml
index 2c516f28..3c8e93a6 100644
--- a/MP-MON/Views/MSE/_StatusMap.cshtml
+++ b/MP-MON/Views/MSE/_StatusMap.cshtml
@@ -1,6 +1,6 @@
@model IEnumerable
-
+
@{
// salvo variabili num blocchi x riga
@@ -123,7 +123,7 @@
// controllo se ho resto zero --> uso NUOVA riga...
if ((numBlock % maxCol) == maxCol - 1)
{
- @Html.Raw("