public Businesses GetBusiness(string longitude, string latitude, string search) { try { BusinessService businessService = new BusinessService(); Location location = new Location(); location.Latitude = latitude; location.Longitude = longitude; if(!search.ToLower().Trim().Equals("null")) location.BusinessName = search; Logging.WriteToFileLog(string.Format( "long : {0} , lat : {1}, search : {2}", longitude, latitude, search)); // Serialize the results as JSON /*DataContractJsonSerializer serializer = new DataContractJsonSerializer(results.GetType()); MemoryStream memoryStream = new MemoryStream(); serializer.WriteObject(memoryStream, results); // Return the results serialized as JSON string json = Encoding.Default.GetString(memoryStream.ToArray()); return json; */ WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain"; return new Businesses() { businesses = businessService.BusinessGet(location).ToArray() }; } catch (Exception e) { Logging.WriteToEventLog("Business GetBusiness " + e.Message); } return null; }
public List<Business> GetBusiness(string longitude, string latitude) { BusinessService businessService = new BusinessService(); Location location = new Location(); location.Latitude = latitude; location.Longitude = longitude; return businessService.BusinessGet(location); }
public string GetMyBusiness(string longitude, string latitude) { BusinessService businessService = new BusinessService(); Location location = new Location(); location.Latitude = latitude; location.Longitude = longitude; List<Business> businesses = businessService.BusinessGet(location); // Serialize the results as JSON DataContractJsonSerializer serializer = new DataContractJsonSerializer(businesses.GetType()); MemoryStream memoryStream = new MemoryStream(); serializer.WriteObject(memoryStream, businesses); // Return the results serialized as JSON string json = Encoding.Default.GetString(memoryStream.ToArray()); return json; }
//only get sponsors public Businesses GetBusiness(string latitude, string longitude) { try { BusinessService businessService = new BusinessService(); Location location = new Location(); location.Latitude = latitude; location.Longitude = longitude; location.Radius = ConfigurationManager.AppSettings["SponsoredRadius"]; Logging.WriteToFileLog(string.Format( "long : {0} , lat : {1}", longitude, latitude)); //WebOperationContext.Current.OutgoingResponse.ContentType = "text/plain"; return new Businesses() { businesses = businessService.BusinessGet(location).ToArray() }; } catch (Exception e) { Logging.WriteToEventLog("Business GetBusiness " + e.Message); } return null; }