private static List<Search> getSearchInfo(String uId) { List<Search> searchList = new List<Search>(); Search tempObj = null; SqlConnection conn = new SqlConnection("Data Source=HARSHAD\\SQLEXPRESS;Initial Catalog=TRAVELLERS_ASSISTANCE;Integrated Security=True"); String sql = string.Format("SELECT * FROM [SEARCH_HISTORY] WHERE Userid= {0}", uId); SqlCommand sqlCmd = new SqlCommand(sql, conn); conn.Open(); SqlDataReader rs = sqlCmd.ExecuteReader(); while (rs.Read()) { tempObj = new Search(); tempObj.searchCriteria = (string)rs.GetValue(1); tempObj.startLocation= (string)rs.GetValue(2); tempObj.readius = (string)rs.GetValue(3); searchList.Add(tempObj); } return searchList; }
public CompositeModel searchInfo(Search searchObj) { output = new CompositeModel(); String searchCriteria=searchObj.searchCriteria; String startLocation=searchObj.startLocation.Replace(" ","%20"); String endLocation = searchObj.endLocation.Replace(" ", "%20"); String radius=searchObj.readius; output.searchObj = searchObj; output.trafficInfo = getTrafficInfo(startLocation); output.trafficInfo += getTrafficInfo(endLocation); GoogleDirections.TDirections directionsObj= getDirectionsToDestination(startLocation, endLocation); List<GoogleMap> pointerList = getServicePointsAlongRoute(directionsObj); List<Yelp.Business> businessList = getServices(pointerList,searchCriteria,radius); //output.error += directionsObj.routes[0].legs[0].steps.Length + " " + pointerList.Count + " " + businessList.Count; List<GoogleMap> serviceList = getGoogleMapServicePointers(businessList); output.serviceList = serviceList; output.bList = businessList; output.basePointer = getRoute(startLocation,endLocation); output.directionsScript = getDirectionsScript(searchObj.startLocation,searchObj.endLocation ); output.servicePointers = getServiceMap(serviceList); output.infoWindow = getServiceInfoWindow(serviceList); return output; }