/// <summary> /// Get the notification details based on the UDPRN /// </summary> /// <param name="uDPRN">UDPRN id</param> /// <returns>NotificationDTO object</returns> public async Task<NotificationDTO> GetNotificationByUDPRN(int uDPRN) { using (loggingHelper.RMTraceManager.StartTrace("Business.GetNotificationByUDPRN")) { NotificationDTO notificationDTO = null; string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodEntryEventId, LoggerTraceConstants.Title); var getNotificationByUDPRN = await notificationDataService.GetNotificationByUDPRN(uDPRN); if (getNotificationByUDPRN != null) { notificationDTO = new NotificationDTO { ID = getNotificationByUDPRN.ID, Notification_Heading = getNotificationByUDPRN.Notification_Heading, Notification_Message = getNotificationByUDPRN.Notification_Message, NotificationDueDate = getNotificationByUDPRN.NotificationDueDate, NotificationActionLink = getNotificationByUDPRN.NotificationActionLink, NotificationSource = getNotificationByUDPRN.NotificationSource, PostcodeDistrict = getNotificationByUDPRN.PostcodeDistrict, PostcodeSector = getNotificationByUDPRN.PostcodeSector, NotificationType_GUID = getNotificationByUDPRN.NotificationTypeGUID, NotificationPriority_GUID = getNotificationByUDPRN.NotificationPriorityGUID }; } loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodExitEventId, LoggerTraceConstants.Title); return notificationDTO; } }
public async Task <IActionResult> GeneratePdf([FromBody] PrintMapDTO printMapDTO) { using (loggingHelper.RMTraceManager.StartTrace("WebService.GeneratePdf")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.MapManagerAPIPriority, LoggerTraceConstants.MapManagerControllerMethodEntryEventId, LoggerTraceConstants.Title); try { var result = await mapGeneratorBusinessService.GenerateMapPdfReport(printMapDTO); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.MapManagerAPIPriority, LoggerTraceConstants.MapManagerControllerMethodExitEventId, LoggerTraceConstants.Title); return(Ok(result)); } catch (AggregateException ae) { foreach (var exception in ae.InnerExceptions) { loggingHelper.Log(exception, TraceEventType.Error); } var realExceptions = ae.Flatten().InnerException; throw realExceptions; } } }
/// <summary> /// Gets the name of the reference data categories by category. /// </summary> /// <param name="listName"></param> /// <returns>ReferenceDataCategoryDTO</returns> public async Task <ReferenceDataCategoryDTO> GetReferenceDataSimpleLists(string listName) { using (loggingHelper.RMTraceManager.StartTrace("Integration.GetReferenceDataSimpleLists")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PostalAddressAPIPriority, LoggerTraceConstants.PostalAddressIntegrationServiceMethodEntryEventId, LoggerTraceConstants.Title); ReferenceDataCategoryDTO referenceCategories = new ReferenceDataCategoryDTO(); HttpResponseMessage result = await httpHandler.GetAsync(referenceDataWebAPIName + "simpleLists?listName=" + listName); if (!result.IsSuccessStatusCode) { var responseContent = result.ReasonPhrase; throw new ServiceException(responseContent); } Tuple <string, SimpleListDTO> apiResult = JsonConvert.DeserializeObject <Tuple <string, SimpleListDTO> >(result.Content.ReadAsStringAsync().Result); referenceCategories = ReferenceDataHelper.MapDTO(apiResult.Item2); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PostalAddressAPIPriority, LoggerTraceConstants.PostalAddressIntegrationServiceMethodExitEventId, LoggerTraceConstants.Title); return(referenceCategories); } }
public async Task <IActionResult> AddNewNotification([FromBody] NotificationDTO notificationDTO) { try { using (loggingHelper.RMTraceManager.StartTrace("WebService.AddNewNotification")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationControllerMethodEntryEventId, LoggerTraceConstants.Title); int status = await notificationBusinessService.AddNewNotification(notificationDTO); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationControllerMethodExitEventId, LoggerTraceConstants.Title); return(Ok(status)); } } catch (AggregateException ae) { foreach (var exception in ae.InnerExceptions) { loggingHelper.Log(exception, TraceEventType.Error); } var realExceptions = ae.Flatten().InnerException; throw realExceptions; } }
public async Task <IActionResult> CheckIfNotificationExists(int udprn, string actionname) { using (loggingHelper.RMTraceManager.StartTrace("WebService.CheckIfNotificationExists")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationControllerMethodEntryEventId, LoggerTraceConstants.Title); try { bool notificationExists = await notificationBusinessService.CheckIfNotificationExists(udprn, actionname); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationControllerMethodExitEventId, LoggerTraceConstants.Title); return(Ok(notificationExists)); } catch (AggregateException ae) { foreach (var exception in ae.InnerExceptions) { loggingHelper.Log(exception, TraceEventType.Error); } var realExceptions = ae.Flatten().InnerException; throw realExceptions; } } }
/// <summary> /// Fetch postcode for basic search /// </summary> /// <param name="searchText">The text to be searched</param> /// <param name="unitGuid">The unit unique identifier.</param> /// <returns> /// The result set of post code /// </returns> public async Task <List <PostCodeDTO> > FetchPostCodeUnitForBasicSearch(string searchText, Guid unitGuid) { using (loggingHelper.RMTraceManager.StartTrace("DataService.FetchPostCodeUnitForBasicSearch")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PostCodePriority, LoggerTraceConstants.PostCodeDataServiceMethodEntryEventId, LoggerTraceConstants.Title); int takeCount = Convert.ToInt32(ConfigurationManager.AppSettings[SearchResultCount]); searchText = searchText ?? string.Empty; var postCodeDetailsDto = await(from p in DataContext.Postcodes.AsNoTracking() join s in DataContext.PostcodeSectors.AsNoTracking() on p.SectorGUID equals s.ID join u in DataContext.UnitPostcodeSectors.AsNoTracking() on s.ID equals u.PostcodeSector_GUID where p.PostcodeUnit.StartsWith(searchText) && u.Unit_GUID == unitGuid select new PostCodeDTO { PostcodeUnit = p.PostcodeUnit, InwardCode = p.InwardCode, OutwardCode = p.OutwardCode, Sector = p.Sector }).Take(takeCount).ToListAsync(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PostCodePriority, LoggerTraceConstants.PostCodeDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(postCodeDetailsDto); } }
/// <summary> /// Update the Notification By UDPRN /// </summary> /// <param name="listNames">Category names</param> /// <returns>returns Category details</returns> public async Task <List <CommonLibrary.EntityFramework.DTO.ReferenceDataCategoryDTO> > GetReferenceDataSimpleLists(List <string> listNames) { using (loggingHelper.RMTraceManager.StartTrace("Integration.GetReferenceDataSimpleLists")) { string method = typeof(ThirdPartyAddressLocationIntegrationService) + "." + nameof(GetReferenceDataSimpleLists); loggingHelper.LogMethodEntry(method, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationIntegrationServiceMethodEntryEventId); List <CommonLibrary.EntityFramework.DTO.ReferenceDataCategoryDTO> listReferenceCategories = new List <CommonLibrary.EntityFramework.DTO.ReferenceDataCategoryDTO>(); string methodName = MethodHelper.GetActualAsyncMethodName(); string serviceUrl = configurationHelper.ReadAppSettingsConfigurationValues(ReferenceDataWebAPIName); string route = configurationHelper.ReadAppSettingsConfigurationValues(methodName); HttpResponseMessage result = await httpHandler.PostAsJsonAsync(serviceUrl + route, listNames); if (!result.IsSuccessStatusCode) { // LOG ERROR WITH Statuscode var responseContent = result.ReasonPhrase; throw new ServiceException(responseContent); } List <SimpleListDTO> apiResult = JsonConvert.DeserializeObject <List <SimpleListDTO> >(result.Content.ReadAsStringAsync().Result); listReferenceCategories.AddRange(ReferenceDataHelper.MapDTO(apiResult)); loggingHelper.LogMethodExit(method, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationIntegrationServiceMethodExitEventId); return(listReferenceCategories); } }
/// <summary> /// Update Delivery Point by Id /// </summary> /// <param name="deliveryPointDTO">Delivery Point DTO</param> /// <returns>whether DP has been updated successfully</returns> public async Task <Guid> UpdateDeliveryPointById(DeliveryPointDTO deliveryPointDTO) { using (loggingHelper.RMTraceManager.StartTrace("Integration.UpdateDeliveryPointById")) { string method = typeof(ThirdPartyAddressLocationIntegrationService) + "." + nameof(UpdateDeliveryPointById); loggingHelper.LogMethodEntry(method, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationIntegrationServiceMethodEntryEventId); string methodName = MethodHelper.GetActualAsyncMethodName(); string serviceUrl = configurationHelper.ReadAppSettingsConfigurationValues(DeliveryPointManagerDataWebAPIName); string route = configurationHelper.ReadAppSettingsConfigurationValues(methodName); string serializedDeliveryPoint = JsonConvert.SerializeObject(deliveryPointDTO); HttpResponseMessage result = await httpHandler.PutAsJsonAsync(serviceUrl + route, serializedDeliveryPoint); if (!result.IsSuccessStatusCode) { // LOG ERROR WITH Statuscode var responseContent = result.ReasonPhrase; throw new ServiceException(responseContent); } Guid deliveryPointID = JsonConvert.DeserializeObject <Guid>(result.Content.ReadAsStringAsync().Result); loggingHelper.LogMethodExit(method, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationIntegrationServiceMethodExitEventId); return(deliveryPointID); } }
/// <summary> /// Update Delivery Point by Id /// </summary> /// <param name="udprn">UDPRN id</param> /// <param name="oldAction">old action</param> /// <param name="newAction">new action</param> /// <returns></returns> public async Task <bool> UpdateNotificationByUDPRN(int udprn, string oldAction, string newAction) { using (loggingHelper.RMTraceManager.StartTrace("Integration.UpdateNotificationByUDPRN")) { string method = typeof(ThirdPartyAddressLocationIntegrationService) + "." + nameof(UpdateNotificationByUDPRN); loggingHelper.LogMethodEntry(method, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationIntegrationServiceMethodEntryEventId); string methodName = MethodHelper.GetActualAsyncMethodName(); string serviceUrl = configurationHelper.ReadAppSettingsConfigurationValues(NotificationManagerWebAPIName); string route = configurationHelper.ReadAppSettingsConfigurationValues(methodName); HttpResponseMessage result = await httpHandler.PutAsJsonAsync(string.Format(serviceUrl + route, udprn.ToString(), oldAction), newAction); if (!result.IsSuccessStatusCode) { // LOG ERROR WITH Statuscode var responseContent = result.ReasonPhrase; throw new ServiceException(responseContent); } bool isUpdated = JsonConvert.DeserializeObject <bool>(result.Content.ReadAsStringAsync().Result); loggingHelper.LogMethodExit(method, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationIntegrationServiceMethodExitEventId); return(isUpdated); } }
/// <summary> /// generate Print Map pdf using xsl fo /// </summary> /// <param name="printMapDTO">printMapDTO</param> /// <returns>Pdf file name </returns> public async Task <string> GenerateMapPdfReport(PrintMapDTO printMapDTO) { using (loggingHelper.RMTraceManager.StartTrace("Business.GenerateMapPdfReport")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.MapManagerAPIPriority, LoggerTraceConstants.MapManagerBusinessServiceMethodEntryEventId, LoggerTraceConstants.Title); string pdfFilename = string.Empty; if (printMapDTO != null) { MapConfiguration configuration = new MapConfiguration(); configuration.OutputTo = GetOutputTo(printMapDTO.PdfSize, printMapDTO.PdfOrientation); string caption = printMapDTO.MapTitle; string source = printMapDTO.ImagePath; string timestamp = "Date: " + printMapDTO.PrintTime; // TODO load from resource file string scale = "Scale: " + printMapDTO.CurrentScale; // TODO load from resource file string[] legalNotices = { printMapDTO.License }; XmlDocument mapXml = MapFactory.GetMap(caption, source, timestamp, scale, legalNotices, configuration); //GenerateXml(printMapDTO); pdfFilename = await mapIntegrationService.GenerateReportWithMap(mapXml.InnerXml, xsltFilepath); } loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.MapManagerAPIPriority, LoggerTraceConstants.MapManagerBusinessServiceMethodExitEventId, LoggerTraceConstants.Title); return(pdfFilename); } }
/// <summary> /// Retreive reference data details from /// </summary> /// <param name="categoryName">categoryname</param> /// <param name="itemName">Reference data Name</param> /// <returns>GUID</returns> public async Task <Guid> GetReferenceDataGuId(string categoryName, string itemName) { using (loggingHelper.RMTraceManager.StartTrace("Integration.GetReferenceDataGuId")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteIntegrationServiceMethodEntryEventId, LoggerTraceConstants.Title); Guid referenceId = Guid.Empty; HttpResponseMessage result = await httpHandler.GetAsync(referenceDataWebAPIName + "simpleLists?listName=" + categoryName); if (!result.IsSuccessStatusCode) { var responseContent = result.ReasonPhrase; throw new ServiceException(responseContent); } Tuple <string, SimpleListDTO> apiResult = JsonConvert.DeserializeObject <Tuple <string, SimpleListDTO> >(result.Content.ReadAsStringAsync().Result); if (apiResult != null && apiResult.Item2 != null && apiResult.Item2.ListItems != null && apiResult.Item2.ListItems.Count > 0) { referenceId = apiResult.Item2.ListItems.Where(n => n.Value == itemName).SingleOrDefault().Id; } loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteIntegrationServiceMethodExitEventId, LoggerTraceConstants.Title); return(referenceId); } }
/// <summary> /// Web API call to save postalAddress to PostalAddress table /// </summary> /// <param name="lstAddress">List of mapped address dto to validate each records</param> /// <param name="fileName">File Name</param> /// <returns>If success returns true else returns false</returns> public async Task <bool> SaveNybDetails(List <PostalAddressDTO> lstAddress, string fileName) { using (loggingHelper.RMTraceManager.StartTrace("Service.SaveNybDetails")) { string methodName = MethodHelper.GetActualAsyncMethodName(); LogMethodInfoBlock(methodName, LoggerTraceConstants.MethodExecutionStarted, LoggerTraceConstants.COLON); bool isNybDetailsInserted = false; try { loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NYBPriority, LoggerTraceConstants.NYBLoaderMethodEntryEventId, LoggerTraceConstants.Title); isNybDetailsInserted = true; var result = await httpHandler.PostAsJsonAsync(strFMOWebAPIName + fileName, lstAddress, isBatchJob : true); if (!result.IsSuccessStatusCode) { var responseContent = result.ReasonPhrase; this.loggingHelper.Log(responseContent, TraceEventType.Error); isNybDetailsInserted = false; } } catch (Exception ex) { this.loggingHelper.Log(ex, TraceEventType.Error); isNybDetailsInserted = false; } finally { LogMethodInfoBlock(methodName, LoggerTraceConstants.MethodExecutionCompleted, LoggerTraceConstants.COLON); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NYBPriority, LoggerTraceConstants.NYBLoaderMethodExitEventId, LoggerTraceConstants.Title); } return(isNybDetailsInserted); } }
/// <summary> /// Add new notification to the database /// </summary> /// <param name="notificationDTO">NotificationDTO object</param> /// <returns>Task<int></returns> public async Task<int> AddNewNotification(NotificationDTO notificationDTO) { using (loggingHelper.RMTraceManager.StartTrace("Business.AddNewNotification")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodEntryEventId, LoggerTraceConstants.Title); try { NotificationDataDTO notificationDataDTO = new NotificationDataDTO { ID = notificationDTO.ID, Notification_Heading = notificationDTO.Notification_Heading, Notification_Message = notificationDTO.Notification_Message, NotificationDueDate = notificationDTO.NotificationDueDate, NotificationActionLink = notificationDTO.NotificationActionLink, NotificationSource = notificationDTO.NotificationSource, PostcodeDistrict = notificationDTO.PostcodeDistrict, PostcodeSector = notificationDTO.PostcodeSector, NotificationTypeGUID = notificationDTO.NotificationType_GUID, NotificationPriorityGUID = notificationDTO.NotificationPriority_GUID }; return await notificationDataService.AddNewNotification(notificationDataDTO); } finally { loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodExitEventId, LoggerTraceConstants.Title); } } }
/// <summary> /// Add new address location to database. /// </summary> /// <param name="addressLocationDTO">AddressLocationDTO object</param> /// <returns>Task<int></returns> public async Task <int> SaveNewAddressLocation(AddressLocationDTO addressLocationDTO) { try { using (loggingHelper.RMTraceManager.StartTrace("DataService.SaveNewAddressLocation")) { string method = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(method + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodEntryEventId, LoggerTraceConstants.Title); var addressLocationEntity = new AddressLocation(); GenericMapper.Map(addressLocationDTO, addressLocationEntity); DataContext.AddressLocations.Add(addressLocationEntity); var saveNewAddressLocation = await DataContext.SaveChangesAsync(); loggingHelper.Log(method + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(saveNewAddressLocation); } } catch (DbUpdateException dbUpdateException) { throw new DataAccessException(dbUpdateException, string.Format(ErrorConstants.Err_SqlAddException, string.Concat("Address Location for UDPRN:", addressLocationDTO.UDPRN))); } catch (NotSupportedException notSupportedException) { notSupportedException.Data.Add(ErrorConstants.UserFriendlyErrorMessage, ErrorConstants.Err_Default); throw new InfrastructureException(notSupportedException, ErrorConstants.Err_NotSupportedException); } catch (ObjectDisposedException disposedException) { disposedException.Data.Add(ErrorConstants.UserFriendlyErrorMessage, ErrorConstants.Err_Default); throw new ServiceException(disposedException, ErrorConstants.Err_ObjectDisposedException); } }
/// <summary> /// Save block sequence in database /// </summary> /// <param name="blockSequenceDTO">blockSequenceDTO</param> /// <param name="deliveryRouteId">deliveryRouteId</param> /// <returns>bool</returns> public async Task <bool> AddBlockSequence(BlockSequenceDTO blockSequenceDTO, Guid deliveryRouteId) { bool isBlockSequencInserted = false; try { string methodName = MethodHelper.GetActualAsyncMethodName(); using (loggingHelper.RMTraceManager.StartTrace(methodName)) { loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodEntryEventId, LoggerTraceConstants.Title); var block_Guid = await(from dr in DataContext.DeliveryRouteBlocks.AsNoTracking() join b in DataContext.Blocks.AsNoTracking() on dr.Block_GUID equals b.ID where b.BlockType == UnSequenced && dr.DeliveryRoute_GUID == deliveryRouteId select b.ID).SingleOrDefaultAsync(); BlockSequence blockSequenceEntity = GenericMapper.Map <BlockSequenceDTO, BlockSequence>(blockSequenceDTO); blockSequenceEntity.Block_GUID = block_Guid; DataContext.BlockSequences.Add(blockSequenceEntity); DataContext.SaveChanges(); isBlockSequencInserted = true; loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodExitEventId, LoggerTraceConstants.Title); } } catch (DbUpdateConcurrencyException) { throw new DbConcurrencyException(ErrorConstants.Err_Concurrency); } catch (DbUpdateException dbUpdateException) { throw new DataAccessException(dbUpdateException, string.Format(ErrorConstants.Err_SqlAddException, string.Concat("creating block sequence for selected delivery route"))); } return(isBlockSequencInserted); }
/// <summary> /// Check if a notification exists for a given UDPRN id and action string. /// </summary> /// <param name="uDPRN">UDPRN id</param> /// <param name="action">action string</param> /// <returns>boolean value</returns> public async Task<bool> CheckIfNotificationExists(int uDPRN, string action) { using (loggingHelper.RMTraceManager.StartTrace("Business.CheckIfNotificationExists")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodEntryEventId, LoggerTraceConstants.Title); var checkIfNotificationExists = await notificationDataService.CheckIfNotificationExists(uDPRN, action); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodExitEventId, LoggerTraceConstants.Title); return checkIfNotificationExists; } }
/// <summary> /// SavePAFDetails to save the PAF data by calling the WebApi services. /// </summary> /// <param name="postalAddress"></param> /// <returns></returns> private async Task <bool> SavePAFDetails(List <PostalAddressDTO> postalAddress) { using (loggingHelper.RMTraceManager.StartTrace("Service.SavePAFDetails")) { string methodName = MethodHelper.GetActualAsyncMethodName(); bool isPAFDetailsInserted = false; try { loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PAFPriority, LoggerTraceConstants.PAFReceiverMethodEntryEventId, LoggerTraceConstants.Title); if (postalAddress != null && postalAddress.Count > 0) { postalAddress.ForEach(objPostalAddress => { LogMethodInfoBlock( methodName, string.Format( REQUESTLOG, objPostalAddress.UDPRN == null ? string.Empty : objPostalAddress.UDPRN.ToString(), objPostalAddress.Postcode == null ? string.Empty : objPostalAddress.Postcode.ToString(), objPostalAddress.AmendmentType == null ? string.Empty : objPostalAddress.AmendmentType.ToString(), objPostalAddress.PostTown == null ? string.Empty : objPostalAddress.PostTown.ToString(), objPostalAddress.SmallUserOrganisationIndicator == null ? string.Empty : objPostalAddress.SmallUserOrganisationIndicator.ToString(), objPostalAddress.DeliveryPointSuffix == null ? string.Empty : objPostalAddress.DeliveryPointSuffix )); }); var result = await httpHandler.PostAsJsonAsync(PAFWebApiName, postalAddress, true); if (!result.IsSuccessStatusCode) { //LOG ERROR WITH Statuscode var responseContent = result.ReasonPhrase; this.loggingHelper.Log(responseContent, TraceEventType.Error); isPAFDetailsInserted = false; } isPAFDetailsInserted = true; } } catch (AggregateException ae) { foreach (var exception in ae.InnerExceptions) { loggingHelper.Log(exception, TraceEventType.Error); } var realExceptions = ae.Flatten().InnerException; throw realExceptions; } loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PAFPriority, LoggerTraceConstants.PAFReceiverMethodExitEventId, LoggerTraceConstants.Title); return(isPAFDetailsInserted); } }
/// <summary> /// Find AddressLocation by UDPRN /// </summary> /// <param name="udprn">UDPRN id</param> /// <returns>boolean value</returns> public async Task <bool> AddressLocationExists(int udprn) { using (loggingHelper.RMTraceManager.StartTrace("DataService.AddressLocationExists")) { string method = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(method + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodEntryEventId, LoggerTraceConstants.Title); bool addressLocationExists = await DataContext.AddressLocations.AsNoTracking().Where(n => n.UDPRN == udprn).AnyAsync(); loggingHelper.Log(method + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(addressLocationExists); } }
/// <summary> /// Get AddressLocation by UDPRN /// </summary> /// <param name="udprn"> UDPRN id</param> /// <returns>AddressLocationDTO object</returns> public async Task <AddressLocationDTO> GetAddressLocationByUDPRN(int udprn) { using (loggingHelper.RMTraceManager.StartTrace("DataService.GetAddressLocationByUDPRN")) { string method = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(method + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodEntryEventId, LoggerTraceConstants.Title); var objAddressLocation = await DataContext.AddressLocations.Where(n => n.UDPRN == udprn).SingleOrDefaultAsync(); var getAddressLocationByUDPRN = GenericMapper.Map <AddressLocation, AddressLocationDTO>(objAddressLocation); loggingHelper.Log(method + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(getAddressLocationByUDPRN); } }
/// <summary> /// Gets the user unit information. /// </summary> /// <param name="userName">Name of the user.</param> /// <returns>Guid</returns> public async Task <Guid> GetUserUnitInfo(string userName) { using (loggingHelper.RMTraceManager.StartTrace("DataService.GetUserUnitInfo")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ActionManagerAPIPriority, LoggerTraceConstants.UserRoleUnitDataServiceMethodEntryEventId, LoggerTraceConstants.Title); var userUnit = await(from r in DataContext.UserRoleUnits.AsNoTracking() join u in DataContext.Users on r.User_GUID equals u.ID where u.UserName == userName select r.Unit_GUID).FirstOrDefaultAsync(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.ActionManagerAPIPriority, LoggerTraceConstants.UserRoleUnitDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(userUnit); } }
public async Task <RouteLogSummaryModelDTO> GenerateRouteLog(RouteDTO deliveryRouteDto, Guid userUnit, Guid operationalObjectTypeForDp) { using (loggingHelper.RMTraceManager.StartTrace("DataService.GenerateRouteLog")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodEntryEventId, LoggerTraceConstants.Title); RouteLogSummaryModelDTO routeLogSummary = new RouteLogSummaryModelDTO(); routeLogSummary.RouteLogSequencedPoints = await GetDeliveryRouteSequencedPointsByRouteId(deliveryRouteDto.ID, userUnit, operationalObjectTypeForDp); routeLogSummary.DeliveryRoute = deliveryRouteDto; loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(routeLogSummary); } }
/// <summary> /// Get the postcode sector by the UDPRN id /// </summary> /// <param name="uDPRN">UDPRN id</param> /// <returns>PostCodeSectorDTO object</returns> public async Task <PostCodeSectorDTO> GetPostCodeSectorByUDPRN(int uDPRN) { using (loggingHelper.RMTraceManager.StartTrace("DataService.GetPostCodeSectorByUDPRN")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PostCodePriority, LoggerTraceConstants.PostCodeSectorDataServiceMethodEntryEventId, LoggerTraceConstants.Title); PostalAddress postalAddress = await DataContext.PostalAddresses.AsNoTracking().Where(pa => pa.UDPRN == uDPRN).SingleOrDefaultAsync(); PostcodeSector postCodeSector = postalAddress.Postcode1.PostcodeSector; PostCodeSectorDTO postCodeSectorDTO = new PostCodeSectorDTO(); GenericMapper.Map(postCodeSector, postCodeSectorDTO); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PostCodePriority, LoggerTraceConstants.PostCodeSectorDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(postCodeSectorDTO); } }
/// <summary> /// Check if a notification exists for a given UDPRN id and action string. /// </summary> /// <param name="uDPRN">UDPRN id</param> /// <param name="action">action string</param> /// <returns>boolean value</returns> public async Task <bool> CheckIfNotificationExists(int uDPRN, string action) { using (loggingHelper.RMTraceManager.StartTrace("DataService.CheckIfNotificationExists")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationDataServiceMethodEntryEventId, LoggerTraceConstants.Title); string notificationActionlink = string.Format(USRNOTIFICATIONLINK, uDPRN.ToString()); bool notificationExists = await DataContext.Notifications.AsNoTracking() .AnyAsync(notific => notific.NotificationActionLink.Equals(notificationActionlink) && notific.Notification_Heading.Trim().Equals(action)); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(notificationExists); } }
/// <summary> /// Delete the notification based on the UDPRN and the action /// </summary> /// <param name="uDPRN">UDPRN id</param> /// <param name="action">action string</param> /// <returns>Task<int></returns> public async Task<int> DeleteNotificationbyUDPRNAndAction(int uDPRN, string action) { using (loggingHelper.RMTraceManager.StartTrace("Business.DeleteNotificationbyUDPRNAndAction")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodEntryEventId, LoggerTraceConstants.Title); try { return await notificationDataService.DeleteNotificationbyUDPRNAndAction(uDPRN, action); } finally { loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationBusinessServiceMethodExitEventId, LoggerTraceConstants.Title); } } }
/// <summary> /// Get the notification details based on the UDPRN /// </summary> /// <param name="uDPRN">UDPRN id</param> /// <returns>NotificationDTO object</returns> public async Task <NotificationDTO> GetNotificationByUDPRN(int uDPRN) { using (loggingHelper.RMTraceManager.StartTrace("DataService.GetNotificationByUDPRN")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationDataServiceMethodEntryEventId, LoggerTraceConstants.Title); string actionLink = string.Format(USRNOTIFICATIONLINK, uDPRN); Notification notification = await DataContext.Notifications .Where(notific => notific.NotificationActionLink == actionLink).SingleOrDefaultAsync(); NotificationDTO notificationDTO = new NotificationDTO(); GenericMapper.Map(notification, notificationDTO); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(notificationDTO); } }
/// <summary> /// Get the count of post code /// </summary> /// <param name="searchText">The text to be searched</param> /// <param name="unitGuid">The unit unique identifier.</param> /// <returns> /// The total count of post code /// </returns> public async Task <int> GetPostCodeUnitCount(string searchText, Guid unitGuid) { using (loggingHelper.RMTraceManager.StartTrace("DataService.GetPostCodeUnitCount")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PostCodePriority, LoggerTraceConstants.PostCodeDataServiceMethodEntryEventId, LoggerTraceConstants.Title); searchText = searchText ?? string.Empty; var postCodeDetailsDto = await(from p in DataContext.Postcodes.AsNoTracking() join s in DataContext.PostcodeSectors.AsNoTracking() on p.SectorGUID equals s.ID join u in DataContext.UnitPostcodeSectors.AsNoTracking() on s.ID equals u.PostcodeSector_GUID where p.PostcodeUnit.StartsWith(searchText) && u.Unit_GUID == unitGuid select p).CountAsync(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.PostCodePriority, LoggerTraceConstants.PostCodeDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(postCodeDetailsDto); } }
/// <summary> /// Fetch Delivery route for Basic Search /// </summary> /// <param name="searchText">The text to be searched</param> /// <param name="userUnit">Guid userUnit</param> /// <param name="UnitName">UnitName </param> /// <returns>The result set of delivery route.</returns> public async Task <List <RouteDTO> > FetchDeliveryRouteForBasicSearch(string searchText, Guid userUnit, string UnitName) { using (loggingHelper.RMTraceManager.StartTrace("DataService.FetchDeliveryRouteForBasicSearch")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodEntryEventId, LoggerTraceConstants.Title); int takeCount = Convert.ToInt32(ConfigurationManager.AppSettings[SearchResultCount]); searchText = searchText ?? string.Empty; List <RouteDTO> routedetails = null; if (string.Equals(UserUnit.CollectionUnit.GetDescription(), UnitName.Trim(), StringComparison.OrdinalIgnoreCase)) { routedetails = await DataContext.CollectionRoutes.AsNoTracking() .Where(l => (l.Scenario.Unit_GUID == userUnit) && (l.RouteName.StartsWith(searchText) || l.RouteNumber.StartsWith(searchText))) .Take(takeCount) .Select(l => new RouteDTO { ID = l.ID, RouteName = l.RouteName, RouteNumber = l.RouteNumber }) .ToListAsync(); } else { routedetails = await DataContext.DeliveryRoutes.AsNoTracking() .Where(l => (l.Scenario.Unit_GUID == userUnit) && (l.RouteName.StartsWith(searchText) || l.RouteNumber.StartsWith(searchText))) .Take(takeCount) .Select(l => new RouteDTO { ID = l.ID, RouteName = l.RouteName, RouteNumber = l.RouteNumber }) .ToListAsync(); } loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(routedetails); } }
/// <summary> /// Get the count of delivery route /// </summary> /// <param name="searchText">The text to be searched</param> /// <param name="userUnit">Guid userUnit</param> /// <param name="UnitName">UnitName </param> /// <returns>The total count of delivery route</returns> public async Task <int> GetDeliveryRouteCount(string searchText, Guid userUnit, string UnitName) { using (loggingHelper.RMTraceManager.StartTrace("DataService.GetDeliveryRouteCount")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodEntryEventId, LoggerTraceConstants.Title); try { searchText = searchText ?? string.Empty; int getDeliveryRouteCount = 0;; if (string.Equals(UserUnit.CollectionUnit.GetDescription(), UnitName.Trim(), StringComparison.OrdinalIgnoreCase)) { getDeliveryRouteCount = await DataContext.CollectionRoutes.AsNoTracking() .Where(l => (l.Scenario.Unit_GUID == userUnit) && (l.RouteName.StartsWith(searchText) || l.RouteNumber.StartsWith(searchText))) .CountAsync(); } else { getDeliveryRouteCount = await DataContext.DeliveryRoutes.AsNoTracking() .Where(l => (l.Scenario.Unit_GUID == userUnit) && (l.RouteName.StartsWith(searchText) || l.RouteNumber.StartsWith(searchText))) .CountAsync(); } loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteDataServiceMethodExitEventId, LoggerTraceConstants.Title); return(getDeliveryRouteCount); } catch (InvalidOperationException ex) { ex.Data.Add(ErrorConstants.UserFriendlyErrorMessage, ErrorConstants.Err_Default); throw new SystemException(ErrorConstants.Err_InvalidOperationExceptionForSingleorDefault, ex); } catch (OverflowException overflow) { overflow.Data.Add(ErrorConstants.UserFriendlyErrorMessage, ErrorConstants.Err_Default); throw new SystemException(ErrorConstants.Err_OverflowException, overflow); } } }
public async Task <Guid> GetUnitLocationTypeId(Guid unitId) { using (loggingHelper.RMTraceManager.StartTrace("Integration.GetUnitLocationTypeId")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteIntegrationServiceMethodEntryEventId, LoggerTraceConstants.Title); HttpResponseMessage result = await httpHandler.GetAsync(unitManagerDataWebAPIName + "Unit/" + unitId); if (!result.IsSuccessStatusCode) { var responseContent = result.ReasonPhrase; throw new ServiceException(responseContent); } Guid loactionTypeId = JsonConvert.DeserializeObject <Guid>(result.Content.ReadAsStringAsync().Result); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteIntegrationServiceMethodExitEventId, LoggerTraceConstants.Title); return(loactionTypeId); } }
/// <summary> /// Method to generate pdf /// </summary> /// <param name="xml">xml</param> /// <param name="fileName">fileName</param> /// <returns>byte array</returns> public async Task <string> GenerateReportWithMap(string xml, string fileName) { using (loggingHelper.RMTraceManager.StartTrace("Integration.GenerateReportWithMap")) { string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.MapManagerAPIPriority, LoggerTraceConstants.MapManagerIntegrationServiceMethodEntryEventId, LoggerTraceConstants.Title); HttpResponseMessage result = await httpHandler.PostAsJsonAsync(pdfGeneratorWebAPIName + "PDFReports", xml); if (!result.IsSuccessStatusCode) { // LOG ERROR WITH Statuscode var responseContent = result.ReasonPhrase; throw new ServiceException(responseContent); } loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.MapManagerAPIPriority, LoggerTraceConstants.MapManagerIntegrationServiceMethodEntryEventId, LoggerTraceConstants.Title); return(result.Content.ReadAsStringAsync().Result); } }