Ejemplo n.º 1
0
        public void FetchAllQuestions()
        {
            List <QuestionsClass> QuestionsList = new List <QuestionsClass>();

            using (SqlCommand cmd = new SqlCommand("FetchAllQuestions", db.DbConnect()))
            {
                cmd.CommandType = CommandType.StoredProcedure;

                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    QuestionsClass questions = new QuestionsClass();
                    questions.DepartmentName = questions.FetchDeptById(Convert.ToInt16(rdr["dept_id"].ToString()));
                    questions.SemId          = Convert.ToInt16(rdr["sem_id"].ToString());
                    questions.SubjectName    = questions.FetchSubjectById(Convert.ToInt16(rdr["subject_id"].ToString()));
                    questions.QuestionType   = questions.DetermineQuestionType(Convert.ToInt16(rdr["question_type"].ToString()));
                    questions.Question       = rdr["question"].ToString();
                    questions.OptionA        = rdr["opt_a"].ToString();
                    questions.OptionB        = rdr["opt_b"].ToString();
                    questions.OptionC        = rdr["opt_c"].ToString();
                    questions.OptionD        = rdr["opt_d"].ToString();
                    questions.CorrectAns     = rdr["correct_ans"].ToString();
                    questions.Marks          = Convert.ToInt16(rdr["marks"].ToString());
                    QuestionsList.Add(questions);
                }
            }
            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.Write(js.Serialize(QuestionsList));
        }
Ejemplo n.º 2
0
        public string DetermineQType(string QTypeString)
        {
            int QTypeInt = Convert.ToInt16(QTypeString);

            return(question.DetermineQuestionType(QTypeInt));
        }