public ActionResult FilterCurrent() { List <int> alarms = (List <int>)Session["alarmIDs"]; int plcID = 1; string lang = "en"; if (Session["AlarmPlcID"] != null) { plcID = (int)Session["AlarmPlcID"]; } if (Session["AlarmLang"] != null) { if (Session["AlarmLang"].ToString().Length >= 2) { lang = Session["AlarmLang"].ToString(); } } if (alarms != null) { Session["alarmIDs"] = null; AlarmHelper AH = new AlarmHelper(); List <AlarmHelper.alarm_texts> model = new List <AlarmHelper.alarm_texts>(); model = AH.SelectAlarmsTexts(Session["AlarmDB"].ToString(), alarms, plcID, lang); return(View("Filter", model)); } Session["tempforview"] = "Problem with accesing current alarms"; return(RedirectToAction("Index", "Alarm")); }
public ActionResult FilterAll() { int plcID = 1; string lang = "en"; if (Session["AlarmPlcID"] != null) { plcID = (int)Session["AlarmPlcID"]; } if (Session["AlarmLang"] != null) { if (Session["AlarmLang"].ToString().Length >= 2) { lang = Session["AlarmLang"].ToString(); } } AlarmHelper AH = new AlarmHelper(); List <AlarmHelper.alarm_texts> model = new List <AlarmHelper.alarm_texts>(); model = AH.SelectAlarmsTexts(Session["AlarmDB"].ToString(), null, plcID, lang); return(View("Filter", model)); }
public JsonResult getAlarmConfig() { try { int plcID = 1; string DB = string.Empty; string table = string.Empty; foreach (string key in Session.Keys) { if (key.Contains("plcID") && key.Contains(Request.QueryString["plc"].ToString())) { plcID = int.Parse(Session[key].ToString()); } if (key.Contains("dbName") && key.Contains(Request.QueryString["plc"].ToString())) { DB = Session[key].ToString(); } if (key.Contains("tableName") && key.Contains(Request.QueryString["plc"].ToString())) { table = Session[key].ToString(); } } AlarmHelper AH = new AlarmHelper(); List <AlarmHelper.alarm_texts> data = new List <AlarmHelper.alarm_texts>(); AlarmGraphConfig ALG = new AlarmGraphConfig(); data = AH.SelectAlarmsTexts(DB, null, plcID); bool firstEn = true; bool firstCz = true; bool firstDe = true; bool firstPl = true; foreach (AlarmHelper.alarm_texts text in data) { switch (text.lang) { case "en": if (firstEn) { ALG.EN = new List <string>(); } firstEn = false; ALG.EN.Add(text.title); break; case "cs": if (firstCz) { ALG.CZ = new List <string>(); } firstCz = false; ALG.CZ.Add(text.title); break; case "de": if (firstDe) { ALG.DE = new List <string>(); } firstDe = false; ALG.DE.Add(text.title); break; case "pl": if (firstPl) { ALG.PL = new List <string>(); } firstPl = false; ALG.PL.Add(text.title); break; default: if (firstEn) { ALG.EN = new List <string>(); } firstEn = false; ALG.EN.Add(text.title); break; } } return(Json(ALG)); } catch (Exception e) { return(null); } }