static void Main(string[] args) { ReconhecimentoZonaRN.ReconhecimentoZonaRN rn = new ReconhecimentoZonaRN.ReconhecimentoZonaRN(); List<Agencia> agencias = Agencia.PegarTodas(); int acertos = 0; foreach (Agencia agencia in agencias) { string zona = rn.IdentificarZona(agencia.Latitude, agencia.Longitude); if (zona == agencia.Zona) acertos++; } }
private void btnLocalizar_Click(object sender, EventArgs e) { string endereco = txtEndereco.Text; if (endereco.Length == 8) { int cep = 0; Int32.TryParse(endereco, out cep); if (cep != 0) { endereco = endereco.Insert(5, "-"); } } Coordenadas cord = GoogleGeoCode.GetCoordenadas(endereco); latitude = (double)cord.Latitude; longitude = (double)cord.Longitude; ReconhecimentoZonaRN.ReconhecimentoZonaRN reconhecimentoZonaRN = new ReconhecimentoZonaRN.ReconhecimentoZonaRN(); string zonaRN = reconhecimentoZonaRN.IdentificarZona((double)cord.Longitude, (double)cord.Latitude); lblZona.Text = "O enrereço foi identificado na(o) " + zonaRN; foreach (Agencia agencia in agencias) { agencia.Distancia = Utils.Distancia.CalcularDistanciaKM((double)cord.Latitude, (double)cord.Longitude, agencia.Latitude, agencia.Longitude); } pnlBancos.Enabled = true; }