public ResponseResult GetDataByPTNCount(string loginName, string parameterName, string taskName) { var result = ResponseResult.Default(); WaterDataService waterService = new WaterDataService(); string counts = null; try { if (string.IsNullOrEmpty(loginName)) { return(ResponseResult.Error("登录名不能为空")); } if (string.IsNullOrEmpty(parameterName)) { return(ResponseResult.Error("参数名不能为空")); } if (string.IsNullOrEmpty(taskName)) { return(ResponseResult.Error("任务名不能为空")); } else { counts = waterService.GetDataByPTNCount(loginName, parameterName, taskName).ToString(); result = ResponseResult.Success(counts); } } catch (System.Exception ex) { result = ResponseResult.Error(ex.Message); } return(result); }
public ResponseResult <WaterData> GetDataByPTN(string loginName, string taskName, string parameterName, string page, string limit) { var result = ResponseResult <WaterData> .Default(); WaterDataService waterService = new WaterDataService(); List <WaterData> datas = new List <WaterData>(); int newcount = 0; try { if (string.IsNullOrEmpty(loginName)) { return(ResponseResult <WaterData> .Error("登录名不能为空")); } if (string.IsNullOrEmpty(taskName)) { return(ResponseResult <WaterData> .Error("任务名不能为空")); } if (string.IsNullOrEmpty(parameterName)) { return(ResponseResult <WaterData> .Error("参数名不能为空")); } else { datas = waterService.GetDataByPTN(loginName, parameterName, taskName, Convert.ToInt32(page), Convert.ToInt32(limit)); newcount = waterService.GetDataByPTNCount(loginName, parameterName, taskName); result = ResponseResult <WaterData> .DataSuccess(datas, newcount, "获取数据信息成功"); if (newcount == 0) { result = ResponseResult <WaterData> .Error("无记录"); } } } catch (System.Exception ex) { result = ResponseResult <WaterData> .Error(ex.Message); } return(result); }