예제 #1
0
        public GetLowStockLevelResponse GetLowStockLevel(GetLowStockLevelRequest request)
        {
            System.Threading.Thread.Sleep(1000);
            List <Models.StockLevelItem> output = new List <Models.StockLevelItem>();

            LocationsController    locationController = new LocationsController();
            List <Models.Location> locations          = (List <Models.Location>)locationController.GetLocations();

            Models.Location location = locations.Find(s => s.LocationId == request.LocationId);
            for (int i = 0; i < request.EntriesPerPage; i++)
            {
                int newProductSuffix = (i + (request.EntriesPerPage * (request.PageNumber - 1)));
                output.Add(new Models.StockLevelItem()
                {
                    Due          = i,
                    OnOrder      = i,
                    Location     = location.LocationName,
                    ProductTitle = "Product title " + newProductSuffix.ToString(),
                    SKU          = "SKU00" + newProductSuffix.ToString(),
                    StockLevel   = i
                });
            }
            return(new GetLowStockLevelResponse()
            {
                TotalItems = 762,
                rows = output
            });
        }
예제 #2
0
        public async Task <Response> getLocatorData()
        {
            Models.Location loc = new Models.Location();
            try
            {
                var request  = new GeolocationRequest(GeolocationAccuracy.Medium);
                var location = await Geolocation.GetLocationAsync(request);

                if (location != null)
                {
                    return(new Response
                    {
                        IsSucess = true,
                        Result = location
                    });
                }
                return(new Response
                {
                    IsSucess = false,
                    Message = $"Location is null"
                });
            }
            catch (FeatureNotSupportedException fnsEx)
            {
                // Handle not supported on device exception
                return(new Response
                {
                    IsSucess = false,
                    Message = $"El dispositivo no es compatible para conocer la ubicación - {fnsEx.Message}"
                });
            }
            catch (FeatureNotEnabledException fneEx)
            {
                // Handle not enabled on device exception
                return(new Response
                {
                    IsSucess = false,
                    Message = $"Ubicación no habilitada - {fneEx.Message}"
                });
            }
            catch (PermissionException pEx)
            {
                // Handle permission exception
                return(new Response
                {
                    IsSucess = false,
                    Message = $"No se tienen los permisos necesarios - {pEx.Message}"
                });
            }
            catch (Exception ex)
            {
                // Unable to get location
                return(new Response
                {
                    IsSucess = false,
                    Message = $"No se pudo obtener la ubicación - {ex.Message}"
                });
            }
        }
예제 #3
0
 /// <summary>
 /// Function to post location to server
 /// </summary>
 /// <param name="location">Location Object</param>
 ///
 public void Send_Locaiton_ServerAsync(Models.Location location)
 {
     PostLocationAsync(location);
     if (!success)
     {
         //throw new CantConnectToLocationServerException();
     }
 }
예제 #4
0
 public LocationDetailsViewModel(Models.Location location, Factory repositoryFactory)
 {
     this.Id          = location.Id;
     this.Name        = location.Name;
     this.Description = location.Description;
     this.Ratings     = GetRatingList(repositoryFactory);
     this.Reviews     = GetReviewsList(repositoryFactory);
 }
 public void Persist(RepositoryFactory repositoryFactory)
 {
     Models.Location location = new Models.Location
     {
         Name        = this.Name,
         Description = this.Description
     };
     repositoryFactory.GetLocationRepository().Save(location);
 }
예제 #6
0
        /* private List<string> GetReviewsList(Factory repositoryFactory)
         *     {
         *         return repositoryFactory.GetRateReviewRepository()
         *             .GetModels()
         *             .Where(r=> r.LocationId == Id)
         *             .Select(r=>r.Review).ToList();
         *     }
         *
         * private string  GetAverageRating(Factory repositoryFactory)
         * {
         *    if (Rating == null  )
         *    {
         *        return "No Ratings";
         *    }
         *    else
         *    {
         *
         *
         *        return repositoryFactory.GetRateReviewRepository()
         *            .GetModels()
         *            .Where(r => r.LocationId == Id)
         *            .Select(r => r.Rating).Average().ToString();
         *    }
         *
         * }*/


        public LocationListViewModel(Models.Location location, Factory repositoryFactory)
        {
            this.Id            = location.Id;
            this.Name          = location.Name;
            this.Description   = location.Description;
            this.AverageRating = Rating.Average().ToString();

            this.Review = Review; //GetReviewsList(repositoryFactory);
        }
