public LinkedList <AreaTematica> getAllAreaTematicas() { String sqlSelect = "SELECT at.id_area_tematica,at.nombre_area_tematica,at.sigla," + " at.id_guia_reconocimiento" + " FROM AreaTematica at "; SqlConnection connection = new SqlConnection(this.connectionString); DataSet dsAreas = new DataSet(); SqlDataAdapter daAreas = new SqlDataAdapter(); daAreas.SelectCommand = new SqlCommand(sqlSelect, connection); daAreas.Fill(dsAreas, "Areas"); DataRowCollection rows = dsAreas.Tables["Areas"].Rows; LinkedList <AreaTematica> areasTematicas = new LinkedList <AreaTematica>(); foreach (DataRow row in rows) { AreaTematica area = new AreaTematica(Int32.Parse(row["id_area_tematica"].ToString()), row["nombre_area_tematica"].ToString(), row["sigla"].ToString()); area.Criterios = criterioBusiness.findAllCriteriosByAreaTematica(area.IdAreaTematica); areasTematicas.AddLast(area); } return(areasTematicas); }
protected void ddlAreaTematica_SelectedIndexChanged(object sender, EventArgs e) { AreaTematicaBusiness areaBus = new AreaTematicaBusiness(connectionString); areaTematica = areaBus.findAreaTematicaByCode(Int32.Parse(ddlAreaTematica.SelectedItem.Value)); CriterioBusiness criterioBus = new CriterioBusiness(connectionString); LinkedList <Criterio> criterios = criterioBus.findAllCriteriosByAreaTematica(Int32.Parse(ddlAreaTematica.SelectedItem.Value)); if (criterios != null) { Criterio a = new Criterio(); a.IdCriterio = 0; a.Descripcion = ""; criterios.AddFirst(a); lblCriterios.Visible = true; ddlCriterios.Visible = true; ddlCriterios.DataSource = criterios; ddlCriterios.DataTextField = "descripcion"; ddlCriterios.DataValueField = "idCriterio"; ddlCriterios.DataBind(); } else { lblMensajeError.Text = "El area tematica seleccionada no tiene criterios registrados"; } }