Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. public Station GetStationData(string city, string station)
  2. {
  3. Station stationObject = new Station();
  4.  
  5. string data = GetContractDataFromServer(city);
  6. if (data != "-1")
  7. {
  8. JArray stationArray = JArray.Parse(data);
  9.  
  10. for (int i = 0; i < stationArray.Count(); i++)
  11. {
  12. JObject item = (JObject)stationArray[i];
  13. if (((string)item["name"]).ToLower().Contains(station.ToLower()))
  14. {
  15. stationObject.city = (string)item["contract_name"];
  16. stationObject.name = (string)item["name"];
  17. stationObject.address = (string)item["address"];
  18. stationObject.availableBikes = (int)item["available_bikes"];
  19. stationObject.latitude = (double)(item["position"]["lat"]);
  20. stationObject.longitude = (double)(item["position"]["lng"]);
  21. }
  22. return stationObject;
  23. }
  24. }
  25. return null;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement