68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using AppData;
|
|
using Newtonsoft.Json;
|
|
using SteamWare;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Http;
|
|
|
|
namespace NKC_WF.Controllers
|
|
{
|
|
public class getMUCssController : ApiController
|
|
{
|
|
// GET api/getMUCssController
|
|
public HttpResponseMessage Get()
|
|
{
|
|
string answ = getCssByPost(0);
|
|
return new HttpResponseMessage(HttpStatusCode.OK)
|
|
{
|
|
Content = new StringContent(answ, Encoding.UTF8, "text/css")
|
|
};
|
|
}
|
|
|
|
// GET api/getMUCssController/5
|
|
public HttpResponseMessage Get(int id)
|
|
{
|
|
string answ = getCssByPost(id);
|
|
return new HttpResponseMessage(HttpStatusCode.OK)
|
|
{
|
|
Content = new StringContent(answ, Encoding.UTF8, "text/css")
|
|
};
|
|
}
|
|
/// <summary>
|
|
/// Calcola CSS da postsazione
|
|
/// </summary>
|
|
/// <param name="answ"></param>
|
|
/// <param name="_sheetID"></param>
|
|
/// <returns></returns>
|
|
private static string getCssByPost(int sheetID)
|
|
{
|
|
// var base
|
|
string answ = "";
|
|
if (sheetID > 0)
|
|
{
|
|
// recupero da REDIS!
|
|
string redKey = $"{ComLib.machineUnloadArea(sheetID)}:Css";
|
|
// se vuoto scrivo VUOTO...
|
|
if (!memLayer.ML.redKeyPresent(redKey))
|
|
{
|
|
memLayer.ML.setRSV(redKey, answ);
|
|
}
|
|
answ = memLayer.ML.getRSV(redKey);
|
|
// RICALCOLO SOLO SE non trovo in REDIS (perché invalidato)
|
|
if (answ == "")
|
|
// se vuoto lo calcolo...
|
|
{
|
|
answ = ComLib.getCurrentCss(sheetID);
|
|
}
|
|
}
|
|
// restituisco css
|
|
return answ;
|
|
}
|
|
|
|
}
|
|
} |