public HttpResponseMessage GetMonitoringcurve() { ResponseMessage responseMessage = new ResponseMessage(0); HttpResponseMessage result = new HttpResponseMessage(); try { HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"]; //获取传统context HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*"); //解决跨域问题 Dictionary <string, object> dcParams = new Dictionary <string, object>(); dcParams = DictionaryPro.RequestToDic(context); string stcd = DictionaryPro.GetDicValue(dcParams, "stcd"); string list = ""; //DAL VW_Monitoringindex_DAL dal = new VW_Monitoringindex_DAL(); if (stcd != "") { list = dal.GetMonitoringcurve(stcd); } int cnt = 0; //返回数据 responseMessage.message = new { total = cnt, rows = list }; result.Content = new StringContent(JsonHelper.Object2Json(responseMessage), Encoding.GetEncoding("utf-8"), "application/json"); } catch (Exception ex) { //返回错误信息 //responseMessage.status = -1; //responseMessage.message = ex.Message; } return(result); }
public HttpResponseMessage GetMonitoringindex() { ResponseMessage responseMessage = new ResponseMessage(0); HttpResponseMessage result = new HttpResponseMessage(); try { bool flag = false; HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];//获取传统context HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*"); Dictionary <string, object> dcParams = new Dictionary <string, object>(); dcParams = DictionaryPro.RequestToDic(context); DataTable td = new DataTable(); VW_Monitoringindex_DAL dal = new VW_Monitoringindex_DAL(); td = dal.GetVW_Monitoringindex(); responseMessage.message = new { rows = td }; result.Content = new StringContent(JsonHelper.Object2Json(responseMessage), Encoding.GetEncoding("utf-8"), "application/json"); } catch (Exception ex) { //返回错误信息 //返回错误信息 responseMessage.status = -1; responseMessage.message = ex.Message; } return(result); }