Пример #1
0
        public GeoPosition GetPositionSQL(String nodeId, String connectionString)
        {
            GeoPosition temp = null;

            SqlConnection con = new SqlConnection(connectionString);

            con.Open();
            SqlCommand com = new SqlCommand("", con);

            com.CommandText = "select id,Latitude,Longitude from tnode where id='" + nodeId + "'";
            SqlDataReader reader = com.ExecuteReader();

            while (reader.Read())
            {
                temp = new GeoPosition((double)reader["Latitude"], (double)reader["Longitude"]);
            }
            if (!reader.IsClosed)
            {
                reader.Close();
            }
            con.Close();
            return(temp);
        }
Пример #2
0
 /// <summary>
 /// Compares two GeoPosition objects by Lat / Lon properties.
 /// </summary>
 /// <param name="geo">The first geo position</param>
 /// <param name="geo2">The second geo position</param>
 /// <returns></returns>
 public static bool EqualsManual(this GeoPosition geo, GeoPosition geo2)
 {
     return(geo.Lat == geo2.Lat && geo.Lon == geo2.Lon);
 }