Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        InmueblesBLL bllinmuebles = new InmueblesBLL();
        ProvinciasBLL bllprovincia = new ProvinciasBLL();
        LocalidadesBLL blllocalidades = new LocalidadesBLL();

        dt = bllinmuebles.SelectAllInmuebles();

        foreach (DataRow dtRow in dt.Rows)
        {
            if (dtRow["Latitud"].ToString() == "" || dtRow["Longitud"].ToString() == "")
            {
                var id = dtRow["IdInmueble"].ToString();
                var direccion = dtRow["Calle"].ToString();
                var numero = dtRow["Numero"].ToString();
                string idLocalidad = dtRow["idLocalidad"].ToString();
                string idprovincia = dtRow["idprovincia"].ToString();

                coordinate = getCoordinate(direccion, numero, blllocalidades.GetNombreLocalidad(Convert.ToInt32(idLocalidad)), bllprovincia.GetNombreProvincia(Convert.ToInt32(idprovincia)));

                bllinmuebles.SetLatitudLongitud(id, coordinate.Latitude, coordinate.Longitude);
                sumcant++;

                if (sumcant >= cant)
                    return;
            }
        }
    }