public void SetQuestion(int x) { proID = x; completion = ClientControl.GetCompletion(proID); this.Question.Text = completion.problem; this.Answer.TextChanged -= Answer_TextChanged; this.Answer.Text = completion.stuAns; this.Answer.TextChanged += Answer_TextChanged; if (!string.IsNullOrEmpty(completion.stuAns)) { ClientControl.SetDone(completion.problemId); } }
public static void AddCompletion(Completion completion) { paper.Add(completion); }
/// <summary> /// DataSet装换为泛型集合 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="Ds">DataSet</param> /// <param name="DsAns">DataSet</param> /// <param name="p_TableIndex">待转换数据表索引</param> /// <returns></returns> private List<Completion> DataSetToListCompletion(DataSet Ds) { DataTable p_Data = Ds.Tables[0]; //DataTable p_DataAns = DsAns.Tables[0]; // 返回值初始化 List<Completion> result = new List<Completion>(); for (int j = 0; j < p_Data.Rows.Count; j++) { List<string> ans = new List<string>(); Completion problem = new Completion(); problem.problemId = Convert.ToInt32(p_Data.Rows[j]["PID"]); problem.problem = p_Data.Rows[j]["PContent"].ToString(); problem.unit.UnitId = Convert.ToInt32(p_Data.Rows[j]["Unit"]); problem.unit.UnitName = p_Data.Rows[j]["UnitName"].ToString(); problem.Plevel = Convert.ToInt32(p_Data.Rows[j]["PLevel"]); //for (int k = 0; k < p_DataAns.Rows.Count; k++) //{ // ans.Add((string)p_DataAns.Rows[k][0]); //} //problem.ans = ans; result.Add(problem); } return result; }
public List<Completion> GetCompletionProbelms() { List<Completion> list = new List<Completion>(); foreach (XmlNode xnn in xd.ChildNodes.Item(1).ChildNodes) { if (xnn.Name == "Completion") { Completion c = new Completion(); c.problemId = Convert.ToInt32(xnn.Attributes["ProblemId"].Value); c.orderId = Convert.ToInt32(xnn.Attributes["OrderId"].Value); foreach (XmlNode option in xnn.ChildNodes) { if (option.ChildNodes.Item(0) != null) { switch (option.Name) { case "Problem": c.problem = option.ChildNodes.Item(0).Value; break; } } } list.Add(c); } } return list; }