コード例 #1
0
        public async Task <IActionResult> GetScenarioRoutes(Guid scenarioId, string fields)
        {
            if (scenarioId == Guid.Empty)
            {
                throw new ArgumentNullException(nameof(scenarioId));
            }

            if (string.IsNullOrEmpty(fields))
            {
                throw new ArgumentNullException(nameof(fields));
            }

            using (loggingHelper.RMTraceManager.StartTrace("WebService.GetScenarioRoutes"))
            {
                string methodName = typeof(DeliveryRouteController) + "." + nameof(GetScenarioRoutes);
                loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteControllerMethodEntryEventId);
                List <object> routes       = null;
                var           routedetails = await deliveryRouteLogBusinessService.GetScenarioRoutes(scenarioId);

                CreateSummaryObject <RouteDTO> createSummary = new CreateSummaryObject <RouteDTO>();

                if (!string.IsNullOrEmpty(fields))
                {
                    routes = createSummary.SummarisePropertiesForList(routedetails, fields);
                }

                loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteControllerMethodExitEventId);

                return(Ok(routes));
            }
        }
コード例 #2
0
        public async Task <IActionResult> GetPostcodeSpecificRoutes(string postcodeunit, string fields)
        {
            if (string.IsNullOrEmpty(postcodeunit))
            {
                throw new ArgumentNullException(nameof(postcodeunit));
            }

            if (string.IsNullOrEmpty(fields))
            {
                throw new ArgumentNullException(nameof(fields));
            }

            using (loggingHelper.RMTraceManager.StartTrace("WebService.GetPostcodeSpecificRoutes"))
            {
                string methodName = typeof(DeliveryRouteController) + "." + nameof(GetPostcodeSpecificRoutes);
                try
                {
                    loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteControllerMethodEntryEventId);
                    List <object> routes       = null;
                    var           routedetails = await deliveryRouteLogBusinessService.GetPostcodeSpecificRoutes(postcodeunit, CurrentUserUnit);

                    CreateSummaryObject <RouteDTO> createSummary = new CreateSummaryObject <RouteDTO>();

                    if (!string.IsNullOrEmpty(fields))
                    {
                        routes = createSummary.SummarisePropertiesForList(routedetails, fields);
                    }

                    loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteControllerMethodExitEventId);
                    return(Ok(routes));
                }
                catch (AggregateException ae)
                {
                    foreach (var exception in ae.InnerExceptions)
                    {
                        loggingHelper.Log(exception, TraceEventType.Error);
                    }

                    var realExceptions = ae.Flatten().InnerException;
                    throw realExceptions;
                }
            }
        }
コード例 #3
0
        public async Task <IActionResult> GetRouteScenarios(Guid operationStateID, Guid locationID, string fields)
        {
            if (operationStateID.Equals(Guid.Empty))
            {
                throw new ArgumentNullException(nameof(operationStateID));
            }

            if (locationID.Equals(Guid.Empty))
            {
                throw new ArgumentNullException(nameof(locationID));
            }

            if (fields.Equals(Guid.Empty))
            {
                throw new ArgumentNullException(nameof(fields));
            }

            string methodName = typeof(UnitManagerController) + "." + nameof(GetPostCodes);

            using (loggingHelper.RMTraceManager.StartTrace("WebService.GetRouteScenarios"))
            {
                loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerControllerMethodEntryEventId);

                List <object>             deliveryScenerioList = null;
                IEnumerable <ScenarioDTO> scenerio             = await unitLocationBusinessService.GetRouteScenarios(operationStateID, locationID);

                CreateSummaryObject <ScenarioDTO> createSummary = new CreateSummaryObject <ScenarioDTO>();

                if (!string.IsNullOrEmpty(fields) && scenerio != null)
                {
                    deliveryScenerioList = createSummary.SummarisePropertiesForList(scenerio.ToList(), fields);
                }

                loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerControllerMethodEntryEventId);
                return(Ok(deliveryScenerioList));
            }
        }