예제 #7
0
        private static List <MySqlParameter> PopulateParameters(Models.Location location)
        {
            List <MySqlParameter> Params = new List <MySqlParameter>
            {
                new MySqlParameter
                {
                    Direction     = ParameterDirection.Input,
                    Value         = location.StreetNumber,
                    ParameterName = "@StreetNum"
                },
                new MySqlParameter
                {
                    Direction     = ParameterDirection.Input,
                    Value         = location.StreetName,
                    ParameterName = "@StreetName"
                },
                new MySqlParameter
                {
                    Direction     = ParameterDirection.Input,
                    Value         = location.City,
                    ParameterName = "@City"
                },
                new MySqlParameter
                {
                    Direction     = ParameterDirection.Input,
                    Value         = location.State,
                    ParameterName = "@State"
                },
                new MySqlParameter
                {
                    Direction     = ParameterDirection.Input,
                    Value         = location.ZipCode,
                    ParameterName = "@ZipCode"
                },
                new MySqlParameter
                {
                    Direction     = ParameterDirection.Input,
                    Value         = location.FullAddress,
                    ParameterName = "@FullAddress"
                },
                new MySqlParameter
                {
                    Direction     = ParameterDirection.Input,
                    Value         = location.LocationDescription,
                    ParameterName = "@LocationDescription"
                },
                new MySqlParameter
                {
                    Direction     = ParameterDirection.Input,
                    Value         = location.InsertTimeStamp,
                    ParameterName = "@InsertTimeStamp"
                }
            };

            return(Params);
        }
예제 #8
0
 public Entities.Location ParseLocation(Models.Location location)
 {
     return(new Entities.Location()
     {
         State = location.State,
         City = location.City,
         Street = location.Street,
         Id = location.Id
     });
 }
 public void Persist(Factory repositoryFactory)
 {
     Models.Location location = new Models.Location
     {
         Name        = this.Name,
         Description = this.Description,
         Address     = this.Address,
         Region      = this.Region,
     };
     repositoryFactory.GetLocationRepository().Save(location);
 }
예제 #10
0
 internal void UpdatePosition(Geoposition pos)
 {
     Location = new Models.Location((float)pos.Coordinate.Point.Position.Latitude, (float)pos.Coordinate.Point.Position.Longitude);
     foreach (var item in LocationList)
     {
         var t = ThreadPool.RunAsync(async(wior) =>
         {
             await item.GetLocation(pos.Coordinate.Point.Position.Latitude, pos.Coordinate.Point.Position.Longitude);
         });
     }
 }
예제 #11
0
        public async Task OnGetAsync(int?id)
        {
            //UserProfile = await _userProfileService.OnGetAsync();
            Zones = await _locationService.ReadListAsync(LocationGroup.Zone);

            Places = await _locationService.ReadListAsync(LocationGroup.Place);

            Dungeons = await _locationService.ReadListAsync(LocationGroup.Dungeon);

            IsSpecific = id.HasValue;
            Selection  = await _locationService.ReadAsync(id);
        }
예제 #12
0
 public void UpdateLocation(Models.Location l)
 {
     Domain.Location loc = new();
     loc.ID   = l.ID;
     loc.Name = l.Name;
     foreach (var ip in l.Inventory)
     {
         Domain.Product p = new(ip.ID, ip.Name, ip.Price);
         loc.SetProductAmount(p, ip.Amount);
     }
     _repo.UpdateLocation(loc);
 }
예제 #13
0
        /// <summary>
        /// Converts the given value from alternative representation to original one.
        /// </summary>
        /// <param name="value">Value in its alternative representation.</param>
        /// <returns>Value in its original representation.</returns>
        public override object ConvertBack(object value)
        {
            object ret = null;
            SqlGeography g = null;

            if (value != null && value is SqlGeography)
            {
                g = value as SqlGeography;
                ret = new Models.Location() { Latitude = g.Lat.Value, Longitude = g.Long.Value };
            }

            return ret;
        }
 public ActionResult PlaceOrder(Models.Location loc)
 {
     try
     {
         TempData["LocationID"] = loc.id;
         TempData.Keep();
         return(RedirectToRoute(new { controller = "Pizza", action = "Create" }));
     }
     catch
     {
         return(View());
     }
 }
