コード例 #1
0
 private void getPlanByID()
 {
     try
     {
         string ExamPlanID = context.Request.Form.Get("ExamPlanID");
         PlanService planService = new PlanService();
         ExamPlan examPlan = planService.getExamPlanByID(ExamPlanID);
         String json = JsonConvert.SerializeObject(examPlan);
         context.Response.Write(json);
     }
     catch (Exception e) {
         context.Response.Write("0");
     }
 }
コード例 #2
0
        private void initStudentResult()
        {
            try
            {
                string ExamPlanID = context.Request.Form.Get("ExamPlanID");
                PlanService planService = new PlanService();
                ExamPlan examPlan = planService.getExamPlanByID(ExamPlanID);

                IList<ExamPlan> examPlanList = new List<ExamPlan>();
                examPlanList.Add(examPlan);
                ExamResultService ers = new ExamResultService();
                object[] obj = ers.searchExamResult(examPlanList, int.MaxValue, 1);
                if (obj[1] != null) {
                    IList<ExamResult> examResultList = (IList<ExamResult>)obj[1];
                    foreach (ExamResult er in examResultList)
                    {
                      ers.del(er);
                    }
                }

                Student student = new Student();
                IList<Profession> professionList = new List<Profession>();
                professionList.Add(examPlan.Profession);
                student.ProfessionList = professionList;
                StudentService ss = new StudentService();
                object[] studentObjArr = ss.getStudentList(student, int.MaxValue, 1);

                if (studentObjArr[1] != null)
                {
                    IList<Student> studentList = (IList<Student>)studentObjArr[1];
                    foreach (Student s in studentList)
                    {
                        ExamResult examResult = new ExamResult();
                        examResult.ExamPlan = examPlan;
                        examResult.Student = s;
                        ers.save(examPlan);
                        IDictionary<string,string> map = new Dictionary<string,string>();
                        foreach (Coures c in examPlan.CouresSet)
                        {
                            map.Add(c.Name, "0");
                        }
                        examResult.CouresScoreMap = map;
                        ers.save(examResult);
                    }
                }
                context.Response.Write("1");
            }
            catch (Exception e)
            {
                context.Response.Write("0");
            }
        }
コード例 #3
0
 private void deleteExamPlan()
 {
     try
     {
         string ExamPlanID = context.Request.Form.Get("ExamPlanID");
         PlanService planService = new PlanService();
         ExamPlan examPlan = planService.getExamPlanByID(ExamPlanID);
         examPlan.CouresSet = null;
         planService.save(examPlan);
         planService.del(examPlan);
         context.Response.Write("1");
     }
     catch (Exception e)
     {
         context.Response.Write("0");
     }
 }