Exemplo n.º 1
0
        public ResponseResult <WaterData> GetPagingData(string loginName, 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(page))
                {
                    return(ResponseResult <WaterData> .Error("page不能为空"));
                }
                if (string.IsNullOrEmpty(limit))
                {
                    return(ResponseResult <WaterData> .Error("limit不能为空"));
                }
                else
                {
                    datas    = waterService.GetPagingData(loginName, Convert.ToInt32(page), Convert.ToInt32(limit));
                    newcount = waterService.GetAllDataCount(loginName);
                    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);
        }
Exemplo n.º 2
0
        public ResponseResult GetAllDataCount(string loginName)
        {
            var result = ResponseResult.Default();
            WaterDataService waterService = new WaterDataService();
            string           counts       = null;

            try
            {
                if (string.IsNullOrEmpty(loginName))
                {
                    return(ResponseResult.Error("登录名不能为空"));
                }
                else
                {
                    counts = waterService.GetAllDataCount(loginName).ToString();
                    result = ResponseResult.Success(counts);
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult.Error(ex.Message);
            }
            return(result);
        }