protected void btnCenso_Click(object sender, EventArgs e) { List <Censo> details = new List <Censo>(); try { string URI = "http://10.48.21.64:5000/hspmsgh-api/censo/"; WebRequest request = WebRequest.Create(URI); HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(URI); // Sends the HttpWebRequest and waits for a response. HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse(); if (httpResponse.StatusCode == HttpStatusCode.OK) { var reader = new StreamReader(httpResponse.GetResponseStream()); JsonSerializer json = new JsonSerializer(); var objText = reader.ReadToEnd(); details = JsonConvert.DeserializeObject <List <Censo> >(objText); foreach (Censo paciente in details) { CensoDAO.InserirCenso(paciente); } } } catch (WebException ex) { string err = ex.Message; } catch (Exception ex1) { string err1 = ex1.Message; } }
protected void PacientesInternados(string data_carga) { GridView1.DataSource = CensoDAO.getListaPacientesInternadosUltimaCarga(data_carga); GridView1.DataBind(); if (GridView1.Rows.Count > 0) { //This replaces <td> with <th> and adds the scope attribute GridView1.UseAccessibleHeader = true; //This will add the <thead> and <tbody> elements GridView1.HeaderRow.TableSection = TableRowSection.TableHeader; //This adds the <tfoot> element. //Remove if you don't have a footer row GridView1.FooterRow.TableSection = TableRowSection.TableFooter; } }