Beispiel #1
0
 public static void AddProgramCompletion(PCompletion pCompletion)
 {
     paper.Add(pCompletion);
 }
Beispiel #2
0
        private List<PCompletion> DataSetToListCompletionProgram(DataSet Ds)
        {
            DataTable p_Data = Ds.Tables[0];
            // 返回值初始化
            List<PCompletion> result = new List<PCompletion>();
            for (int j = 0; j < p_Data.Rows.Count; j++)
            {
                PCompletion problem=new PCompletion(ProblemType.CProgramCompletion);
                PLanguage language = (PLanguage)Convert.ToInt32(p_Data.Rows[j]["Language"]);
                switch (language)
                {
                    case PLanguage.C:
                        problem = new PCompletion(ProblemType.CProgramCompletion);
                        break;
                    case PLanguage.CPP:
                        problem = new PCompletion(ProblemType.CppProgramCompletion);
                        break;
                    case PLanguage.VB:
                        problem = new PCompletion(ProblemType.VbProgramCompletion);
                        break;
                }
                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 i = 0; i < p_Data.Columns.Count; i++)
                //{
                //    if (p_Data.Columns[i].ToString() == "Id")
                //        problem.problemId = Convert.ToInt32(p_Data.Rows[j][i]);
                //    if (p_Data.Columns[i].ToString() == "Problem_Content")
                //        problem.problem = (string)p_Data.Rows[j][i];
                //    if (p_Data.Columns[i].ToString() == "File_Path")
                //        problem.path = (string)p_Data.Rows[j][i];
                //    if (p_Data.Columns[i].ToString() == "K1")
                //        problem.ans1 = (string)p_Data.Rows[j][i];
                //    if (p_Data.Columns[i].ToString() == "K2")
                //        problem.ans2 = (string)p_Data.Rows[j][i];
                //    if (p_Data.Columns[i].ToString() == "K3")
                //        problem.ans3 = (string)p_Data.Rows[j][i];
                //    if (p_Data.Columns[i].ToString() == "Kind")
                //        problem.kind = (bool)p_Data.Rows[j][i];

                //}

                result.Add(problem);
            }
            return result;
        }
Beispiel #3
0
 private List<ProgramProblem> DataSetToListProgram(DataSet Ds)
 {
     DataTable p_Data = Ds.Tables[0];
     // 返回值初始化
     List<ProgramProblem> result = new List<ProgramProblem>();
     for (int j = 0; j < p_Data.Rows.Count; j++)
     {
         ProgramProblem problem = new ProgramProblem();
         PLanguage language=(PLanguage)Convert.ToInt32(p_Data.Rows[j]["Language"]);
         ProgramPType type = (ProgramPType)Convert.ToInt32(p_Data.Rows[j]["Type"]);
         switch (language)
         {
             case PLanguage.C:
                 switch (type)
                 {
                     case ProgramPType.Completion:
                         problem = new PCompletion(ProblemType.CProgramCompletion);
                         break;
                     case ProgramPType.Modify:
                         problem = new PModif(ProblemType.CProgramModification);
                         break;
                     case ProgramPType.Function:
                         problem = new PFunction(ProblemType.CProgramFun);
                         break;
                 }
                 break;
             case PLanguage.CPP:
                 switch (type)
                 {
                     case ProgramPType.Completion:
                         problem = new PCompletion(ProblemType.CppProgramCompletion);
                         break;
                     case ProgramPType.Modify:
                         problem = new PModif(ProblemType.CppProgramModification);
                         break;
                     case ProgramPType.Function:
                         problem = new PFunction(ProblemType.CppProgramFun);
                         break;
                 }
                 break;
             case PLanguage.VB:
                 switch (type)
                 {
                     case ProgramPType.Completion:
                         problem = new PCompletion(ProblemType.VbProgramCompletion);
                         break;
                     case ProgramPType.Modify:
                         problem = new PModif(ProblemType.VbProgramModification);
                         break;
                     case ProgramPType.Function:
                         problem = new PFunction(ProblemType.VbProgramFun);
                         break;
                 }
                 break;
         }
         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"]);
         result.Add(problem);
     }
     return result;
 }
Beispiel #4
0
 public List<PCompletion> GetPCompletionProbelm()
 {
     List<PCompletion> list = new List<PCompletion>();
     foreach (XmlNode xnn in xd.ChildNodes.Item(1).ChildNodes)
     {
         if (xnn.Name == "CProgramCompletion")
         {
             PCompletion c = new PCompletion(ProblemType.CProgramCompletion);
             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);
         }
         else if(xnn.Name == "CppProgramCompletion")
         {
             PCompletion c = new PCompletion(ProblemType.CppProgramCompletion);
             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);
         }
         else if (xnn.Name == "VbProgramCompletion")
         {
             PCompletion c = new PCompletion(ProblemType.VbProgramCompletion);
             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;
 }