Example #1
0
        public void CreateLocation(Location instance)
        {
            GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext();

            objectContext.Locations.InsertOnSubmit(instance);
            objectContext.SubmitChanges();
        }
Example #2
0
        private void readAndSaveJsonData(GZipStream inputStream)
        {
            StreamReader streamReader = null;

            try
            {
                streamReader = new StreamReader(inputStream);
                String jsonLine = null;

                while ((jsonLine = streamReader.ReadLine()) != null)
                {
                    //get geoLocation object
                    JObject geoLocation = JObject.Parse(jsonLine);
                    //create entry object.
                    Entry entry = createEntry(geoLocation);
                    //create location object.
                    Location location = createAndInsertLocation(geoLocation, entry);
                    //Data object
                    JObject jsonIdentifierObj = (JObject)geoLocation["identifier"];
                    Object  obj = createAndInsertDataWithContent(jsonIdentifierObj, (String)geoLocation["data"], entry);

                    //save objects into database.
                    using (GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext())
                    {
                        objectContext.Entries.InsertOnSubmit(entry);
                        objectContext.SubmitChanges();
                    }
                }
            }
            finally
            {
                streamReader.Close();
            }
        }
Example #3
0
        public List <Location> GetLocations()
        {
            GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext();
            List <Location>          locationQuery = (from loc in objectContext.Locations
                                                      select loc).ToList();

            return(locationQuery);
        }
Example #4
0
 private void insertLocation(Location instance)
 {
     using (GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext())
     {
         objectContext.Locations.InsertOnSubmit(instance);
         objectContext.SubmitChanges();
     }
 }
Example #5
0
        public Location GetLocation(string id)
        {
            int parseId = int.Parse(id);
            GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext();

            Location location = (from loc in objectContext.Locations
                                 where loc.id == parseId
                                 select loc).First();

            return(location);
        }
Example #6
0
        public Location GetLocation(string id)
        {
            int parseId = int.Parse(id);
            GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext();

            Location location = (from loc in objectContext.Locations
                                 where loc.id == parseId
                                 select loc).First();
            return location;
        }
Example #7
0
 public void CreateLocation(Location instance)
 {
     GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext();
     objectContext.Locations.InsertOnSubmit(instance);
     objectContext.SubmitChanges();
 }
Example #8
0
        private void readAndSaveJsonData(GZipStream inputStream)
        {
            StreamReader streamReader = null;

            try
            {
                streamReader = new StreamReader(inputStream);
                String jsonLine = null;

                while ((jsonLine = streamReader.ReadLine()) != null)
                {
                    //get geoLocation object
                    JObject geoLocation = JObject.Parse(jsonLine);
                    //create entry object.
                    Entry entry = createEntry(geoLocation);
                    //create location object.
                    Location location = createAndInsertLocation(geoLocation, entry);
                    //Data object
                    JObject jsonIdentifierObj = (JObject)geoLocation["identifier"];
                    Object obj = createAndInsertDataWithContent(jsonIdentifierObj, (String)geoLocation["data"], entry);

                    //save objects into database.
                    using (GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext())
                    {
                        objectContext.Entries.InsertOnSubmit(entry);
                        objectContext.SubmitChanges();
                    }
                }
            }
            finally
            {
                streamReader.Close();
            }
        }
Example #9
0
 private void insertLocation(Location instance)
 {
     using (GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext())
     {
         objectContext.Locations.InsertOnSubmit(instance);
         objectContext.SubmitChanges();
     }
 }
Example #10
0
 public List<Location> GetLocations()
 {
     GeoStoreModelDataContext objectContext = new GeoStoreModelDataContext();
     List<Location> locationQuery = (from loc in objectContext.Locations
                                     select loc).ToList();
     return locationQuery;
 }