static public bool AddCountry(Advanced.SameLocation samelocation, SQLiteConnection connection) { if (samelocation.Lat != "NetworkError" && samelocation.Lat != "DataError") { SQLiteCommand sqlcommand = new SQLiteCommand("INSERT INTO CountryTable VALUES('" + samelocation.Location + "', '" + samelocation.Lat + "', '" + samelocation.Lng + "')", connection); if (sqlcommand.ExecuteNonQuery() != 0) { return(true); } } return(false); }
static public Advanced.SameLocation MatchCountry(Advanced.SameLocation samelocation, SQLiteConnection connection) { SQLiteCommand sqlcommand = new SQLiteCommand("SELECT * FROM CountryTable WHERE Country = '" + samelocation.Location + "'", connection); if (sqlcommand.ExecuteScalar() != null) { SQLiteDataReader reader = sqlcommand.ExecuteReader(); while (reader.Read()) { samelocation.Lng = reader.GetString(reader.GetOrdinal("Lng")); samelocation.Lat = reader.GetString(reader.GetOrdinal("Lat")); } } else { samelocation = Advanced.GetLatLng(samelocation, 0); AddCountry(samelocation, connection); } return(samelocation); }