コード例 #1
0
 public ActionResult BatchRead()
 {
     try
     {
         int uID = int.Parse(Request.Params.Get("UID"));
         // 存储水位:1
         // 实测水位:2
         // 雨量:3
         // 墒情:4 = = 暂时不需要,没有对应协议
         string               trans       = Request.Params.Get("Trans");
         List <string>        stationList = new List <string>();
         var                  stations    = Request.Params.Get("stationId");
         JavaScriptSerializer js          = new JavaScriptSerializer();
         stationList = js.Deserialize <List <string> >(stations);
         var ret = JsonConvert.SerializeObject(BatchService.GetReadDatas(uID, stationList, trans));
         return(Json(ret, JsonRequestBehavior.AllowGet));
     }
     catch (Exception e)
     {
         QueryResult error = new QueryResult();
         var         ret   = JsonConvert.SerializeObject(error);
         return(Json(ret, JsonRequestBehavior.AllowGet));
     }
 }