Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public ResponseResult DeleteData(string WaterDataId)
        {
            var result = ResponseResult.Default();
            WaterDataService waterService = new WaterDataService();
            List <WaterData> datas        = new List <WaterData>();
            bool             status       = false;

            try
            {
                if (string.IsNullOrEmpty(WaterDataId))
                {
                    return(ResponseResult.Error("WaterDataId不能为空"));
                }
                else
                {
                    status = waterService.DeleteData(Convert.ToInt32(WaterDataId));
                    if (status)
                    {
                        result = ResponseResult.Success("删除成功");
                    }
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult.Error("删除失败");
            }
            return(result);
        }
Beispiel #4
0
        public ResponseResult <WaterData> GetLastTaskData(string loginName)
        {
            var result = ResponseResult <WaterData> .Default();

            WaterDataService waterService = new WaterDataService();
            List <WaterData> datas        = new List <WaterData>();

            try
            {
                if (string.IsNullOrEmpty(loginName))
                {
                    return(ResponseResult <WaterData> .Error("登录名不能为空"));
                }
                else
                {
                    datas  = waterService.GetLastTaskData(loginName);
                    result = ResponseResult <WaterData> .Success(datas, "获取成功");
                }
                if (datas.Count == 0)
                {
                    result = ResponseResult <WaterData> .Error("最近一次没有数据哦!");
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <WaterData> .Error("最近一次没有数据哦!");
            }
            return(result);
        }
Beispiel #5
0
        public ResponseResult <WaterData> GetExDataByPN(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.GetExDataByPN(loginName, parameterName, Convert.ToInt32(page), Convert.ToInt32(limit));
                    newcount = waterService.GetExDataByPNCount(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);
        }