Ejemplo n.º 1
0
        public GeoArea SetServerBounds(long singleArea)
        {
            //This is an important command if you don't want to track data outside of your initial area.
            GeoArea results = null;

            if (singleArea != 0)
            {
                var area    = Places.First(e => e.SourceItemID == singleArea);
                var envelop = area.ElementGeometry.EnvelopeInternal;
                results = new GeoArea(envelop.MinY, envelop.MinX, envelop.MaxY, envelop.MaxX);
            }
            else
            {
                results = Place.DetectServerBounds(ConstantValues.resolutionCell8);
            }

            var settings = ServerSettings.FirstOrDefault();

            settings.NorthBound = results.NorthLatitude;
            settings.SouthBound = results.SouthLatitude;
            settings.EastBound  = results.EastLongitude;
            settings.WestBound  = results.WestLongitude;
            SaveChanges();
            return(results);
        }
        public static void AddThing(Thing thing)
        {
            int id = 1;

            for (; Things.Any(i => i.Id == id); id++)
            {
                ;
            }
            SQLiteCommand cmd = new SQLiteCommand("insert into Things values (@id,@name,@desc,@count,@place)", conn);

            cmd.Parameters.AddWithValue("@id", id);
            cmd.Parameters.AddWithValue("@name", thing.Name);
            cmd.Parameters.AddWithValue("@desc", thing.Description);
            cmd.Parameters.AddWithValue("@count", thing.Count);
            cmd.Parameters.AddWithValue("@place", Places.First(i => i.Name == thing.Place).Id);
            cmd.ExecuteNonQuery();
        }