Beispiel #1
0
 public static void AddProgramModif(PModif pModif)
 {
     paper.Add(pModif);
 }
Beispiel #2
0
        private List<PModif> DataSetToListModifProgram(DataSet Ds)
        {
            DataTable p_Data = Ds.Tables[0];
            // 返回值初始化
            List<PModif> result = new List<PModif>();
            for (int j = 0; j < p_Data.Rows.Count; j++)
            {

                PModif problem=new PModif(ProblemType.CProgramModification);
                PLanguage language = (PLanguage)Convert.ToInt32(p_Data.Rows[j]["Language"]);
                switch (language)
                {
                    case PLanguage.C:
                        problem = new PModif(ProblemType.CProgramModification);
                        break;
                    case PLanguage.CPP:
                        problem = new PModif(ProblemType.CppProgramModification);
                        break;
                    case PLanguage.VB:
                        problem = new PModif(ProblemType.VbProgramModification);
                        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<PModif> GetPModifProbelm()
 {
     List<PModif> list = new List<PModif>();
     foreach (XmlNode xnn in xd.ChildNodes.Item(1).ChildNodes)
     {
         if (xnn.Name == "CProgramModification")
         {
             PModif c = new PModif(ProblemType.CProgramModification);
             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 == "CppProgramModification")
         {
             PModif c = new PModif(ProblemType.CppProgramModification);
             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 == "VbProgramModification")
         {
             PModif c = new PModif(ProblemType.VbProgramModification);
             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;
 }