public ResponseResult <WaterData> GetAllDataByTN(string loginName, string taskName) { var result = ResponseResult <WaterData> .Default(); WaterDataService waterService = new WaterDataService(); List <WaterData> datas = new List <WaterData>(); try { if (string.IsNullOrEmpty(loginName)) { return(ResponseResult <WaterData> .Error("登录名不能为空")); } if (string.IsNullOrEmpty(taskName)) { return(ResponseResult <WaterData> .Error("任务名不能为空")); } else { datas = waterService.GetDataByTN(loginName, taskName); result = ResponseResult <WaterData> .Success(datas, "获取成功"); } } catch (System.Exception ex) { result = ResponseResult <WaterData> .Error(ex.Message); } return(result); }
public ResponseResult <WaterData> GetDataByTN(string loginName, string taskName, 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("任务名不能为空")); } else { datas = waterService.GetDataByTN(loginName, taskName, Convert.ToInt32(page), Convert.ToInt32(limit)); newcount = waterService.GetDataByTNCount(loginName, 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); }