public List <BeCurso> ObtenerListadoCursoPorEstado(Boolean?Estado) { List <BeCurso> listado = new List <BeCurso>(); DatabaseHelper helper = null; SqlDataReader reader = null; try { helper = new DatabaseHelper(DalConexion.getConexion()); helper.AddParameter("@P_ESTADO", Estado); reader = (SqlDataReader)helper.ExecuteReader("spr_ObtenerListadoCursoPorEstado", System.Data.CommandType.StoredProcedure); while (reader.Read()) { BeCurso obj = new BeCurso(); obj.id = Validacion.DBToInt32(ref reader, "id"); obj.descripcion = Validacion.DBToString(ref reader, "descripcion"); obj.image = Validacion.DBToString(ref reader, "image"); obj.estado = Validacion.DBToBoolean(ref reader, "estado"); listado.Add(obj); } } catch (Exception ex) { clsException localException = new clsException(ex, "DalCurso -> ObtenerListadoCursoPorEstado()"); } finally { if (helper != null) { helper.Dispose(); } } return(listado); }
public BeCursoMaterial ObtenerListadoMaterialPorCurso(Int32 cursoid) { BeCursoMaterial obj = new BeCursoMaterial(); obj.lstMaterial = new List <BeMaterial>(); DatabaseHelper helper = null; SqlDataReader reader = null; try { helper = new DatabaseHelper(DalConexion.getConexion()); helper.AddParameter("@P_CURSOID", cursoid); reader = (SqlDataReader)helper.ExecuteReader("spr_ObtenerListadoMaterialPorCurso", System.Data.CommandType.StoredProcedure); while (reader.Read()) { BeCurso objCurso = new BeCurso(); objCurso.id = Validacion.DBToInt32(ref reader, "cursoid"); objCurso.descripcion = Validacion.DBToString(ref reader, "desc_curso"); BeMaterial objMaterial = new BeMaterial(); objMaterial.id = Validacion.DBToInt32(ref reader, "materialid"); objMaterial.descripcion = Validacion.DBToString(ref reader, "desc_material"); objMaterial.curso = new BeCurso() { id = Validacion.DBToInt32(ref reader, "cursoid") }; obj.curso = objCurso; obj.lstMaterial.Add(objMaterial); } } catch (Exception ex) { clsException localException = new clsException(ex, "DalCursoMaterial -> ObtenerListadoMaterialPorCurso()"); } finally { if (helper != null) { helper.Dispose(); } } return(obj); }