예제 #15
0
        public async Task Edit([FromBody] Models.Location obj)
        {
            var bll_l = locationBusiness;
            var user  = HttpContext.Items["EndUser"] as EF.EndUser;

            obj.CommunityId = user.Member.CommunityId;

            var o = this.mapper.Map <EF.Location>(obj);

            o.DateTimeModified = DateTime.Now;
            o.ModifiedBy       = user.Member.Name;

            await bll_l.Edit(o);
        }
예제 #16
0
        public virtual CustomActionResult CanDelete(Models.Location entity)
        {
            if (HasChildren(entity.Id))
            {
                return(Exceptions.getCanNotDeleteException("Location-03"));
            }
            var empcnt = this.context.EmployeeLocations.Where(q => q.LocationId == entity.Id).Count();

            if (empcnt > 0)
            {
                return(Exceptions.getCanNotDeleteException("Location-04"));
            }
            return(new CustomActionResult(HttpStatusCode.OK, ""));
        }
예제 #17
0
        /// <summary>
        /// Function to send user locaton to server
        /// </summary>
        /// <param name="location">Location Object</param>
        ///
        protected async void PostLocationAsync(Models.Location location)
        {
            if (App.Current.Properties.ContainsKey("TOKEN"))
            {
                const string url = Secrets.baseEndpoint + Secrets.geolocationEndpoint;

                HttpClientHandler clientHandler = new HttpClientHandler();
                clientHandler.ServerCertificateCustomValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return(true); };
                try
                {
                    using (HttpClient client = new HttpClient(clientHandler))
                    {
                        client.Timeout = TimeSpan.FromSeconds(30);

                        Token token = new Token();
                        token.access_token = (string)Application.Current.Properties["TOKEN"];

                        token.Object_To_Server = JsonConvert.SerializeObject(location);
                        var data = JsonConvert.SerializeObject(token);

                        var StringConent = new StringContent(data, Encoding.UTF8, "application/json");
                        StringConent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
                        HttpResponseMessage response;

                        try
                        {
                            response = await client.PostAsync(url, StringConent);
                        }
                        catch (Exception e) when(e is TaskCanceledException || e is OperationCanceledException || e is HttpRequestException)
                        {
                            throw new CantConnectToLocationServerException();
                        }

                        if (!response.IsSuccessStatusCode)
                        {
                            throw new CantConnectToLocationServerException();
                        }
                        string result = response.Content.ReadAsStringAsync().Result;

                        //await DisplayAlert("Attention", "Enabled: " + result, "OK");
                        success = true;
                    }
                }
                catch (Exception e) when(e is CantConnectToLocationServerException)
                {
                    //TODO:
                    // retry logic for sending to the server
                }
            }
        }
예제 #18
0
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Maps.MapControl.WPF.Location pinlocation = Map.Center;

            Models.Location location = new Models.Location
            {
                Longitude = pinlocation.Longitude,
                Latitude  = pinlocation.Latitude,
                Name      = "Без Имени"
            };
            (DataContext as LocationViewModel).AddCommand.Execute(location);
            Update();
            SelectedPin = null;
        }
        public async Task TestConcurrencyAsync()
        {
            var openWeatherMapCache = new OpenWeatherMapCache(apiKey, 10_000);
            int totalFromCache      = 0;
            int totalFromAPI        = 0;

            var result = Parallel.For(1, 101, async(i, state) =>
            {
                var location = new Models.Location(48.6371, -122.1237);
                var readings = await openWeatherMapCache.GetReadingsAsync(location);
                if (readings.IsFromCache)
                {
                    Interlocked.Increment(ref totalFromCache);
                }
                else
                {
                    Interlocked.Increment(ref totalFromAPI);
                }
            });

            while (totalFromCache + totalFromAPI < 100)
            {
            }

            Assert.Equal(99, totalFromCache);
            Assert.Equal(1, totalFromAPI);

            await Task.Delay(10_001);

            result = Parallel.For(1, 101, async(i, state) =>
            {
                var location = new Models.Location(1, 1);
                var readings = await openWeatherMapCache.GetReadingsAsync(location);
                if (readings.IsFromCache)
                {
                    Interlocked.Increment(ref totalFromCache);
                }
                else
                {
                    Interlocked.Increment(ref totalFromAPI);
                }
            });

            while (totalFromCache + totalFromAPI < 200)
            {
            }

            Assert.Equal(198, totalFromCache);
            Assert.Equal(2, totalFromAPI);
        }
