using SteamWare; 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/ public HttpResponseMessage Get() { string answ = ""; // recupero da REDIS! string redKey = memLayer.ML.redHash("MachineUnload:01:Css"); // se vuoto scrivo versione attuale... 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... !!!FIXME!!! leggere da DB!!!! { string filename = HttpContext.Current.Server.MapPath("~/Content/SheetColor.css"); answ = File.ReadAllText(filename); // imposto sfondo ... NON usato answ = answ.Replace("#BLK-BCK", "#Sheet"); // All'inizio --> tutti colorati secondo destinazione (cart, bin, secop) // eventualmente sec-op è SECONDO css aggiuntivo opzionale x indicare tratteggiato e/o tratteggiato + flashing... // ...e primi 3 items... answ = answ.Replace("#BLK-CUT", "#IT00008594, #IT000085AC, #IT000085AD, #IT000085AE"); answ = answ.Replace("#BLK-SEC-OP", "#IT000085AF"); answ = answ.Replace("#BLK-SEL", "#IT000085C2"); answ = answ.Replace("#BLK-BIN", "#IT000085BE"); answ = answ.Replace("#BLK-CART", "#IT000085AB"); //answ = answ.Replace("#BLK-CUT", "#IT000006, #IT000007, #IT000008"); //answ = answ.Replace("#BLK-SEL", "#IT000003"); //answ = answ.Replace("#BLK-BIN", "#IT000001"); //answ = answ.Replace("#BLK-CART", "#IT000002"); // salvo redis! memLayer.ML.setRSV(redKey, answ); } return new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(answ, Encoding.UTF8, "text/css") }; } // GET api//5 public string Get(int id) { return "value"; } // POST api/ public void Post([FromBody]string value) { } // PUT api//5 public void Put(int id, [FromBody]string value) { } // DELETE api//5 public void Delete(int id) { } } }