73 lines
2.2 KiB
C#
73 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.Configuration;
|
|
using System.Web.Mvc;
|
|
|
|
namespace MP_MON.Controllers
|
|
{
|
|
public class HomeController : Controller
|
|
{
|
|
public ActionResult Index()
|
|
{
|
|
// ricarico ogni minuto COMUNQUE tutto...
|
|
string pageRefreshSec = "60";
|
|
// refresh std ogni sec
|
|
int pageRefreshMs = 1000;
|
|
ViewBag.cssSemBase = "sem";
|
|
try
|
|
{
|
|
pageRefreshSec = WebConfigurationManager.AppSettings["pageRefreshSec"];
|
|
}
|
|
catch
|
|
{ }
|
|
if (pageRefreshSec == "") pageRefreshSec = "60";
|
|
ViewBag.pageRefreshMs = pageRefreshMs;
|
|
Response.AddHeader("Refresh", pageRefreshSec);
|
|
return View();
|
|
}
|
|
|
|
public ActionResult Blink()
|
|
{
|
|
// ricarico ogni minuto COMUNQUE tutto...
|
|
string pageRefreshSec = "60";
|
|
// se ho animazione refresh è ogni 2 sec...
|
|
int pageRefreshMs = 2000;
|
|
ViewBag.cssSemBase = "semBlink";
|
|
try
|
|
{
|
|
pageRefreshSec = WebConfigurationManager.AppSettings["pageRefreshSec"];
|
|
}
|
|
catch
|
|
{ }
|
|
if (pageRefreshSec == "") pageRefreshSec = "60";
|
|
ViewBag.pageRefreshMs = pageRefreshMs;
|
|
Response.AddHeader("Refresh", pageRefreshSec);
|
|
return View("Index");
|
|
}
|
|
|
|
public ActionResult GetClock()
|
|
{
|
|
return PartialView("_mmClock");
|
|
}
|
|
|
|
public ActionResult checkIOB()
|
|
{
|
|
string esito = "ND";
|
|
// verifico TUTTE le macchine x il keepAlive e se almeno 1 è offline da oltre "keepAliveMin" minuti --> invio email!!!
|
|
int keepAliveMin = 1;
|
|
try
|
|
{
|
|
keepAliveMin = Convert.ToInt32(WebConfigurationManager.AppSettings["pageRefreshSec"]);
|
|
}
|
|
catch
|
|
{ }
|
|
|
|
esito = "OK";
|
|
ViewBag.EsitoVerifica = esito;
|
|
return PartialView("_checkIOB");
|
|
//return View();
|
|
}
|
|
}
|
|
} |