Exemplo n.º 1
0
        private T _GetGPObject <T>(
            IVrpRestService client,
            string jobId,
            string objectUrl)
            where T : IFaultInfo
        {
            Debug.Assert(client != null);
            Debug.Assert(jobId != null);
            Debug.Assert(objectUrl != null);

            var result = default(T);

            try
            {
                result = client.GetGPObject <T>(jobId, objectUrl);
            }
            catch (RestException e)
            {
                _LogServiceError(e);
                throw SolveHelper.ConvertServiceException(
                          String.Format(Properties.Messages.Error_GetJobParameter, jobId), e);
            }

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Provides solve operation.
        /// </summary>
        /// <param name="request">Request to solver.</param>
        /// <param name="cancelTracker">Cancel tracker.</param>
        /// <returns>Function returning BatchRouteSolveResponse.</returns>
        /// <exception cref="ESRI.ArcLogistics.Routing.RouteException">If get
        /// directions operation error occurs.</exception>
        public Func <SolveOperationResult <BatchRouteSolveRequest> > Solve(
            BatchRouteSolveRequest request,
            ICancelTracker cancelTracker)
        {
            Debug.Assert(request != null);
            Debug.Assert(request.Requests != null);

            try
            {
                List <RouteSolveResponse> responses = new List <RouteSolveResponse>();
                foreach (RouteSolveRequest req in request.Requests)
                {
                    responses.Add(_context.RouteService.Solve(req,
                                                              RouteRequestBuilder.JsonTypes));
                }

                var response = new BatchRouteSolveResponse(responses.ToArray());

                return(() => new SolveOperationResult <BatchRouteSolveRequest>
                {
                    SolveResult = _ProcessSolveResult(response),
                    NextStepOperation = null,
                });
            }
            catch (RestException e)
            {
                throw SolveHelper.ConvertServiceException(
                          Properties.Messages.Error_GetDirections, e);
            }
        }
Exemplo n.º 3
0
        private GetVrpJobResultResponse _GetJobResult(
            IVrpRestService client,
            string jobId)
        {
            Debug.Assert(client != null);
            Debug.Assert(jobId != null);

            GetVrpJobResultResponse response = null;

            try
            {
                response = client.GetJobResult(jobId);
            }
            catch (RestException e)
            {
                _LogServiceError(e);
                throw SolveHelper.ConvertServiceException(
                          String.Format(Properties.Messages.Erorr_GetJobResult, jobId), e);
            }

            return(response);
        }
Exemplo n.º 4
0
        private GetVrpJobResultResponse _SubmitJob(
            IVrpRestService client,
            SubmitVrpJobRequest request)
        {
            Debug.Assert(client != null);
            Debug.Assert(request != null);

            GetVrpJobResultResponse response = null;

            try
            {
                response = client.SubmitJob(request);
            }
            catch (RestException e)
            {
                _LogServiceError(e);
                throw SolveHelper.ConvertServiceException(
                          Properties.Messages.Error_SubmitJobFailed, e);
            }

            return(response);
        }