public VietBandoPOI[] SearchAll(string searchKey, int page) { var client = new PartnerPortalSoapServiceClient(); using (new OperationContextScope(client.InnerChannel)) { // Add a HTTP Header to an outgoing request HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty(); requestMessage.Headers["RegisterKey"] = _key; OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage; MultipleVietBandoPOI res = new MultipleVietBandoPOI(); try { res = client.SearchAll(searchKey, page, 10, 0, 0, 0, 0, false, 1); } catch (Exception e) { Console.WriteLine("Error: " + e); return(new VietBandoPOI[] { }); } if (res != null && res.List.Length > 0) { return(res.List); } client.Close(); return(new VietBandoPOI[] { }); } }
public int CountSearch(string searchKey) { using (var client = new PartnerPortalSoapServiceClient()) { using (new OperationContextScope(client.InnerChannel)) { // Add a HTTP Header to an outgoing request HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty(); requestMessage.Headers["RegisterKey"] = _key; OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage; var res = client.SearchAll(searchKey, 1, 10, 0, 0, 0, 0, false, 1); return(res.TotalCount); } } }
public DirectionResult FindShortPath(Point[] points, TransportType type) { using (var client = new PartnerPortalSoapServiceClient()) { using (new OperationContextScope(client.InnerChannel)) { // Add a HTTP Header to an outgoing request HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty(); requestMessage.Headers["RegisterKey"] = _key; OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage; SingleDirectionResult res = client.FindShortestPath(points, type, true); if (res.IsSuccess) { return(res.Value); } return(new DirectionResult { }); } } }
public VietBandoPOI[] Search_Mobile(string key) { using (var client = new PartnerPortalSoapServiceClient()) { using (new OperationContextScope(client.InnerChannel)) { // Add a HTTP Header to an outgoing request HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty(); requestMessage.Headers["RegisterKey"] = "7a285288-9691-4496-ba41-c702a1c587be"; OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage; var res = client.SearchAll(key, 1, 10, 106.50421142578125, 10.344642004246225, 106.7706298828125, 11.431571076012276, true); if (res != null && res.List.Length > 0) { return(res.List); } return(new VietBandoPOI[] { }); } } }