Exemple #1
0
        public ResponseResult GetDataByPNCount(string loginName, string parameterName)
        {
            var result = ResponseResult.Default();
            WaterDataService waterService = new WaterDataService();
            string           counts       = null;

            try
            {
                if (string.IsNullOrEmpty(loginName))
                {
                    return(ResponseResult.Error("登录名不能为空"));
                }
                if (string.IsNullOrEmpty(loginName))
                {
                    return(ResponseResult.Error("参数名不能为空"));
                }
                else
                {
                    counts = waterService.GetDataByPNCount(loginName, parameterName).ToString();
                    result = ResponseResult.Success(counts);
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult.Error(ex.Message);
            }
            return(result);
        }
Exemple #2
0
        public ResponseResult <WaterData> GetDataByPN(string loginName, 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(parameterName))
                {
                    return(ResponseResult <WaterData> .Error("参数不能为空"));
                }
                if (string.IsNullOrEmpty(page))
                {
                    return(ResponseResult <WaterData> .Error("page不能为空"));
                }
                if (string.IsNullOrEmpty(limit))
                {
                    return(ResponseResult <WaterData> .Error("limit不能为空"));
                }
                else
                {
                    datas    = waterService.GetDataByPN(loginName, parameterName, Convert.ToInt32(page), Convert.ToInt32(limit));
                    newcount = waterService.GetDataByPNCount(loginName, parameterName);
                    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);
        }