riportati metodi MVC x velocizzare processing pagine servizio MP-IO (con redirect da pagine vecchie)
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using MapoDb;
|
||||
|
||||
namespace MP_IO.Controllers
|
||||
{
|
||||
public class IOBController : Controller
|
||||
{
|
||||
// GET: IOB (è un check alive)
|
||||
public string Index()
|
||||
{
|
||||
return "OK";
|
||||
}
|
||||
|
||||
// disabilitato: non vale la pena
|
||||
//// GET: IOB/enabled/5 - tenuta in cache per 5 sec...
|
||||
//[OutputCache(Duration = 5, VaryByParam = "id")]
|
||||
|
||||
// GET: IOB/enabled/5
|
||||
public string enabled(int? id)
|
||||
{
|
||||
string answ = "ND";
|
||||
// se id nullo --> KO!
|
||||
if (id == null)
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
else
|
||||
{
|
||||
int idx = 0;
|
||||
Int32.TryParse(id.ToString(), out idx);
|
||||
// verifico se sia abilitato INSERT x una data macchina
|
||||
if (MapoDb.MapoDb.obj.insEnabled(idx))
|
||||
{
|
||||
answ = "OK";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "NO";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
// GET: IOB/slog/5
|
||||
public string slog(int? id)
|
||||
{
|
||||
string answ = "ND";
|
||||
// se id nullo --> KO!
|
||||
if (id == null)
|
||||
{
|
||||
answ = "KO";
|
||||
}
|
||||
else
|
||||
{
|
||||
int idx = 0;
|
||||
Int32.TryParse(id.ToString(), out idx);
|
||||
// verifico se sia abilitato SignalLog x una data macchina
|
||||
if (MapoDb.MapoDb.obj.sLogEnabled(idx))
|
||||
{
|
||||
answ = "OK";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = "NO";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
// GET: IOB/input/5
|
||||
public string input(int? id)
|
||||
{
|
||||
string answ = "OK " + id.ToString();
|
||||
// controllo se sia da fare rilettura da DB dello stato macchina ( SE non c'è il valore oppure se il valore "maxAgeSec" è stato superato )
|
||||
|
||||
|
||||
// verifico se sia abilitato INSERT x una data macchina
|
||||
|
||||
// cerco prima in cache memory (altrimenti la popolo da DB)
|
||||
|
||||
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user