Example #1
0
        /// <summary>
        ///   filter tests by subject
        /// </summary>
        /// <param name="candidateID">to set take orders for each test</param>
        /// <param name="subject">subject for filtering</param>
        /// <returns>
        ///   arraylist of tests
        /// </returns>
        public static ArrayList getAllTestsBySubject(int candidateID, int subject)
        {
            CTVIATBankDataSet.TestsDataTable testTable =
                testsAdapter.GetAllTestsBySubject(subject);
            ArrayList tests = new ArrayList();

            foreach (DataRow row in testTable.Rows)
            {
                int testId = Convert.ToByte(row["testID"]);
                CTVIATBankDataSet.QuestionsTestsDataTable questionsTable =
                    questionsTestsAdapter.GetQuestionsOfTest(testId);

                Queue <Question> queue = new Queue <Question>();
                foreach (DataRow r in questionsTable.Rows)
                {
                    queue.Enqueue(getQuestionById(Convert.ToInt32(r["questionID"])));
                }

                CTVIATBankDataSet.TestsTakeOrderDataTable table =
                    testsTakeOrderAdapter.GetTakeOrder(candidateID, testId);

                int takeOrder = 0;
                if (table.Rows.Count > 0)
                {
                    takeOrder = Convert.ToInt32(table.Rows[0]["takeOrder"]);
                }

                tests.Add(new Test(testId, queue.ToArray(), subject,
                                   takeOrder, 0, true, 0, DateTime.Now));
            }
            return(tests);
        }
Example #2
0
        /// <summary>
        ///   to get questions of test
        /// </summary>
        /// <param name="testID">for which test</param>
        /// <returns>
        ///   array of questions that are included in the test
        /// </returns>
        public static Question[] getQuestionsOfTest(int testID)
        {
            Queue <Question> questions = new Queue <Question>();

            CTVIATBankDataSet.QuestionsTestsDataTable table =
                questionsTestsAdapter.GetQuestionsOfTest(testID);

            foreach (DataRow row in table)
            {
                questions.Enqueue(getQuestionById(Convert.ToInt32(row["questionID"])));
            }
            return(questions.ToArray());
        }
Example #3
0
        /// <summary>
        ///   to get incomplete test of candidate according to id since id is unique
        /// </summary>
        /// <param name="candidateID">which candidate</param>
        /// <param name="testId">which test</param>
        /// <returns>
        ///   test object with specified test ID
        /// </returns>
        public static Test getIncompleteTestById(int candidateID, int testId)
        {
            CTVIATBankDataSet.TestsDataTable testTable = testsAdapter.GetTestByID(testId);
            byte subject = Convert.ToByte(testTable.Rows[0]["testSubject"]);

            CTVIATBankDataSet.QuestionsTestsDataTable questionsTable =
                questionsTestsAdapter.GetQuestionsOfTest(testId);

            Queue <Question> queue = new Queue <Question>();

            foreach (DataRow row in questionsTable.Rows)
            {
                queue.Enqueue(getQuestionById(Convert.ToInt32(row["questionID"])));
            }
            return(new Test(testId, queue.ToArray(), subject, 0, 0, false, 0, DateTime.Now));
        }