private void saveExamResult() { try{ string[] keys = context.Request.Form.AllKeys; ExamResultService res = new ExamResultService(); ExamResult er = res.getExamResultByID(context.Request.Form.Get("Id")); IDictionary<string, string> map = new Dictionary<string, string>(); foreach (string s in keys) { if (!s.Equals("Id") && !s.Equals("StudentSN") && !s.Equals("StudentName") && !s.Equals("ExamPlanName")) { map.Add(s, context.Request.Form.Get(s)); } } er.CouresScoreMap = map; res.save(er); context.Response.Write("1"); } catch (Exception e) { context.Response.Write("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"); } }