Esempio n. 1
0
    protected LatLng GetPropertyLatLng(QuickPM.Property p)
    {
        List<string> tenantIds = p.GetTenantIds();
        foreach (string tenantId in tenantIds)
        {
            QuickPM.Tenant tenant = new QuickPM.Tenant(tenantId);
            string address = tenant.Address + "," + tenant.City + "," + tenant.State + "," + "USA";
            string requestUrl = "http://maps.google.com/maps/geo?q=" + Server.UrlEncode(address) +
                            "&output=csv&oe=utf8&sensor=false&key=" + apiKey;
            WebRequest webRequest = WebRequest.Create(requestUrl);
            WebResponse response = webRequest.GetResponse();
            System.IO.StreamReader reader = new System.IO.StreamReader(response.GetResponseStream());
            string line = reader.ReadLine();
            if (line.Trim().Length == 0)
            {
                continue;
            }
            string[] tmp = line.Split(new char[] { ',' });
            if (tmp.Length != 4)
            {
                continue;
            }
            //int statusCode = int.Parse(tmp[0]);
            //int accuracy = int.Parse(tmp[1]);
            double lat = double.Parse(tmp[2]);
            double lng = double.Parse(tmp[3]);
            if (lat == 0 || lng == 0)
            {

                continue;
            }
            propertyAddresses[p.Id] = address;
            return new LatLng(lat, lng);
        }
        return null;
    }
Esempio n. 2
0
    protected List<DateTime> FindChanges(QuickPM.Property property)
    {
        List<string> tenantIds = property.GetTenantIds();
        List<DateTime> adjustments = new List<DateTime>();
        foreach (string tenantId in tenantIds)
        {

            if (FindChanges(tenantId).HasValue)
            {
                adjustments.Add(FindChanges(tenantId).Value);
            }
        }
        adjustments.Sort();
        return adjustments;
    }
Esempio n. 3
0
 protected string GetPropertyAddress(QuickPM.Property p)
 {
     List<string> tenantIds = p.GetTenantIds();
     foreach (string tenantId in tenantIds)
     {
         QuickPM.Tenant t = new QuickPM.Tenant(tenantId);
         if (t.Address != "")
         {
             return t.GetFullAddress();
         }
     }
     return "";
 }