public override ActionResult Index(int?id) { base.Index(id); GeneralHistoryModel model = new GeneralHistoryModel(); return(View(model)); }
public JsonResult GeneralGridHistory(GeneralHistoryModel model, PageInfo pageInfo) { string items = "["; string[] columns = model.Fields.Split(','); if (!string.IsNullOrWhiteSpace(model.DeviceID)) { string sdate = model.StartDate; string edate = model.EndDate; InfluxDBHistoryResult realResult = mWebInfluxDbManager.DbQuery_History(model.ServerID, model.CommunicateID, model.DeviceID, Convert.ToDateTime(sdate), Convert.ToDateTime(edate), pageInfo.limit, pageInfo.page, " DESC "); foreach (var s in realResult.Seres) { List <int> indexs = new List <int>(); for (int i = 0; i < s.Values.Count; i++) { string jsonrow = ""; int index = s.Columns.IndexOf("time"); object time = s.Values[i][index]; jsonrow += "{"; jsonrow += "\"DateStampTime\":\"" + (time != null ? time.ToString() : "") + "\""; foreach (string str in columns) { try { index = -1; index = s.Columns.IndexOf("field_" + str.Trim().ToLower().ToString() + "_value"); if (index >= 0) { object v = s.Values[i][index]; jsonrow += ",\"" + str + "\":\"" + (v != null ? v.ToString() : "") + "\""; } } catch { continue; } } jsonrow += "},"; items += jsonrow; } } items += "]"; var result = Pager.Paging2(items, realResult.RecordCount); //读取以下的实时数据,从influxDB中读取 return(Json(result, "application/text", JsonRequestBehavior.AllowGet)); } else { var result = Pager.Paging2("", 0); return(Json(result, "application/text", JsonRequestBehavior.AllowGet)); } }
public ActionResult HistorySeries() { GeneralHistoryModel model = new GeneralHistoryModel(); return(View(model)); }