예제 #20
0
        public static void InitializeInsertLocation(JsonLocation jsonLocation)
        {
            Models.Location location = new Models.Location()
            {
                Latitude  = jsonLocation.Latitude,
                Longitude = jsonLocation.Longitude,
                Bairro    = jsonLocation.Bairro,
                Cidade    = jsonLocation.Cidade,
                Estado    = jsonLocation.Estado,
                Pais      = jsonLocation.Pais,
                Rua       = jsonLocation.Rua
            };

            InsertLocation(location);
        }
예제 #21
0
        public async Task <IActionResult> New([FromBody] Models.Location args)
        {
            var bll_l = locationBusiness;
            var user  = HttpContext.Items["EndUser"] as EF.EndUser;

            var o = this.mapper.Map <EF.Location>(args);

            o.CommunityId     = user.Member.CommunityId;
            o.DateTimeCreated = DateTime.Now;
            o.CreatedBy       = user.Member.Name;

            var id = await bll_l.Add(o);

            return(Ok(id));
        }
예제 #22
0
 /// <summary>
 /// Post the location of the device to the backend
 /// </summary>
 /// <returns></returns>
 public async Task RegisterLocation()
 {
     await Task.Run(async() =>
     {
         Models.Location location = await FindLocation();
         if (location != null)
         {
             serverClient.PostData(location, Target.Locations);
         }
         else
         {
             StopTracking();
         }
     });
 }
예제 #23
0
        public void Persist(ApplicationDbContext context)
        {
            Models.Location location = new Models.Location
            {
                Name        = this.Name,
                Description = this.Description,
                Address     = this.Address,
                County      = this.County,
            };
            context.Locations.Add(location);
            List <LocationCategory> locationCategories = CreateManyToManyRelationships(location.Id);

            location.LocationCategories = locationCategories;
            context.SaveChanges();
        }
        //creates an instance of populated Location object and updates database with changes
        public void Persist(int id, ApplicationDbContext context)
        {
            Models.Location location = new Models.Location()
            {
                ID          = id,
                Name        = this.Name,
                Description = this.Description,
                Address     = this.Address,
                County      = this.County
            };
            context.Update(location);
            List <Models.CategoryLocation> categoryLocations = CreateCategoryLocationRelationships(location.ID);

            location.CategoryLocations = categoryLocations;
            context.SaveChanges();
        }
예제 #25
0
        // GET: Location/Details/5
        public ActionResult Details(string name)
        {
            var libLoc = Repo.GetLocationByCityname(name);
            var webLoc = new Models.Location
            {
                Name               = libLoc.Name,
                DoughRemaining     = libLoc.Dough,
                SauceRemaining     = libLoc.Sauce,
                CheeseRemaining    = libLoc.Cheese,
                PepperoniRemaining = libLoc.Pepperoni,
                MeatRemaining      = libLoc.HamAndMeatball,
                VeggiesRemaining   = libLoc.PeppersAndOnions
            };

            return(View(webLoc));
        }
예제 #26
0
        private List <Models.Location> MapLocationReader(SqlDataReader reader)
        {
            List <Models.Location> locations = new List <Models.Location>();

            while (reader.Read())
            {
                Models.Location location = new Models.Location
                {
                    LocationId  = Convert.ToInt32(reader["location_Id"]),
                    Title       = Convert.ToString(reader["location_Title"]),
                    Description = Convert.ToString(reader["location_Description"]),
                };

                locations.Add(location);
            }
            return(locations);
        }
예제 #27
0
        //this persists the location
        public void CreateLocation(ApplicationDbContext context, LocationCreateViewModel locationViewModel)
        {
            Models.Location location = new Models.Location();
            {
                location.Name        = locationViewModel.Name;
                location.Description = locationViewModel.Description;
                location.Address     = locationViewModel.Address;
                location.County      = locationViewModel.County;
            }
            //have to specify becaue there are multiple lists in DbContext
            context.Locations.Add(location);
            List <Models.CategoryLocation> categoryLocations = CreateCategoryLocationRelationships(location.ID);

            //this refers to the list stored in the Location model
            location.CategoryLocations = categoryLocations;
            context.SaveChanges();
        }
        public LocationEditViewModel(int id, ApplicationDbContext context)
        {
            //gets the location object from context by id
            Models.Location location = context.Locations
                                       .Include(l => l.CategoryLocations)
                                       .Single(l => l.ID == id);

            //returns a populated LocationEditViewModel object


            Name        = location.Name;
            Description = location.Description;
            Address     = location.Address;
            County      = location.County;
            CategoryIDs = location.CategoryLocations.Select(cl => cl.CategoryID).ToList();
            Categories  = context.Categories.ToList();
        }
