//[WebMethod(Description = "CallDT")] public DataTable CallDT(string URL) { try { _c_function fn = new _c_function(); DataTable dt = fn.CallSolr_DT(URL); dt.TableName = "t"; return(dt); } catch { return(null); } }
public string Search_Nearby(string lat, string lon, string distance, string numreturn, string token) { try { if (token == "43f9952b429485e270ccf674f") { double dist = (double.Parse(distance) / 1000); _c_function fn = new _c_function(); string latlon = lat + "," + lon; string URI = ""; List <string> li = new List <string>(); fn.createSolrQueryString(ref URI, "*", latlon, dist.ToString(), li, li, "", "5", "", "", "", ""); URI = URI + "&start=0&rows=" + numreturn; DataTable result = fn.CallSolr_DT(URI); StringBuilder sb = new StringBuilder(); try { if (result.Rows.Count == 0) { return("NotFound"); } } catch (Exception e) { } for (int i = 0; i < result.Rows.Count; i++) { sb.Append(result.Rows[i]["Name_Local"] + "!" + result.Rows[i]["Name_English"] + "!" + (1000 * double.Parse(result.Rows[i]["dist"].ToString())).ToString("F2")); sb.Append("|"); } return(sb.ToString()); } else { return("you don't have permission"); } } catch (Exception) { return("Error in code Please contact developer."); } }