Example #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;
        }