Exemplo n.º 1
0
        public static List <ExamResult> GetResultsByExam(DBConnection connection, int examId)
        {
            SqlCommand command = connection.GetCommand(ExamResultTable.SQL_SELECT_EXAMRESULTS_BY_EXAM);

            command.AddParameter("@examId", SqlDbType.Int, examId);

            using (SqlDataReader reader = command.ExecuteReader())
            {
                List <ExamResult> results = new List <ExamResult>();

                while (reader.Read())
                {
                    results.Add(ExamResultTable.ReadExamResult(reader));
                }

                return(results);
            }
        }
Exemplo n.º 2
0
        public static ExamResult GetExamResultById(DBConnection connection, int examResultId)
        {
            SqlCommand command = connection.GetCommand(ExamResultTable.SQL_SELECT_EXAMRESULT_BY_ID);

            command.AddParameter("@examResultId", SqlDbType.Int, examResultId);

            using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.SingleRow))
            {
                if (reader.HasRows)
                {
                    reader.Read();

                    return(ExamResultTable.ReadExamResult(reader, examResultId));
                }
                else
                {
                    throw new DatabaseException("Tento výsledek testu nebyl nalezen");
                }
            }
        }
Exemplo n.º 3
0
 public ExamResult GetExamResult(DBConnection connection)
 {
     return(ExamResultTable.GetExamResultById(connection, this.ExamResultId));
 }
Exemplo n.º 4
0
 public static List <ExamResult> GetResultsByExam(DBConnection connection, Exam exam)
 {
     return(ExamResultTable.GetResultsByExam(connection, exam.Id));
 }
Exemplo n.º 5
0
 private static ExamResult ReadExamResult(SqlDataReader reader)
 {
     return(ExamResultTable.ReadExamResult(reader, (int)reader.GetColumnValue <decimal>("examResultId")));
 }