//========================================================================================== //==================================Additional functions==================================== //========================================================================================== //Load all topic from sql server public void loadTopicList() { topicList.Clear(); lbTopic.Items.Clear(); topicIDList.Clear(); BOTopic bot = new BOTopic(); topicList = bot.ListAll(); for (int i = 0; i < topicList.Count; i++) { lbTopic.Items.Add(topicList[i]); topicIDList.Add(topicList[i].TopicID); } lbTopic.Sorted = true; }
//==================================Additional functions==================================== //========================================================================================== //Load data from sql server public void loadData() { //Load topic BOTopic bot = new BOTopic(); topicList = bot.ListAll(); cbbTopic.DataSource = topicList; //Load questions and answers BOQuestion boq = new BOQuestion(); BOAnswer boa = new BOAnswer(); answerList = boa.ListAll(); questionList = boq.ListAll(); for (int i = 0; i < questionList.Count; i++) { questionList[i].Answers = new List<Answer>(); for (int j = 0; j < answerList.Count; j++) if (answerList[j].QCode == questionList[i].Code) { questionList[i].Answers.Add(answerList[j]); } } }