예제 #1
0
        public ResponseResult <Task> GetTaskBySN(string shipName, string loginName, string page, string limit)
        {
            var result = ResponseResult <Task> .Default();

            TaskService taskService = new TaskService();
            List <Task> tasks       = new List <Task>();
            int         newcount    = 0;

            try
            {
                if (string.IsNullOrEmpty(loginName))
                {
                    return(ResponseResult <Task> .Error("用户名不能为空"));
                }
                if (string.IsNullOrEmpty(shipName))
                {
                    return(ResponseResult <Task> .Error("船体不能为空"));
                }
                else
                {
                    tasks    = taskService.GetTaskBySN(shipName, loginName, Convert.ToInt32(page), Convert.ToInt32(limit));
                    newcount = taskService.GetTaskBySNCount(shipName, loginName);
                    result   = ResponseResult <Task> .DataSuccess(tasks, newcount, "获取任务信息成功");
                }
                if (tasks.Count == 0)
                {
                    result = ResponseResult <Task> .Error("无记录");
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <Task> .Error("无记录");
            }
            return(result);
        }
예제 #2
0
        public ResponseResult <Route> GetAllRoute(string loginName, string page, string limit)
        {
            var result = ResponseResult <Route> .Default();

            RouteService routeservice = new RouteService();
            List <Route> routes       = new List <Route>();
            int          newcount     = 0;

            try
            {
                if (string.IsNullOrEmpty(loginName))
                {
                    return(ResponseResult <Route> .Error("登录名称不能为空"));
                }
                else
                {
                    routes   = routeservice.GetAllRoute(loginName, Convert.ToInt32(page), Convert.ToInt32(limit));
                    newcount = routeservice.GetAllRouteCount(loginName);
                    result   = ResponseResult <Route> .DataSuccess(routes, newcount, "获取路径成功");
                }
            }
            catch (System.Exception ex)
            {
                result = ResponseResult <Route> .Error(ex.Message);
            }
            return(result);
        }
예제 #3
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);
        }