Esempio n. 1
0
        private void GetStatEsData(HttpContext context)
        {
            int    numOfRecords = 0;
            string strWhere     = string.Empty;
            string statId       = string.Empty;

            if (context.Request.Params["id"] != null)
            {
                statId   = context.Request.Params["id"];
                strWhere = "StatId=" + statId;
            }
            ESDay esBll = new ESDay();

            _dataTable = esBll.GetList(1, strWhere, "UpdateTime DESC").Tables[0];

            foreach (DataRow dr in _dataTable.Rows)
            {
                DateTime dt = (DateTime)dr["UpdateTime"];
                _json.AddItem("Id", statId);
                _json.AddItem("CMP", string.Format("{0:F}", (double)dr["TP"] / 1000.0));
                _json.AddItem("Noise", string.Format("{0:F}", dr["DB"]));
                _json.AddItem("Time", string.Format("{0:G}", dt));
                _json.ItemOk();
                numOfRecords++;
                break;
            }

            _json.success    = true;
            _json.totalCount = numOfRecords;
        }
Esempio n. 2
0
        private void GetLastDayEsData(HttpContext context)
        {
            int    numOfRecords = 0;
            string strWhere     = string.Empty;

            if (context.Request.Params["cityId"] != null)
            {
                strWhere = "Country=" + context.Request.Params["cityId"];
            }

            _dataTable = _bll.GetList(1, strWhere, "UpdateTime DESC").Tables[0];

            foreach (DataRow dr in _dataTable.Rows)
            {
                _json.AddItem("Id", dr["Id"].ToString());
                _json.AddItem("CMP", string.Format("{0:F}", ((double)dr["TP"] / 1000.0)));
                _json.AddItem("Noise", string.Format("{0:F}", dr["DB"]));
                _json.AddItem("PM25", string.Format("{0:F}", ((double)dr["PM25"] / 1000.0)));
                _json.AddItem("PM100", string.Format("{0:F}", ((double)dr["PM100"] / 1000.0)));
                _json.AddItem("Time", dr["UpdateTime"].ToString());
                _json.ItemOk();
                numOfRecords++;
                break;
            }

            _json.success    = true;
            _json.totalCount = numOfRecords;
        }