Пример #1
0
        public static int AnswerCount(int questionID)
        {
            DataTable answerTable = new DataTable();

            try
            {
                answerTable = QuestionAnswersDAL.GetDatabyQuestionID(questionID);
                return(answerTable.Rows.Count);
            }
            catch
            {
                return(-1);
            }
        }
Пример #2
0
        public static int RightAnswerCount(int questionID)
        {
            DataTable answerTable      = new DataTable();
            int       rightAnswerCount = 0;

            try
            {
                answerTable = QuestionAnswersDAL.GetDatabyQuestionID(questionID);
                for (int x = 0; x < answerTable.Rows.Count; x++)
                {
                    string test = answerTable.Rows[x]["right_answer"].ToString();
                    if (answerTable.Rows[x]["right_answer"].ToString() == "True")
                    {
                        rightAnswerCount++;
                    }
                }
                return(rightAnswerCount);
            }
            catch
            {
                return(-1);
            }
        }