Exemple #1
0
 public static void AddOfficeExcel(OfficeExcel excel)
 {
     paper.Add(excel);
 }
Exemple #2
0
 public List<OfficeExcel> FindOfficeExcelByPID(int PID)
 {
     List<OfficeExcel> result = new List<OfficeExcel>();
     List<Office> tmp = new List<Office>();
     try
     {
         tmp = FindOfficeByPID(PID);
     }
     catch (SqlException ex)
     {
         Console.WriteLine(ex.ToString());
     }
     foreach (Office prob in tmp)
     {
         OfficeExcel oe = new OfficeExcel();
         oe.Plevel = prob.Plevel;
         oe.problem = prob.problem;
         oe.problemId = prob.problemId;
         oe.type = prob.type;
         oe.unit = prob.unit;
         result.Add(oe);
     }
     return result;
 }
Exemple #3
0
        private List<OfficeExcel> DataSetToListOfficeExcel(DataSet Ds)
        {
            DataTable p_Data = Ds.Tables[0];
            // 返回值初始化
            List<OfficeExcel> excel = new List<OfficeExcel>();
            for (int j = 0; j < p_Data.Rows.Count; j++)
            {
                OfficeExcel problem = new OfficeExcel();
                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"]);

                excel.Add(problem);
            }
            return excel;
        }
Exemple #4
0
        private List<Office> DataSetToListOffice(DataSet Ds)
        {
            DataTable p_Data = Ds.Tables[0];
            List<Office> office = new List<Office>();
            for (int j = 0; j < p_Data.Rows.Count; j++)
            {
                Office problem = new Office();
                switch ((Office.OfficeType)Convert.ToInt32(p_Data.Rows[j]["Type"]))
                {
                    case Office.OfficeType.Word:
                        {
                            problem=new OfficeWord();
                            problem.type=ProblemType.Word;
                            break;
                        }
                    case Office.OfficeType.Excel:
                        {
                            problem = new OfficeExcel();
                            problem.type = ProblemType.Excel;
                            break;
                        }
                    case Office.OfficeType.PowerPoint:
                        {
                            problem = new OfficePowerPoint();
                            problem.type = ProblemType.PowerPoint;
                            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"]);

                office.Add(problem);
            }
            return office;
        }
Exemple #5
0
 public List<OfficeExcel> GetExcelProbelm()
 {
     List<OfficeExcel> list = new List<OfficeExcel>();
     foreach (XmlNode xnn in xd.ChildNodes.Item(1).ChildNodes)
     {
         if (xnn.Name == "Excel")
         {
             OfficeExcel c = new OfficeExcel();
             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;
 }
Exemple #6
0
 public void SetQuestion(int x)
 {
     SaveOpenedFiles.CloseExcel();
     proID = x;
     excel = ClientControl.GetOfficeExcel(proID);
     this.Question.Text = excel.problem;
     this.filename = "e" + proID.ToString() + ".xls";
 }