예제 #29
0
        private async void UpdateDistance()
        {
            // Get Trip Location

            Models.Location SLocal = Trip.Location;

            Models.Location local = new Models.Location();

            Xamarin.Essentials.Location startTrip = new Xamarin.Essentials.Location(SLocal.Lat, SLocal.Lng);

            Models.Location NowLocal = new Models.Location();

            try
            {
                var request = new GeolocationRequest(GeolocationAccuracy.High);

                var location = await Geolocation.GetLocationAsync(request);


                if (location != null)
                {
                    local.Lat = location.Latitude;
                    local.Lng = location.Longitude;

                    Xamarin.Essentials.Location OnTrip = new Xamarin.Essentials.Location(local.Lat, local.Lng);

                    double distance = Xamarin.Essentials.Location.CalculateDistance(startTrip, OnTrip, DistanceUnits.Kilometers);


                    double oDistance = double.Parse(Trip.Distance);

                    double total = oDistance + distance;

                    _firebaseDatabase.UpdateTripDistance(Trip.Key, Math.Round(total, 2).ToString());

                    GetCurrentLocation();
                }
            }
            catch (Exception ex)
            {
                // Unable to get location

                await DisplayAlert(ex.Source, "ERROR: " + ex.Message, "OK");
            }
        }
예제 #30
0
        public void Persist(int LocationId, ApplicationDbContext context)
        {
            Models.Location location = new Models.Location
            {
                Id               = LocationId,
                Name             = this.Name,
                Description      = this.Description,
                HoursOfOperation = this.HoursOfOperation,
                Address          = this.Address,
                Region           = this.Region
            };
            context.Update(location);

            List <CategoryLocation> categoryLocations = CreateManyToManyRelationships(location.Id);

            location.CategoryLocations = categoryLocations;
            context.SaveChanges();
        }
예제 #31
0
 public static Search.Models.Location AsSearchModel(this Models.Location source) => new Search.Models.Location
 {
     Id              = source.LocationId,
     Latitude        = source.Latitude,
     Longitude       = source.Longitude,
     Altitude        = source.Altitude,
     AddressLine1    = source.AddressLine1,
     AddressLine2    = source.AddressLine2,
     City            = source.City,
     StateOrProvince = source.StateOrProvince,
     PostalCode      = source.PostalCode,
     Country         = source.Country,
     Region          = source.Region,
     CreatedBy       = source.CreatedBy,
     ModifiedBy      = source.ModifiedBy,
     DateCreated     = source.DateCreated ?? DateTime.UtcNow,
     DateModified    = source.DateModified
 };
예제 #32
0
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                var wikiEntry = inputWiki1.InnerText;
                var radius = inputRadiusValue.Value;
                var name = inputName.Value;
                var lat = inputLat.Value;
                var lng = inputLong.Value;

                double? radiusActual = null;
                double latActual;
                double lngActual;

                using (var db = new Dal.DatabaseContext())
                {
                    var user = (Models.LoginAccount)Session["New"];
                    var hitchbotId = user.HitchBotId;

                    Models.Location location = null;

                    Models.CleverscriptContext context = null;

                    if (!bucketCheckBox.Checked)
                    {
                        var contextID = int.Parse(selectedLabelID.Value);
                        context = db.CleverscriptContexts.FirstOrDefault(l => l.Id == contextID);

                        if (context == null)
                        {
                            setErrorMessage("Error with the cleverscript label!!");
                            return;
                        }
                    }

                    if (LocationCheckBox.Checked)
                    {
                        /*
                        nullable double parse code borrowed from
                        http://stackoverflow.com/questions/3390750/how-to-use-int-tryparse-with-nullable-int
                        */
                        double tmp;

                        if (!double.TryParse(radius, out tmp))
                        {
                            setErrorMessage("Selected Radius is not valid!");
                            return;
                        }
                        radiusActual = tmp;

                        if (!double.TryParse(lat, out latActual))
                        {
                            setErrorMessage("Latitude is not valid number!");
                            return;
                        }

                        if (!double.TryParse(lng, out lngActual))
                        {
                            setErrorMessage("Longitude is not valid number!");
                            return;
                        }

                        location = new Models.Location
                        {
                            Latitude = latActual,
                            Longitude = lngActual,
                            TimeAdded = DateTime.UtcNow,
                            TakenTime = DateTime.UtcNow
                        };

                        db.Locations.Add(location);
                        db.SaveChanges();
                    }

                    var wiki = new Models.CleverscriptContent
                    {
                        LocationId = location.Id,
                        CleverText = wikiEntry,
                        EntryName = name,
                        RadiusKm = radiusActual,
                        HitchBotId = hitchbotId,
                        TimeAdded = DateTime.UtcNow,
                        isBucketList = bucketCheckBox.Checked
                    };

                    if (context != null)
                    {
                        wiki.CleverscriptContextId = context.Id;
                    }

                    db.CleverscriptContents.Add(wiki);

                    db.SaveChanges();
                }

                Response.Redirect("AddTargetSuccess.aspx");
            }
            catch
            {
                setErrorMessage("An unknown error occurred. let the sys admin know you saw this message.");
            }
        }
