public List <BePregunta> ObtenerListadoPreguntaPorCurMat(Int32 cursoid, Int32 materialid)
        {
            List <BePregunta> listado = new List <BePregunta>();
            DatabaseHelper    helper  = null;
            SqlDataReader     reader  = null;

            try
            {
                helper = new DatabaseHelper(DalConexion.getConexion());
                helper.AddParameter("@P_CURSOID", cursoid);
                helper.AddParameter("@P_MATERIALID", materialid);
                reader = (SqlDataReader)helper.ExecuteReader("spr_ObtenerListadoPreguntaPorCurMat", System.Data.CommandType.StoredProcedure);
                while (reader.Read())
                {
                    BePregunta obj = new BePregunta();
                    obj.id          = Validacion.DBToInt32(ref reader, "preguntaid");
                    obj.descripcion = Validacion.DBToString(ref reader, "desc_pregunta");
                    listado.Add(obj);
                }
            }
            catch (Exception ex)
            {
                clsException localException = new clsException(ex, "DalPregunta -> ObtenerListadoPreguntaPorCurMat()");
            }
            finally
            {
                if (helper != null)
                {
                    helper.Dispose();
                }
            }
            return(listado);
        }
Пример #2
0
        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);
        }
Пример #3
0
        public List <BeRespuesta> ObtenerRespuestasByPregunta(Int32 preguntaid)
        {
            List <BeRespuesta> listado = new List <BeRespuesta>();
            DatabaseHelper     helper  = null;
            SqlDataReader      reader  = null;

            try
            {
                helper = new DatabaseHelper(DalConexion.getConexion());
                helper.AddParameter("@P_PREGUNTAID", preguntaid);
                reader = (SqlDataReader)helper.ExecuteReader("spr_ObtenerRespuestasByPregunta", System.Data.CommandType.StoredProcedure);
                while (reader.Read())
                {
                    BeRespuesta obj = new BeRespuesta();
                    obj.id          = Validacion.DBToInt32(ref reader, "id_respuesta");
                    obj.descripcion = Validacion.DBToString(ref reader, "desc_respuesta");
                    listado.Add(obj);
                }
            }
            catch (Exception ex)
            {
                clsException localException = new clsException(ex, "DalRespuesta -> ObtenerRespuestasByPregunta()");
            }
            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);
        }