Ejemplo n.º 1
0
        public List <PREGUNTA_EL> GetTestPREGUNTA(int iIdCapacitacion, int idUsuario)
        {
            using (SqlConnection con = new SqlConnection(ConexionUtil.Cadena))
            {
                con.Open();
                using (SqlCommand com = new SqlCommand("spGet_TestPregunta", con))
                {
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.Add("@iIdCapacitacion", SqlDbType.Int).Value = iIdCapacitacion;
                    com.Parameters.Add("@idUsuario", SqlDbType.Int).Value       = idUsuario;

                    List <PREGUNTA_EL> list = new List <PREGUNTA_EL>();

                    using (IDataReader dataReader = com.ExecuteReader())
                    {
                        while (dataReader.Read())
                        {
                            PREGUNTA_EL obj = new PREGUNTA_EL();

                            if (dataReader["iIdPregunta"] != DBNull.Value)
                            {
                                obj.iIdPregunta = (int)dataReader["iIdPregunta"];
                            }
                            if (dataReader["vEnunciadoPregunta"] != DBNull.Value)
                            {
                                obj.vEnunciadoPregunta = (string)dataReader["vEnunciadoPregunta"];
                            }
                            if (dataReader["iPuntajePregunta"] != DBNull.Value)
                            {
                                obj.iPuntajePregunta = (int)dataReader["iPuntajePregunta"];
                            }
                            if (dataReader["iTipoRespuestaPregunta"] != DBNull.Value)
                            {
                                obj.iTipoRespuestaPregunta = (int)dataReader["iTipoRespuestaPregunta"];
                            }
                            if (dataReader["FormatoRespuesta"] != DBNull.Value)
                            {
                                obj.FormatoRespuesta = (string)dataReader["FormatoRespuesta"];
                            }
                            list.Add(obj);
                        }
                    }

                    return(list);
                }
            }
        }
Ejemplo n.º 2
0
        public int InsertPREGUNTA(PREGUNTA_EL P)
        {
            using (SqlConnection con = new SqlConnection(ConexionUtil.Cadena))
            {
                con.Open();
                using (SqlCommand com = new SqlCommand("spInsertPREGUNTA", con))
                {
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.Add("@iIdTest", SqlDbType.Int).Value = P.iIdTest;
                    com.Parameters.Add("@vEnunciadoPregunta", SqlDbType.VarChar).Value = P.vEnunciadoPregunta;
                    com.Parameters.Add("@iPuntajePregunta", SqlDbType.Int).Value       = P.iPuntajePregunta;
                    com.Parameters.Add("@iTipoRespuestaPregunta", SqlDbType.Int).Value = P.iTipoRespuestaPregunta;
                    com.Parameters.Add("@iUsuarioCrea", SqlDbType.Int).Value           = P.iUsuarioCrea;

                    return(com.ExecuteNonQuery());
                }
            }
        }
Ejemplo n.º 3
0
 public int UpdatePREGUNTA(PREGUNTA_EL P)
 {
     return(PREGUNTA_DA.Accion.UpdatePREGUNTA(P));
 }
Ejemplo n.º 4
0
 public int InsertPREGUNTA(PREGUNTA_EL P)
 {
     return(PREGUNTA_DA.Accion.InsertPREGUNTA(P));
 }
Ejemplo n.º 5
0
        //================================================================

        // PREGUNTA ==================================================
        public List <PREGUNTA_EL> GetAllPREGUNTA(PREGUNTA_EL P)
        {
            return(PREGUNTA_DA.Accion.GetAllPREGUNTA(P));
        }
Ejemplo n.º 6
0
 public int Put(int id, PREGUNTA_EL value)
 {
     return(PREGUNTA_DA.Accion.UpdatePREGUNTA(value));
 }
Ejemplo n.º 7
0
 public int POST(PREGUNTA_EL value)
 {
     return(PREGUNTA_DA.Accion.InsertPREGUNTA(value));
 }
Ejemplo n.º 8
0
        public List <PREGUNTA_EL> GetAllPREGUNTA(PREGUNTA_EL P)
        {
            using (SqlConnection con = new SqlConnection(ConexionUtil.Cadena))
            {
                con.Open();
                using (SqlCommand com = new SqlCommand("spGet_PREGUNTA", con))
                {
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.Add("@iIdPregunta", SqlDbType.Int).Value = P.iIdPregunta;

                    List <PREGUNTA_EL> list = new List <PREGUNTA_EL>();

                    using (IDataReader dataReader = com.ExecuteReader())
                    {
                        while (dataReader.Read())
                        {
                            PREGUNTA_EL obj = new PREGUNTA_EL();

                            if (dataReader["iIdPregunta"] != DBNull.Value)
                            {
                                obj.iIdPregunta = (int)dataReader["iIdPregunta"];
                            }
                            if (dataReader["iIdTest"] != DBNull.Value)
                            {
                                obj.iIdTest = (int)dataReader["iIdTest"];
                            }
                            if (dataReader["vEnunciadoPregunta"] != DBNull.Value)
                            {
                                obj.vEnunciadoPregunta = (string)dataReader["vEnunciadoPregunta"];
                            }
                            if (dataReader["iPuntajePregunta"] != DBNull.Value)
                            {
                                obj.iPuntajePregunta = (int)dataReader["iPuntajePregunta"];
                            }
                            if (dataReader["iTipoRespuestaPregunta"] != DBNull.Value)
                            {
                                obj.iTipoRespuestaPregunta = (int)dataReader["iTipoRespuestaPregunta"];
                            }
                            if (dataReader["iUsuarioCrea"] != DBNull.Value)
                            {
                                obj.iUsuarioCrea = (int)dataReader["iUsuarioCrea"];
                            }
                            if (dataReader["dFechaCrea"] != DBNull.Value)
                            {
                                obj.dFechaCrea = (DateTime)dataReader["dFechaCrea"];
                            }
                            if (dataReader["iUsuarioMod"] != DBNull.Value)
                            {
                                obj.iUsuarioMod = (int)dataReader["iUsuarioMod"];
                            }
                            if (dataReader["dFechaMod"] != DBNull.Value)
                            {
                                obj.dFechaMod = (DateTime)dataReader["dFechaMod"];
                            }

                            list.Add(obj);
                        }
                    }

                    return(list);
                }
            }
        }