public static void ExececuteSoldUrl(string url) { MongoClient mongoClient = new MongoClient(MongoUrl.Create("mongodb://localhost:27017")); IMongoDatabase mongoDatabase = mongoClient.GetDatabase("RealEstate"); IMongoCollection <BsonDocument> collection = mongoDatabase.GetCollection <BsonDocument>("SaleMap"); string responseContent = OwnHttpClient.GetResponseContent(url).Result; int count = 0; try { if (responseContent != "[]") { List <MongohouseMapProperty> mongoHouseMaps = Newtonsoft.Json.JsonConvert.DeserializeObject <List <MongohouseMapProperty> >( responseContent, new JsonSerializerSettings() { ContractResolver = new MapContractResolver() }); count = mongoHouseMaps.Count; foreach (MongohouseMapProperty x in mongoHouseMaps) { MapJaJa map = new MapJaJa() { _id = ObjectId.GenerateNewId().ToString(), nodeId = "C-" + x.MLSNo, lat = x.Twodsphere.coordinates[0], lng = x.Twodsphere.coordinates[1] }; IMongoCollection <BsonDocument> pcollection = mongoDatabase.GetCollection <BsonDocument>("WaitProcessingForSoldJaJa"); var filter = new BsonDocument("nodeId", map.nodeId); var FindResult = pcollection.Find(filter); var bsonDoc = BsonSerializer.Deserialize <BsonDocument>(Newtonsoft.Json.JsonConvert.SerializeObject(map)); if (FindResult.CountDocuments() == 0) { pcollection.InsertOne(bsonDoc); } } } IMongoCollection <BsonDocument> exeCollection = mongoDatabase.GetCollection <BsonDocument>("MongoHouseSoldUrls"); var mfilter = new BsonDocument("Url", url); List <BsonDocument> bdocs = exeCollection.Find(mfilter).ToList(); foreach (BsonDocument doc in bdocs) { doc["QueryResult"] = doc["QueryResult"] + "-" + count.ToString(); exeCollection.ReplaceOne(mfilter, doc); System.Diagnostics.Debug.WriteLine(doc["Url"].ToString()); } } catch (Exception) { } }
public static string Details(string mls) { string url = string.Format("http://www.realsforce.com/en/fd/listing/{0}", mls); return(OwnHttpClient.GetResponseContent(url).Result); }
public static string ForLease(double swLat, double swLng, double neLat, double neLng) { string url = string.Format("http://www.realsforce.com/playserver/getNearByListings?swLat={0}&swLng={1}&neLat={2}&neLng={3}&accountId=10749&listingtype=Lease&mlsnum=undefined", swLat, swLng, neLat, neLng); return(OwnHttpClient.GetResponseContent(url).Result); }
public static string HistoricalUrl(string address1, string address2, string city) { string url = string.Format("https://mongohouse.com/api/historical_prices_sale?Address1={0}&Address2={1}&City={2}", address1, address2, city); return(OwnHttpClient.GetResponseContent(url).Result); }
public static string MLSSearch(string mls) { string url = string.Format("https://mongohouse.com/api/quick_search_by_mls?token={0}", mls); return(OwnHttpClient.GetResponseContent(url).Result); }