public Materia BuscarMateriaConCorrelativas(int ID) { Materia mat = null; PlanAdapter PlanData = new PlanAdapter(); MateriaAdapter MateriaData = new MateriaAdapter(); try { this.OpenConnection(); SqlCommand cmdMateria = new SqlCommand("SELECT * FROM materias WHERE id_materia=@idMateria", SqlConn); cmdMateria.Parameters.Add("@idMateria", System.Data.SqlDbType.Int).Value = ID; SqlDataReader dr = cmdMateria.ExecuteReader(); if (dr != null && dr.Read()) { mat = new Materia(); mat.ID = (int)dr["id_materia"]; mat.Descripcion = (string)dr["desc_materia"]; mat.HsSemanales = (int)dr["hs_semanales"]; mat.HsTotales = (int)dr["hs_totales"]; mat.Plan = PlanData.GetOne((int)dr["id_plan"]); mat.MateriasCorrelativas = MateriaData.BuscarMateriasCorrelativas(mat); } if (dr != null) { dr.Close(); } } catch (Exception Ex) { Exception ExcepcionManejada = new Exception("Error al recuperar datos de la materia", Ex); throw ExcepcionManejada; } finally { this.CloseConnection(); } return(mat); }