/// <summary> /// Overload of the constructor. Receives a IdExam and populates the instance with its values. /// </summary> /// <param name="id">The IdExam of the user to retrieve information from.</param> public Exam(int id) { List<Dictionary<string, string>> exam = Common.GetRS("SELECT * FROM Exam WHERE IdExam = " + id); foreach (Dictionary<string, string> record in exam) { IdExam = id; ExamName = record["Exam"]; Status = Convert.ToInt32(record["Status"]); SelfEnroll = Convert.ToInt32(record["SelfEnroll"]); MasteryScore = Convert.ToInt32(record["MasteryScore"]); Shuffle = Convert.ToInt32(record["Shuffle"]); QuestionsPerPage = Convert.ToInt32(record["QuestionsPerPage"]); Instructions = record["Instructions"]; MaxMins = Convert.ToInt32(record["MaxMins"]); } List<Dictionary<string, string>> examContentList = Common.GetRS("SELECT * FROM ExamContent WHERE IdExam = " + id + " ORDER BY QuestionSequence"); foreach (Dictionary<string, string> record in examContentList) { ExamContent examContent = new ExamContent(Convert.ToInt32(record["IdExamContent"])); examContents.Add(examContent); } }
/// <summary> /// Overload of the constructor. Receives a IdExam and populates the instance with its values. /// </summary> /// <param name="id">The IdExam of the user to retrieve information from.</param> public Exam(int id) { List <Dictionary <string, string> > exam = Common.GetRS("SELECT * FROM Exam WHERE IdExam = " + id); foreach (Dictionary <string, string> record in exam) { IdExam = id; ExamName = record["Exam"]; Status = Convert.ToInt32(record["Status"]); SelfEnroll = Convert.ToInt32(record["SelfEnroll"]); MasteryScore = Convert.ToInt32(record["MasteryScore"]); Shuffle = Convert.ToInt32(record["Shuffle"]); QuestionsPerPage = Convert.ToInt32(record["QuestionsPerPage"]); Instructions = record["Instructions"]; MaxMins = Convert.ToInt32(record["MaxMins"]); } List <Dictionary <string, string> > examContentList = Common.GetRS("SELECT * FROM ExamContent WHERE IdExam = " + id + " ORDER BY QuestionSequence"); foreach (Dictionary <string, string> record in examContentList) { ExamContent examContent = new ExamContent(Convert.ToInt32(record["IdExamContent"])); examContents.Add(examContent); } }