WebClient reportClient = new WebClient(); //String uri = "/ServiceManager.svc/GetReport"; string uri = "http://xyz.com:4511/LIService.svc/GetState"; reportClient.DownloadStringCompleted +=new DownloadStringCompletedEventHandler(reportClient_DownloadStringCompleted); reportClient.DownloadStringAsync(new Uri(uri));
[OperationContract] [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, UriTemplate = "GetState")] public List<State> GetState() { DBManager dbManager = new DBManager(DataProvider.SqlServer); dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["LaborInsightConnectionString"].ConnectionString; List<State> stateList = new List<State>(); try { dbManager.Open(); dbManager.ExecuteReader(CommandType.Text, "select Name , FullName from CanonState where FullName<>'Unknown'"); while (dbManager.DataReader.Read()) { var rep = new State { id = dbManager.DataReader[0].ToString(), Name = dbManager.DataReader[1].ToString() }; stateList.Add(rep); } } catch (Exception ex) { throw ex.InnerException; //return null; } finally { dbManager.Dispose(); } return stateList; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)