public void GetTabuasMare(string id_porto, string mes) { PortosDAL objDAL = new PortosDAL(); DataTable dtMares = objDAL.SelectTabuaMares(id_porto, mes); int i = 0; List <tabuasMare.tabuaMare> objListMares = new List <tabuasMare.tabuaMare>(); for (i = 0; i < dtMares.Rows.Count; i++) { tabuasMare.tabuaMare obj = new tabuasMare.tabuaMare(); obj.Nome_PortoMare = dtMares.Rows[i]["nome_porto"].ToString(); obj.DiaSemana = dtMares.Rows[i]["dia_semana"].ToString(); obj.data2 = dtMares.Rows[i]["data2"].ToString(); obj.hora = dtMares.Rows[i]["hora"].ToString(); obj.altura = dtMares.Rows[i]["altura"].ToString(); obj.NomePorto_Resumido = dtMares.Rows[i]["nome_resumido"].ToString(); objListMares.Add(obj); } tabuasMare o = new tabuasMare(); o.listTabuasMare = objListMares; JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(jsSerializer.Serialize(o)); }
public void GetPortos() { PortosDAL objDAL = new PortosDAL(); DataTable dtPortos = objDAL.SelectPortos(); List <portos.porto> objListPortos = new List <portos.porto>(); for (int i = 0; i < dtPortos.Rows.Count; i++) { portos.porto obj = new portos.porto(); obj.IdPorto = dtPortos.Rows[i]["id"].ToString().Trim(); obj.NomePorto = dtPortos.Rows[i]["nome_porto"].ToString().Trim(); obj.NomeResumido = dtPortos.Rows[i]["nome_resumido"].ToString().Trim(); objListPortos.Add(obj); } portos o = new portos(); o.listPortos = objListPortos; JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); this.Context.Response.ContentType = "application/json; charset=utf-8"; this.Context.Response.Write(jsSerializer.Serialize(o)); }