/// <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> /// Gets the delivery route details for Pdf Generation. /// </summary> /// <param name="routeId">The delivery route identifier.</param> /// <param name="unitGuid">The unit unique identifier.</param> /// <returns>DeliveryRouteDTO</returns> public async Task <RouteDTO> GetRouteSummary(Guid routeId) { if (routeId == Guid.Empty) { throw new ArgumentNullException(nameof(routeId)); } using (loggingHelper.RMTraceManager.StartTrace("Business.GetDeliveryRouteDetailsforPdfGeneration")) { string methodName = typeof(DeliveryRouteBusinessService) + "." + nameof(GetRouteSummary); loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodEntryEventId); List <string> categoryNames = new List <string> { ReferenceDataCategoryNames.DeliveryPointUseIndicator, ReferenceDataCategoryNames.OperationalObjectType, ReferenceDataCategoryNames.DeliveryRouteMethodType, ReferenceDataCategoryNames.RouteActivityType }; var referenceDataCategoryList = deliveryRouteIntegrationService.GetReferenceDataSimpleLists(categoryNames).Result; var routeDetails = await deliveryRouteDataService.GetRouteSummary(routeId, referenceDataCategoryList); RouteDTO route = GenericMapper.Map <RouteDataDTO, RouteDTO>(routeDetails); loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodExitEventId); return(route); } }
/// <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); }
//takes UserRoleChoiceEnum as input and returns the appropriate user details public List <UserModel> GetUserDetails(UserRoleChoiceEnum role) { List <Models.UserModel> users = null; using (UserDbContext ctx = new UserDbContext()) { switch (role) { case UserRoleChoiceEnum.Student: users = ctx.Users.Where(user => user.IsStudent).ToList(); break; case UserRoleChoiceEnum.Other: users = ctx.Users.Where(user => !user.IsStudent).ToList(); break; case UserRoleChoiceEnum.All: users = ctx.Users.ToList(); break; } } return(users.ConvertAll(user => { UserModel userModel = new UserModel(); GenericMapper.Map(user, userModel); return userModel; })); }
private void componentCbx_SelectedIndexChanged(object sender, EventArgs e) { VisualComponentItem item = componentCbx.SelectedItem as VisualComponentItem; if (item.Instance == null) { item.Instance = Activator.CreateInstance(item.Type) as UXComponent; item.Instance.Name = ViewHelper.GetDefaultComponentName(ComponentNames, item.Type); object[] attributes = item.Type.GetCustomAttributes(typeof(VisualDesignerAttribute), false); if (attributes != null) { GenericMapper.Map((VisualDesignerAttribute)attributes[0], item.Instance); } } if (UXComponent != null) { GenericMapper.Map(UXComponent, item.Instance); } if (item.Instance is UXServiceComponent && (serviceMethod != null || componentMap != null)) { ((UXServiceComponent)item.Instance).ServiceMethod = serviceMethod; ((UXServiceComponent)item.Instance).ComponentMap = componentMap; } UXComponent = item.Instance; propertyGrid.SelectedObject = UXComponent; EnableDisableButtons(); }
public async Task <PostCodeDTO> GetSelectedPostcode(Guid postcodeGuid, Guid unitGuid) { var result = await(from pc in DataContext.Postcodes.AsNoTracking() join ul in DataContext.UnitLocationPostcodes.AsNoTracking() on pc.ID equals ul.PoscodeUnit_GUID where pc.ID == postcodeGuid && ul.Unit_GUID == unitGuid select pc).SingleOrDefaultAsync(); return(GenericMapper.Map <Postcode, PostCodeDTO>(result)); }
/// <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> /// 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) { string methodName = typeof(UnitLocationBusinessService) + "." + nameof(GetPostcodeSectorByUdprn); using (loggingHelper.RMTraceManager.StartTrace("Business.GetPostCodeSectorByUdprn")) { loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerBusinessServiceMethodEntryEventId); var postCodeSector = await postcodeSectorDataService.GetPostcodeSectorByUdprn(udprn); PostcodeSectorDTO postCodeSectorDto = GenericMapper.Map <PostcodeSectorDataDTO, PostcodeSectorDTO>(postCodeSector); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.UnitManagerAPIPriority, LoggerTraceConstants.UnitManagerBusinessServiceMethodExitEventId, LoggerTraceConstants.Title); return(postCodeSectorDto); } }
/// <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> /// 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 route details mapped to delivery point /// </summary> /// <param name="deliveryPointId">Delivery Point Id</param> /// <returns>Route Details</returns> public async Task <RouteDTO> GetRouteByDeliveryPoint(Guid deliveryPointId) { if (deliveryPointId == Guid.Empty) { throw new ArgumentNullException(nameof(deliveryPointId)); } using (loggingHelper.RMTraceManager.StartTrace("Business.GetRouteByDeliverypoint")) { string methodName = typeof(DeliveryRouteBusinessService) + "." + nameof(GetRouteByDeliveryPoint); loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodEntryEventId); var route = GenericMapper.Map <RouteDataDTO, RouteDTO>(await deliveryRouteDataService.GetRouteByDeliverypoint(deliveryPointId)); loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.DeliveryRouteAPIPriority, LoggerTraceConstants.DeliveryRouteBusinessServiceMethodExitEventId); return(route); } }
/// <summary> /// Log exception if the PAF and NYB record insertion fails /// </summary> /// <param name="fileProcessingLogDTO"> /// Expects DTO object to save exception while saving records in DB /// </param> public void LogFileException(FileProcessingLogDTO fileProcessingLogDTO) { try { using (loggingHelper.RMTraceManager.StartTrace("DataService.LogFileException")) { string methodName = MethodBase.GetCurrentMethod().Name; //loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.FileProcessingLogPriority, LoggerTraceConstants.FileProcessingLogPriorityDataServiceMethodEntryEventId, LoggerTraceConstants.Title); var entity = GenericMapper.Map <FileProcessingLogDTO, FileProcessingLog>(fileProcessingLogDTO); DataContext.FileProcessingLogs.Add(entity); DataContext.SaveChanges(); //loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.FileProcessingLogPriority, LoggerTraceConstants.FileProcessingLogPriorityDataServiceMethodExitEventId, LoggerTraceConstants.Title); } } catch (Exception ex) { this.loggingHelper.Log(ex, TraceEventType.Error); } }
/// <summary> /// This method fetches role based functions for the current user /// </summary> /// <param name="userUnitInfo">user unit information</param> /// <returns>functions available for current user</returns> public async Task <List <RoleAccessDTO> > GetRoleBasedAccessFunctions(UserUnitInfoDTO userUnitInfo) { string methodName = typeof(ActionManagerBusinessService) + "." + nameof(GetRoleBasedAccessFunctions); using (loggingHelper.RMTraceManager.StartTrace("BusinessService.GetRoleBasedAccessFunctions")) { loggingHelper.LogMethodEntry(methodName, priority, entryEventId); // mapping public DTO to dataDTO UserUnitInfoDataDTO userUnitInfoDataDTO = GenericMapper.Map <UserUnitInfoDTO, UserUnitInfoDataDTO>(userUnitInfo); var roleAccessDataDto = await actionManagerDataService.GetRoleBasedAccessFunctions(userUnitInfoDataDTO); loggingHelper.LogMethodExit(methodName, priority, exitEventId); // mapping dataDTO to public DTO List <RoleAccessDTO> roleAccessDTO = GenericMapper.MapList <RoleAccessDataDTO, RoleAccessDTO>(roleAccessDataDto); return(roleAccessDTO); } }
/// <summary> /// Log exception if the PAF and NYB record insertion fails /// </summary> /// <param name="fileProcessingLogDTO"> /// Expects DTO object to save exception while saving records in DB /// </param> public void LogFileException(FileProcessingLogDTO fileProcessingLogDTO) { try { using (loggingHelper.RMTraceManager.StartTrace("BusinessService.SavePostalAddressForNYB")) { string methodName = typeof(FileProcessingLogDataService) + "." + nameof(LogFileException); loggingHelper.LogMethodEntry(methodName, priority, entryEventId); var entity = GenericMapper.Map <FileProcessingLogDTO, FileProcessingLog>(fileProcessingLogDTO); DataContext.FileProcessingLogs.Add(entity); DataContext.SaveChanges(); loggingHelper.LogMethodExit(methodName, priority, exitEventId); } } catch (Exception ex) { this.loggingHelper.Log(ex, TraceEventType.Error); } }
/// <summary> /// This method fetches Unit information for which user has access /// </summary> /// <param name="userName">username</param> /// <param name="locationId">unit id</param> /// <returns>unit details</returns> public async Task <UserUnitInfoDTO> GetUserUnitInfo(string userName, Guid locationId) { string methodName = typeof(ActionManagerBusinessService) + "." + nameof(GetUserUnitInfo); using (loggingHelper.RMTraceManager.StartTrace("BusinessService.GetUserUnitInfo")) { loggingHelper.LogMethodEntry(methodName, priority, entryEventId); var userUnitDetails = await actionManagerDataService.GetUserUnitInfo(userName, locationId); // Get the Unit details from reference data if current user has access to the units above mail center if (userUnitDetails == null) { userUnitDetails = await actionManagerDataService.GetUserUnitInfoFromReferenceData(userName, locationId); } // mapping dataDTO to public DTO UserUnitInfoDTO userUnitInfoDTO = GenericMapper.Map <UserUnitInfoDataDTO, UserUnitInfoDTO>(userUnitDetails); loggingHelper.LogMethodExit(methodName, priority, exitEventId); return(userUnitInfoDTO); } }
//registers the user in the database public bool Register(RegistrationModel registrationModel) { if (UserExists(registrationModel.Email)) { return(false); } Models.UserModel userModel = new Models.UserModel(); GenericMapper.Map(registrationModel, userModel); using (UserDbContext ctx = new UserDbContext()) { userModel.UserID = ctx.Users.Max(user => user.UserID) + 10; //generates new UserID ctx.Users.Add(userModel); try { ctx.SaveChanges(); return(true); } catch { return(false); } } }
/// <summary> /// Add new address location to database. /// </summary> /// <param name="addressLocationDTO">AddressLocationDTO object</param> /// <returns>Task<int></returns> public async Task <int> SaveNewAddressLocation(AddressLocationDataDTO addressLocationDTO) { try { using (loggingHelper.RMTraceManager.StartTrace("DataService.SaveNewAddressLocation")) { string methodName = typeof(AddressLocationDataService) + "." + nameof(SaveNewAddressLocation); loggingHelper.LogMethodEntry(methodName, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodEntryEventId); var addressLocationEntity = new AddressLocation(); Mapper.Initialize(cfg => cfg.CreateMap <AddressLocationDataDTO, AddressLocation>()); addressLocationEntity = Mapper.Map <AddressLocationDataDTO, AddressLocation>(addressLocationDTO); GenericMapper.Map(addressLocationDTO, addressLocationEntity); DataContext.AddressLocations.Add(addressLocationEntity); var saveNewAddressLocation = await DataContext.SaveChangesAsync(); loggingHelper.LogMethodExit(methodName, LoggerTraceConstants.ThirdPartyAddressLocationAPIPriority, LoggerTraceConstants.ThirdPartyAddressLocationDataServiceMethodExitEventId); 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> /// 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("DataService.AddNewNotification")) { int saveChangesAsync = default(int); string methodName = MethodHelper.GetActualAsyncMethodName(); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionStarted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationDataServiceMethodEntryEventId, LoggerTraceConstants.Title); try { Notification newNotification = new Notification(); GenericMapper.Map(notificationDTO, newNotification); DataContext.Notifications.Add(newNotification); loggingHelper.Log(methodName + LoggerTraceConstants.COLON + LoggerTraceConstants.MethodExecutionCompleted, TraceEventType.Verbose, null, LoggerTraceConstants.Category, LoggerTraceConstants.NotificationAPIPriority, LoggerTraceConstants.NotificationDataServiceMethodExitEventId, LoggerTraceConstants.Title); saveChangesAsync = await DataContext.SaveChangesAsync(); } catch (DbUpdateException dbUpdateException) { loggingHelper.Log(dbUpdateException, TraceEventType.Error); throw new DataAccessException(dbUpdateException, string.Format(ErrorConstants.Err_SqlAddException, string.Concat("notification for:", notificationDTO.NotificationActionLink))); } catch (NotSupportedException notSupportedException) { loggingHelper.Log(notSupportedException, TraceEventType.Error); notSupportedException.Data.Add(ErrorConstants.UserFriendlyErrorMessage, ErrorConstants.Err_Default); throw new InfrastructureException(notSupportedException, ErrorConstants.Err_NotSupportedException); } catch (ObjectDisposedException disposedException) { loggingHelper.Log(disposedException, TraceEventType.Error); disposedException.Data.Add(ErrorConstants.UserFriendlyErrorMessage, ErrorConstants.Err_Default); throw new ServiceException(disposedException, ErrorConstants.Err_ObjectDisposedException); } return(saveChangesAsync); } }
public UnitLocationDTO FetchUnitDetails(Guid unitGuid) { UnitLocation location = DataContext.UnitLocations.AsNoTracking().Where(x => x.ID == unitGuid).SingleOrDefault(); return(GenericMapper.Map <UnitLocation, UnitLocationDTO>(location)); }
/// <summary> /// Fetch the delivery unit. /// </summary> /// <param name="unitId">The unit identifier.</param> /// <returns> /// The <see cref="UnitLocationDTO"/>. /// </returns> public UnitLocationDTO FetchDeliveryUnit(Guid unitId) { var result = DataContext.UnitLocations.SingleOrDefault(x => x.ID == unitId && x.UnitBoundryPolygon != null); return(GenericMapper.Map <UnitLocation, UnitLocationDTO>(result)); }
public ReferenceDataDTO GetReferenceDataId(string strDataDesc, string strDisplayText) { ReferenceData referenceData = DataContext.ReferenceDatas.Where(refData => refData.DataDescription.Equals(strDataDesc) && refData.ReferenceDataValue.Equals(strDisplayText)).FirstOrDefault(); return(GenericMapper.Map <ReferenceData, ReferenceDataDTO>(referenceData)); }