public async Task <string> Handle(AddAppProfileCommand request, CancellationToken cancellationToken) { var locationDetails = LocationDetails.Create(string.Empty, string.Empty, string.Empty); var personalDetails = PersonalDetails.Create(request.UserId, request.Email, string.Empty, string.Empty, string.Empty, locationDetails); var instructorDetails = InstructorDetails.Create(null); var appDetails = AppDetails.Create(AccountType.STUDENT, DateTime.UtcNow, DateTime.UtcNow, new List <SubscriptionDetails>(), instructorDetails); var profile = Model.Profile.Create(string.Empty, DateTime.UtcNow, personalDetails, appDetails); var mapper = new Mapper(_mapperConfiguration); var dao = mapper.Map <ProfileDAO>(profile); try { await _db.Profile.InsertOneAsync(dao); } catch (Exception) { return(string.Empty); } return(dao.Id.ToString()); }
public static string SafeDescribeObject(object obj) { if (obj is SPFarm) { return("Farm"); } LocationDetails details = GetLocation(obj); if (!string.IsNullOrEmpty(details.Url)) { if (!string.IsNullOrEmpty(details.Name)) { // have url and name return(string.Format("{0} - {1}", details.Url, details.Name)); } else { // have url return(details.Url); } } else { if (!string.IsNullOrEmpty(details.Name)) { // have name return(details.Name); } else { // have neither url nor name return(details.Id.ToString()); } } }
public static List <LocationDetails> GetProgramDataFolderPath(StudioLocationListItem selectedLocation, List <StudioVersionListItem> studioVersions) { var studioDetails = new List <LocationDetails>(); try { foreach (var studioVersion in studioVersions) { var programDataFolderPath = string.Format(@"C:\ProgramData\SDL\SDL Trados Studio\{0}\Updates", studioVersion.FolderName); var directoryInfo = new DirectoryInfo(programDataFolderPath); var details = new LocationDetails { OriginalFilePath = programDataFolderPath, BackupFilePath = Path.Combine(_backupFolderPath, studioVersion.DisplayName, "ProgramData", directoryInfo.Name), Alias = selectedLocation?.Alias, Version = studioVersion?.DisplayName }; studioDetails.Add(details); } } catch (Exception ex) { Log.Logger.Error($"{Constants.GetProgramDataFolderPath} {ex.Message}\n {ex.StackTrace}"); } return(studioDetails); }
public static List <LocationDetails> GetProjectsFolderPath(string userName, StudioLocationListItem selectedLocation, List <StudioVersionListItem> studioVersions) { var studioDetails = new List <LocationDetails>(); try { foreach (var studioVersion in studioVersions) { var projectsXmlPath = string.Format(@"C:\Users\{0}\Documents\{1}\Projects\projects.xml", userName, studioVersion.DisplayName); var details = new LocationDetails { OriginalFilePath = projectsXmlPath, BackupFilePath = Path.Combine(_backupFolderPath, studioVersion.DisplayName, "Projects", "projects.xml"), Alias = selectedLocation?.Alias, Version = studioVersion?.DisplayName }; studioDetails.Add(details); } } catch (Exception ex) { Log.Logger.Error($"{Constants.GetProjectsFolderPath} {ex.Message}\n {ex.StackTrace}"); } return(studioDetails); }
// display info but don't trigger the aniamtion public void ShowInfoPanel(string title, string opened, LocationDetails details = null) { if (swiping) { return; } titleInfoLabel.text = title; textInfoLabel.text = "Open :\t" + opened + '\n'; if (details != null) { textInfoLabel.text += "Adress : \t" + details.formatted_address + '\n'; textInfoLabel.text += "Phone Number : \t" + details.formatted_phone_number + '\n'; textInfoLabel.text += "Website : \t" + details.website + '\n'; textInfoLabel.text += "Rating : \t" + details.rating + '\n'; } if (!infoPanelEnabled) { infoPanelAnimator.SetTrigger("Open"); } infoPanelEnabled = true; }
async Task HandleSelected(GridCommandEventArgs e) { editItem = await Db.Locations.FindAsync(selectedItems.First().Id); FormMode = FormMode.Edit; editorPanelVisible = true; }
public static List <LocationDetails> GetRoamingProjectApiFolderPath(string userName, StudioLocationListItem selectedLocation, List <StudioVersionListItem> studioVersions) { var studioDetails = new List <LocationDetails>(); var studioInstalledPaths = new Studio()?.GetInstalledStudioVersion(); foreach (var studioVersion in studioVersions) { foreach (var studioPath in studioInstalledPaths) { if (studioPath.Version.Equals(studioVersion.FolderName)) { var projApiFullPath = GetProjectApiFilePath(studioPath.InstallPath); var projApiFolderPath = Path.GetDirectoryName(projApiFullPath); if (!string.IsNullOrEmpty(projApiFolderPath)) { var directoryInfo = new DirectoryInfo(projApiFolderPath); var details = new LocationDetails { OriginalFilePath = projApiFolderPath, BackupFilePath = Path.Combine(_backupFolderPath, studioVersion.DisplayName, "ProjectApi", directoryInfo.Name), Alias = selectedLocation.Alias, Version = studioVersion.DisplayName }; studioDetails.Add(details); } } } } return(studioDetails); }
public static List <LocationDetails> AppDataLocalPaths(string userName, List <MultiTermVersionListItem> multiTermVersions) { var appDataPaths = new List <LocationDetails>(); try { foreach (var multiTermVersion in multiTermVersions) { var appDataFilePath = string.Format(@"C:\Users\{0}\AppData\Local\SDL\SDL MultiTerm\MultiTerm{1}", userName, multiTermVersion.MajorVersionNumber); var directoryInfo = new DirectoryInfo(appDataFilePath); var details = new LocationDetails { OriginalFilePath = appDataFilePath, BackupFilePath = Path.Combine(_backupFolderPath, multiTermVersion.DisplayName, "Local", directoryInfo.Name), Version = multiTermVersion.DisplayName }; appDataPaths.Add(details); } } catch (Exception ex) { Log.Logger.Error($"{Constants.AppDataLocalPaths} {ex.Message}\n {ex.StackTrace}"); } return(appDataPaths); }
public static List <LocationDetails> GetRoamingMajorFullFolderPath(string userName, StudioLocationListItem selectedLocation, List <StudioVersionListItem> studioVersions) { var studioDetails = new List <LocationDetails>(); try { foreach (var studioVersion in studioVersions) { var majorFolderPath = string.Format(@"C:\Users\{0}\AppData\Roaming\SDL\SDL Trados Studio\{1}.0.0.0", userName, studioVersion.MajorVersionNumber); var directoryInfo = new DirectoryInfo(majorFolderPath); var details = new LocationDetails { OriginalFilePath = majorFolderPath, BackupFilePath = Path.Combine(_backupFolderPath, studioVersion.DisplayName, directoryInfo.Name), Alias = selectedLocation?.Alias, Version = studioVersion?.DisplayName }; studioDetails.Add(details); } } catch (Exception ex) { Log.Logger.Error($"{Constants.GetRoamingMajorFullFolderPath} {ex.Message}\n {ex.StackTrace}"); } return(studioDetails); }
public static List <LocationDetails> GetPackageCachePaths(MultiTermLocationListItem selectedLocation, List <MultiTermVersionListItem> multiTermVersions) { var packagePaths = new List <LocationDetails>(); foreach (var multiTermVersion in multiTermVersions) { var versionName = string.Format("SDLMultiTermDesktop{0}", multiTermVersion.ReleaseNumber); var packagePathList = SdlMultiTermDesktop(versionName); if (packagePathList.Any()) { foreach (var packagePath in packagePathList) { var directoryInfo = new DirectoryInfo(packagePath); var details = new LocationDetails { OriginalFilePath = packagePath, BackupFilePath = Path.Combine(_backupFolderPath, multiTermVersion.DisplayName, "PackageCache", directoryInfo.Name), Version = multiTermVersion.DisplayName }; packagePaths.Add(details); } } } return(packagePaths); }
public LocationDetails getLocationDetails(double lat, double lng) { LocationDetails details = new LocationDetails(); try { XElement xelement = XElement.Load(@"https://maps.googleapis.com/maps/api/geocode/xml?latlng=" + lat + "," + lng + "&location_type=ROOFTOP&result_type=street_address&key=AIzaSyBd_nVfEOscouHG6AOssfeK04e3LvTWewo"); var cityName = from seg in xelement.Descendants("address_component") where seg.Element("type").Value.Equals("locality") select seg.Element("long_name").Value; details.city = cityName.ToList()[0].ToString(); var countryName = from seg in xelement.Descendants("address_component") where seg.Element("type").Value.Equals("country") select seg.Element("long_name").Value; details.country = countryName.ToList()[0].ToString(); var regionName = from seg in xelement.Descendants("address_component") where seg.Element("type").Value.Equals("route") select seg.Element("long_name").Value; details.region = regionName.ToList()[0].ToString(); } catch (Exception e) { return(null); } return(details); }
public IHttpActionResult SubmitLocationDetails([FromBody] LocationDetails locationDetails) { string message = string.Empty; TrackingCollection.Instance.LocationDetailSubmit(locationDetails); return(Ok(new { Constants.WebApiStatusOk, data = true })); }
public void CommandTestEdit() { LocationListModel currentLocation = new LocationListModel(1, "Tool Crib"); LocationDetails location = new LocationDetails(currentLocation, new DataRepository()); Assert.IsTrue(location.Edit.CanExecute(null)); }
static IEnumerable <LocationDetails> GetPostcodeData() { // reads the file input from workspace List <LocationDetails> locations = new List <LocationDetails>(); StringReader postcodeReader = new StringReader(DataConverter.PostcodeData.postcodesEnPlaats); string line = null; string pst = ""; Queue <string> values = new Queue <string>(); while ((line = postcodeReader.ReadLine()) != null) { values.Enqueue(line.Split(';')[0]); } //enqueues each postcode while ((values.Count != 0)) { string postcodeCheck = values.Dequeue(); //checks if first 4 numbers of dutch postalcode is not same as the last dequeued version //If not the case then make a call to the Google Geo Api and add the result to the database. //If it is the same then return the last locationdetail of that postcode , because place is the same no need for call to api if (pst != postcodeCheck.Substring(0, 4)) { LocationDetails location = GetLocationDetails(postcodeCheck); GenerateReport(location); if (location.Postcode != null) { locations.Add(location); GenerateReport(location); pst = location.Postcode.Substring(0, 4); } else if (locations.Count() != 0) { pst = locations.LastOrDefault().Postcode; } else { Console.WriteLine("API Quotum Reached"); break; } } // first condition else if (locations.Count() != 0) { LocationDetails location = locations.LastOrDefault(); location.Postcode = postcodeCheck; locations.Add(location); GenerateReport(location); } else { Console.WriteLine("API Quotum Reached"); break; } } return(locations); }
public ActionResult GetLocations(string LocationGroupID) { try { int locGroupID = Convert.ToInt32(LocationGroupID); IEnumerable <REF_LOCATION_X_LOCATION_GROUP_TB> locGroupByLoc = _locationRepo.GetLocationsByLocationGroupID(locGroupID); List <LocationDetails> locDetails = new List <LocationDetails>(); foreach (var row in locGroupByLoc) { LocationDetails item = new LocationDetails() { LocationDescription = row.REF_LOCATION_TB.SZ_LABEL + " - " + row.REF_LOCATION_TB.SZ_DESCRIPTION, LocationGroupID = row.N_LOCATION_GROUP_SYSID.ToString(), LocationID = row.N_LOCATION_SYSID }; locDetails.Add(item); } return(Json(locDetails, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { if (ex.InnerException == null) { ViewBag.Message = "Function: LocationGroupController.GetLocations_GET\n\nError: " + ex.Message; } else { ViewBag.Message = "Function: LocationGroupController.GetLocations_GET\n\nError: " + (ex.Message + "\n\nInnerException: " + ex.InnerException.Message); }; Session["ErrorMessage"] = ViewBag.Message; return(RedirectToAction("InternalServerError", "Error")); }; }
public static List <LocationDetails> ProgramFilesPaths(List <MultiTermVersionListItem> multiTermVersions) { var programFilesPaths = new List <LocationDetails>(); try { foreach (var multiTermVersion in multiTermVersions) { var programFilePath = string.Format(@"C:\Program Files (x86)\SDL\SDL MultiTerm\MultiTerm{0}", multiTermVersion.MajorVersionNumber); var directoryInfo = new DirectoryInfo(programFilePath); var details = new LocationDetails { OriginalFilePath = programFilePath, BackupFilePath = Path.Combine(_backupFolderPath, multiTermVersion.DisplayName, "ProgramFiles", directoryInfo.Name), Version = multiTermVersion.DisplayName }; programFilesPaths.Add(details); } } catch (Exception ex) { Log.Logger.Error($"{Constants.ProgramFilesPaths} {ex.Message}\n {ex.StackTrace}"); } return(programFilesPaths); }
public LocationDetails Execute() { LocationDetails result = null; if (ID != Guid.Empty) { var location = Context.Set <Location>() .Include(e => e.MusicalEvents.Select(l => l.Lineup.Select(p => p.Performers))) .Include("Purchases") .Single(l => l.ID == ID); // If the entity is inactive, and returnIfInactive = false, return nothing if ((!location.IsActive) && (!ReturnIfInactive)) { location = null; } if (location != null) { result = Mapper.Map <LocationDetails>(location); } } return(result); }
private static LocationDetails GetLocation(object obj) { LocationDetails details = new LocationDetails(); if (obj is SPWebApplication) { SPWebApplication webapp = obj as SPWebApplication; details.Url = SafeGetWebAppUrl(webapp); details.Name = SafeGetWebAppTitle(webapp); details.Id = webapp.Id; } else if (obj is SPSite) { SPSite site = obj as SPSite; details.Url = SafeGetSiteUrl(site); details.Name = SafeGetSiteTitle(site); details.Id = site.ID; } else if (obj is SPWeb) { SPWeb web = obj as SPWeb; details.Url = SafeGetWebUrl(web); details.Name = SafeGetWebTitle(web); details.Id = web.ID; } return(details); }
public static List <LocationDetails> GetPackageCachePaths(List <MultiTermVersionListItem> multiTermVersions) { var packagePaths = new List <LocationDetails>(); try { foreach (var multiTermVersion in multiTermVersions) { var versionName = string.Format("SDLMultiTermDesktop{0}", multiTermVersion.ReleaseNumber); var packagePathList = GetMultiTermDesktopPaths(versionName); if (packagePathList.Any()) { foreach (var packagePath in packagePathList) { var directoryInfo = new DirectoryInfo(packagePath); var details = new LocationDetails { OriginalFilePath = packagePath, BackupFilePath = Path.Combine(_backupFolderPath, multiTermVersion.DisplayName, "PackageCache", directoryInfo.Name), Version = multiTermVersion.DisplayName }; packagePaths.Add(details); } } } } catch (Exception ex) { Log.Logger.Error($"{Constants.GetPackageCachePaths} {ex.Message}\n {ex.StackTrace}"); } return(packagePaths); }
static LocationDetails GetLocationDetails(String postcode) { LocationDetails locationDetails = new LocationDetails(); GoogleSigned.AssignAllServices(new GoogleSigned("APIKEY")); // APIKEY van Google hier zetten var request = new GeocodingRequest(); request.Address = postcode; { var response = new GeocodingService().GetResponse(request); if (response.Status == ServiceResponseStatus.OverQueryLimit) { WriteLine("API Quotum Reached"); } if (response.Status == ServiceResponseStatus.Ok && response.Results.Count() > 0) { var result = response.Results.First(); if (result.AddressComponents.Length > 2) { locationDetails = new LocationDetails( result.AddressComponents[0].ShortName, result.AddressComponents[1].LongName, result.AddressComponents[2].LongName, result.Geometry.Location.Longitude, result.Geometry.Location.Latitude, result.PlaceId); Console.WriteLine("Postcode: " + result.AddressComponents[0].LongName + "plaats: " + result.AddressComponents[1].LongName + "regio: " + result.AddressComponents[2].LongName + "," + result.Geometry.Location.Longitude + ", " + result.Geometry.Location.Latitude, result.PlaceId); } else { locationDetails = new LocationDetails( result.AddressComponents[0].ShortName, result.AddressComponents[1].LongName, "", result.Geometry.Location.Longitude, result.Geometry.Location.Latitude, result.PlaceId); Console.WriteLine("Postcode: " + result.AddressComponents[0].LongName + "plaats: " + result.AddressComponents[1].LongName + "," + result.Geometry.Location.Longitude + ", " + result.Geometry.Location.Latitude, result.PlaceId); } } else { Console.WriteLine("Unable to geocode. Status={0} and ErrorMessage={1}", response.Status, response.ErrorMessage); } return(locationDetails); } }
public bool Update(LocationDetails ld, out string error) { string sqlPostalCode = "UPDATE Tbl_Locations SET Loc_Location = @location WHERE Loc_PostalCode = @postalcode"; sql.SetCommand(sqlPostalCode); sql.AddStringParameter("location", 20, ld.Location); sql.AddIntParamter("postalcode", ld.PostalCode); return(sql.Execute(out error)); }
public void LocationDetailsTest() { LocationListModel currentLocation = new LocationListModel(1, "Tool Crib"); LocationDetails location = new LocationDetails(currentLocation, new DataRepository()); Assert.IsNotNull(location.CurrentLocation.Availability); Assert.IsNotNull(location.CurrentLocation.Id); Assert.IsNotNull(location.CurrentLocation.Name); Assert.IsNotNull(location.CurrentLocation.CostRate); }
public DatabaseLocation(LocationDetails locationDetails) { LocationId = locationDetails.LocationId; UserId = locationDetails.UserId; LocationName = locationDetails.LocationName; AddressLine = locationDetails.AddressLine; City = locationDetails.City; State = locationDetails.State; Zip = locationDetails.Zip; }
async Task HandleSelected(GridCommandEventArgs e) { /// Find the location to edit locationEditItem = await Db.Locations.FindAsync(selectedItems.First().LocationId); /// Get Port node editItem = locationEditItem.Ports.Find(p => p.Id == selectedItems.First().Id); FormMode = FormMode.Edit; editorPanelVisible = true; }
public IActionResult SearchRestaurantBasedOnDistance([FromBody] LocationDetails locationDetails) { IQueryable <RestaurantInformation> restaurantDetails; restaurantDetails = business_Repo.SearchRestaurantByLocation(locationDetails); if (restaurantDetails != null) { return(this.Ok(restaurantDetails)); } return(this.StatusCode((int)HttpStatusCode.InternalServerError, string.Empty)); }
/// <summary> /// Add location details for bulk insertion /// </summary> /// <param name="locationDetails">Object of location details.</param> public void LocationDetailSubmit(LocationDetails locationDetails) { if (!this.isDumping) { this.activeStorage.Add(locationDetails); } else { this.passiveStorage.Add(locationDetails); } }
public void UpdateCachedUserLocation(Guid userId, LocationDetails location) { if (UserCache.ContainsKey(userId)) { var user = UserCache[userId]; if (ShouldUpdateLocation(user, location)) { user.Location = location; } } }
public void createNewLocationTest() { Mock <IDatabaseQueryService> mockDBService = new Mock <IDatabaseQueryService>(MockBehavior.Strict); mockDBService.Setup(x => x.PersistNewLocation(It.IsAny <DatabaseLocation>())).Returns(true); LocationService locationService = new LocationService(mockDBService.Object); LocationDetails locationDetails = new LocationDetails(); locationService.SaveLocation(locationDetails); mockDBService.Verify(m => m.PersistNewLocation(It.IsAny <DatabaseLocation>()), Times.AtLeastOnce()); }
public async Task OnMessageAsync(UserCurrentLocationChangedEvent obj) { try { LocationDetails location = _mapper.Map <LocationDetails>(obj.Location); _membershipService.UpdateCachedUserLocation(obj.User.UserId, location); } catch (Exception ex) { _logger.LogError(ex, "Failed to update user location"); // Sink. } }
public void deleteLocation() { Mock <IDatabaseQueryService> mockDBService = new Mock <IDatabaseQueryService>(MockBehavior.Strict); mockDBService.Setup(x => x.DeleteLocation(1)).Returns(true); mockDBService.Setup(x => x.DeleteRoomsAtLocation(1)).Returns(true); LocationService locationService = new LocationService(mockDBService.Object); LocationDetails locationDetails = new LocationDetails(); locationService.DeleteLocation(1); mockDBService.Verify(m => m.DeleteLocation(It.IsAny <int>()), Times.AtLeastOnce()); }
private static LocationDetails GetLocation(object obj) { LocationDetails details = new LocationDetails(); if (obj is SPWebApplication) { SPWebApplication webapp = obj as SPWebApplication; details.Url = SafeGetWebAppUrl(webapp); details.Name = SafeGetWebAppTitle(webapp); details.Id = webapp.Id; } else if (obj is SPSite) { SPSite site = obj as SPSite; details.Url = SafeGetSiteUrl(site); details.Name = SafeGetSiteTitle(site); details.Id = site.ID; } else if (obj is SPWeb) { SPWeb web = obj as SPWeb; details.Url = SafeGetWebUrl(web); details.Name = SafeGetWebTitle(web); details.Id = web.ID; } return details; }