/// <summary> /// 初始化试题 /// </summary> public void InitTopic() { string sHint = ""; string sInitInfo = ""; M_TopicType aTopicType = new M_TopicType(); for (int i = 0; i < PublicClass.oPaperInfo.TopicTypes.Count; i++) { aTopicType = PublicClass.oPaperInfo.TopicTypes[i]; //基础题型ID为500,即为“操作题” if (aTopicType.BasicTypeId == "500") { //对所有操作题逐题进行初始化 for (int j = 0; j < aTopicType.Topics.Count; j++) { if (aTopicType.Topics[j].BasicTypeId == "500") { sHint = string.Format("正在初始化 {0} 中的第 {1} 题...", aTopicType.Name, j + 1); lblMessage.Text = sHint; Application.DoEvents(); Thread.Sleep(500); //初始化试题 sInitInfo = PublicClass.SowerExamPlugn.InitTopic(PublicClass.StudentDir, PublicClass.ExamSysDir, PublicClass.StudentCode, false, int.Parse(aTopicType.Id), int.Parse(aTopicType.Topics[j].TopicId)); if (sInitInfo == "") { MessageBox.Show(string.Format("{0}题型中的第 {1} 题(编号:{2})初始化失败,按【确定】退出系统。", aTopicType.Name, j + 1, aTopicType.Topics[j].TopicId)); return; } Thread.Sleep(10); } } } else { //对非操作题仅显示初始化进度,无实际工作 for (int j = 0; j < aTopicType.Topics.Count; j++) { sHint = string.Format("正在初始化 {0} 中的第 {1} 题...", aTopicType.Name, j + 1); Thread.Sleep(10); } } } }
public List <M_TopicType> GetTopicType() { string sql = "select * from T_题型 where 是否抽取 <> '0'"; List <M_TopicType> topicType = new List <M_TopicType>(); SQLiteHelper.InitialConnection(PublicClass.TopicDBFileName_SDBT); using (SQLiteDataReader reader = SQLiteHelper.ExecuteReader(sql)) { while (reader.Read()) { M_TopicType entity = new M_TopicType(); entity.Id = reader["题型ID"].ToString(); entity.Name = reader["题型"].ToString(); entity.BasicTypeId = reader["基础题型ID"].ToString(); entity.JudgeEngineId = reader["评判引擎ID"].ToString(); topicType.Add(entity); } } return(topicType); }