예제 #33
0
        public CityInfo(CityInfoContract info)
        {
            City = info.city;
            Country = info.cnty;
            Province = info.prov;
            Id = info.id;
            CultureInfo provider = CultureInfo.InvariantCulture;
            float lat;
            if (float.TryParse(info.lat, NumberStyles.Any, provider, out lat))
            {
                float lon;
                if (float.TryParse(info.lon, NumberStyles.Any, provider, out lon))
                {
                    FuckingshitLocation(ref lat, ref lon, Country);
                    this.Location = new Models.Location(lat, lon);
                }
            }

        }
 internal async Task UpdatePosition(Geoposition pos)
 {
     Location = new Models.Location((float)pos.Coordinate.Point.Position.Latitude, (float)pos.Coordinate.Point.Position.Longitude);
     foreach (var item in LocationList)
     {
         await item.GetLocation(pos.Coordinate.Point.Position.Latitude, pos.Coordinate.Point.Position.Longitude);
     }
 }
예제 #35
0
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                var wikiEntry = inputWiki1.InnerText;
                var radius = inputRadiusValue.Value;
                var name = inputName.Value;
                var lat = inputLat.Value;
                var lng = inputLong.Value;

                double? radiusActual = null;
                double latActual;
                double lngActual;

                using (var db = new Models.Database())
                {
                    var user = (Models.Password)Session["New"];
                    var hitchbot = db.hitchBOTs.Include(l => l.WikipediaEntries).First(l => l.ID == user.hitchBOT.ID);

                    Models.Location location = null;

                    if (LocationCheckBox.Checked)
                    {
                        /*
                        nullable double parse code borrowed from
                        http://stackoverflow.com/questions/3390750/how-to-use-int-tryparse-with-nullable-int
                        */
                        double tmp;

                        if (!double.TryParse(radius, out tmp))
                        {
                            setErrorMessage("Selected Radius is not valid!");
                            return;
                        }
                        radiusActual = tmp;

                        if (!double.TryParse(lat, out latActual))
                        {
                            setErrorMessage("Latitude is not valid number!");
                            return;
                        }

                        if (!double.TryParse(lng, out lngActual))
                        {
                            setErrorMessage("Longitude is not valid number!");
                            return;
                        }

                        location = new Models.Location
                        {
                            Latitude = latActual,
                            Longitude = lngActual,
                            TimeAdded = DateTime.UtcNow,
                            TakenTime = DateTime.UtcNow
                        };

                        db.Locations.Add(location);
                        db.SaveChanges();

                    }

                    var wiki = new Models.WikipediaEntry
                    {
                        TargetLocation = location,
                        WikipediaText = wikiEntry,
                        EntryName = name,
                        RadiusKM = radiusActual,
                        HitchBot = hitchbot,
                        TimeAdded = DateTime.UtcNow
                    };

                    db.WikipediaEntries.Add(wiki);

                    db.SaveChanges();
                }

                Response.Redirect("AddTargetSuccess.aspx");
            }
            catch
            {
                setErrorMessage("An unknown error occurred. let the sys admin know you saw this message.");
            }
        }