protected void Page_Load(object sender, EventArgs e) { Student s = (Student)Session["user"]; if (s != null) { welcomeInfo.InnerHtml = "欢迎你," + s.Name; } DepartmentService ds = new DepartmentService(); IList<School> schoolList = ds.getSchoolList(); if (schoolList != null && schoolList.Count > 0) { SchoolContent.InnerHtml = "<h1>" + schoolList[0].Name + "</h1>" + "<p class='lead'>" + schoolList[0].SimpleDescript + "</p>"; } IList<Faculty> facultyList = ds.getFacultyList(); string content1 = ""; string content2 = ""; for (int i = 0; i < facultyList.Count; i++) { Faculty faculty = facultyList[i]; if (i < 3) { content1 += "<h4>" + faculty.Name + "</h4>"; content1 += "<p>" + faculty.SimpleDescript + "</p>"; } else if (i > 2 && i < 6) { content2 += "<h4>" + faculty.Name + "</h4>"; content2 += "<p>" + faculty.SimpleDescript + "</p>"; } } FacultyColumn1.InnerHtml = content1; FacultyColumn2.InnerHtml = content2; }
public void addSchool() { try { School s = new School(); DepartmentService ds = new DepartmentService(); ds.save(s); context.Response.Write("1"); } catch (Exception e) { context.Response.Write("0"); } }
public void getClassGradeCombo() { string professionID = context.Request.QueryString["professionID"]; DepartmentService ds = new DepartmentService(); ISet<ClassGrade> classGradeList = ds.getClassGradeSet(professionID); if (classGradeList.Count > 0) { String json = JsonConvert.SerializeObject(classGradeList); context.Response.Write(json); } else { context.Response.Write("[{}]"); } }
public void addStudent() { try { Student student = new Student(); setValue(student, context); HttpPostedFile hpf = context.Request.Files["headImgFile"]; if (hpf != null) { string serverPath = "/uploadFile/headImg/" + System.DateTime.Now.Ticks + "." + hpf.FileName.Split('.')[1]; string savePath = context.Server.MapPath(serverPath);//路径,相对于服务器当前的路径 hpf.SaveAs(savePath);//保存 student.HeadImage = serverPath; } string FacultyID = context.Request.Form.Get("Faculty"); DepartmentService ds = new DepartmentService(); string professionID = context.Request.Form.Get("Profession"); if (!string.IsNullOrEmpty(professionID)) { Profession profession = ds.getProfessionByID(professionID); if (profession != null) student.Profession = profession; } string ClassGradeID = context.Request.Form.Get("ClassGrade"); if (!string.IsNullOrEmpty(ClassGradeID)) { ClassGrade classGrade = ds.getClassGradeByID(ClassGradeID); if (classGrade != null) student.ClassGrade = classGrade; } StudentService s = new StudentService(); student.Password = student.Sn; s.save(student); context.Response.Write("1"); } catch (Exception e) { context.Response.Write("0"); } }
public void getColumn() { DepartmentService ds = new DepartmentService(); IList professionList = new ArrayList(); string ProfessionID = context.Request.Form.Get("ProfessionID"); string YearNo = context.Request.Form.Get("YearNo"); string LevelNo = context.Request.Form.Get("LevelNo"); if (!string.IsNullOrEmpty(ProfessionID)) { Profession profession = ds.getProfessionByID(ProfessionID); professionList.Add(profession); } PlanService ps = new PlanService(); object[] planObjArr = ps.searchPlan(professionList, YearNo, LevelNo, int.MaxValue, 1); if (planObjArr[1] != null) { IList<ExamPlan> examPlanList = (IList<ExamPlan>)planObjArr[1]; if (examPlanList == null) return; ExamPlan ep = examPlanList.ElementAt(0); ArrayList newArrayList = new ArrayList(); if (examPlanList.ElementAt(0).CouresSet == null) return; foreach (Coures c in examPlanList.ElementAt(0).CouresSet) { newArrayList.Add(c.Name); } newArrayList.Sort(); IList<Hashtable> columnList = new List<Hashtable>(); foreach (string s in newArrayList) { Hashtable ht = new Hashtable(); ht.Add("columnName",s); columnList.Add(ht); } String json = JsonConvert.SerializeObject(columnList); context.Response.Write(json); } }
public void updateStudent() { try { Student student = new Student(); setValue(student, context); HttpPostedFile hpf = context.Request.Files["headImgFile"]; if (hpf != null) { string savepath = context.Server.MapPath("/uploadFile/headImg/" + student.Id + "." + hpf.GetType());//路径,相对于服务器当前的路径 hpf.SaveAs(savepath);//保存 student.HeadImage = savepath; } DepartmentService ds = new DepartmentService(); string professionID = context.Request.Form.Get("Profession"); if (!string.IsNullOrEmpty(professionID)) { Profession profession = ds.getProfessionByID(professionID); if (profession != null) student.Profession = profession; } string ClassGradeID = context.Request.Form.Get("ClassGrade"); if (!string.IsNullOrEmpty(ClassGradeID)) { ClassGrade classGrade = ds.getClassGradeByID(ClassGradeID); if (classGrade != null) student.ClassGrade = classGrade; } StudentService s = new StudentService(); s.save(student); context.Response.Write("1"); } catch (Exception e) { context.Response.Write("0"); } }
public void getStudents() { try { StudentService service = new StudentService(); Student student = new Student(); setValue(student, context); string ProfessionID = context.Request.Form.Get("FacultyID"); string FacultyID = context.Request.Form.Get("ProfessionID"); IList<Profession> professionList = new List<Profession>(); DepartmentService ds = new DepartmentService(); if (!string.IsNullOrEmpty(ProfessionID)) { Profession profession = ds.getProfessionByID(ProfessionID); if (profession != null) professionList.Add(profession); } else if (!string.IsNullOrEmpty(FacultyID)) { Faculty faculty = ds.getFacultyByID(FacultyID); if (faculty != null && faculty.professionList != null) foreach (Profession p in faculty.professionList) professionList.Add(p); } student.ProfessionList = professionList; int rows = Convert.ToInt32(context.Request.Form["rows"]); int page = Convert.ToInt32(context.Request.Form["page"]); object[] data = service.getStudentList(student, rows, page); Hashtable ht = new Hashtable(); ht.Add("total", data[0]); ht.Add("rows", data[1]); String json = JsonConvert.SerializeObject(ht); context.Response.Write(json); } catch (Exception e) { } }
private void searchCoures() { System.Collections.IList professionList = new ArrayList(); string FacultyID = context.Request.Form.Get("FacultyID"); string ProfessionID = context.Request.Form.Get("ProfessionID"); string YearNo = context.Request.Form.Get("YearNo"); string LevelNo = context.Request.Form.Get("LevelNo"); if (!string.IsNullOrEmpty(ProfessionID)) { DepartmentService ds = new DepartmentService(); Profession p = ds.getProfessionByID(ProfessionID); professionList.Add(p); }else if(!string.IsNullOrEmpty(FacultyID)){ DepartmentService ds = new DepartmentService(); Iesi.Collections.Generic.ISet<Profession> iset = ds.getProfessionSet(FacultyID); foreach(Profession pf in iset){ professionList.Add(pf); } } CouresService cs = new CouresService(); int rows = Convert.ToInt32(context.Request.Form["rows"]); int page = Convert.ToInt32(context.Request.Form["page"]); object[] data = cs.searchCoures(professionList, YearNo, LevelNo, rows, page); Hashtable ht = new Hashtable(); ht.Add("total", data[0]); ht.Add("rows", data[1]); String json = JsonConvert.SerializeObject(ht); context.Response.Write(json); }
private void saveCoures() { try { string professionID = context.Request.Form.Get("profession"); DepartmentService ds = new DepartmentService(); Profession profession = ds.getProfessionByID(professionID); if (profession != null) { Coures c = new Coures(); setValue(c, context); c.Profession = profession; ds.save(c); context.Response.Write("1"); } } catch (Exception e) { context.Response.Write("0"); } }
public void getProfessionCombo() { string facultyID = context.Request.QueryString["facultyID"]; DepartmentService ds = new DepartmentService(); ISet<Profession> professionList = ds.getProfessionSet(facultyID); if (professionList.Count > 0) { String json = JsonConvert.SerializeObject(professionList); context.Response.Write(json); } else { context.Response.Write("[{}]"); } }
private void saveCoures() { try { string ProfessionID = context.Request.Form.Get("Profession"); string FacultyID = context.Request.Form.Get("Faculty"); DepartmentService ds = new DepartmentService(); Profession profession = ds.getProfessionByID(ProfessionID); Faculty faculty = ds.getFacultyByID(FacultyID); if (profession != null && faculty != null) { ISet<Coures> couresSet = new HashedSet<Coures>(); string[] couresArr = context.Request.Form.GetValues("Coures"); CouresService cs = new CouresService(); foreach (string c in couresArr) { Coures coures = cs.getCouresByID(c); if (coures != null) couresSet.Add(coures); } ExamPlan p = new ExamPlan(); setValue(p, context); p.Profession = profession; p.Faculty = faculty; p.CouresSet = couresSet; PlanService ps = new PlanService(); ps.save(p); context.Response.Write("1"); } } catch (Exception e) { context.Response.Write("0"); } }
public void getDepartmentTree() { DepartmentService ds = new DepartmentService(); IList<EasyuiTree> list = ds.getDepartmentTree(); String json = JsonConvert.SerializeObject(list); context.Response.Write(json); }
private void saveDepartment() { try { string type = context.Request.Form.Get("type"); if (type == null) return; string pId = context.Request.Form.Get("pId"); DepartmentService ds = new DepartmentService(); switch (type) { case "学校": School school = (School)colectionParameter(typeof(School)); ds.save(school); break; case "院系": School s = (School)ds.get(typeof(School), pId); Faculty faculty = (Faculty)colectionParameter(typeof(Faculty)); faculty.School = s; ds.save(faculty); break; case "专业": Faculty f = (Faculty)ds.get(typeof(Faculty), pId); Profession profession = (Profession)colectionParameter(typeof(Profession)); profession.Faculty = f; ds.save(profession); break; case "班级": Profession p = (Profession)ds.get(typeof(Profession), pId); ClassGrade classGrade = (ClassGrade)colectionParameter(typeof(ClassGrade)); classGrade.Profession = p; ds.save(classGrade); break; } context.Response.Write("1"); } catch (Exception e) { context.Response.Write("0"); } }
private void getDepartment() { string type = context.Request.Form.Get("type"); if (type == null) return; string id = context.Request.Form.Get("Id"); String json = ""; DepartmentService ds = new DepartmentService(); switch (type) { case "学校": School school = (School)ds.get(typeof(School), id); json = JsonConvert.SerializeObject(school); break; case "院系": Faculty faculty = (Faculty)ds.get(typeof(Faculty), id); json = JsonConvert.SerializeObject(faculty); break; case "专业": Profession profession = (Profession)ds.get(typeof(Profession), id); json = JsonConvert.SerializeObject(profession); break; case "班级": ClassGrade classGrade = (ClassGrade)ds.get(typeof(ClassGrade), id); json = JsonConvert.SerializeObject(classGrade); break; } context.Response.Write(json); }
private void deleteDepartment() { try { string type = context.Request.Form.Get("type"); if (type == null) return; string id = context.Request.Form.Get("Id"); DepartmentService ds = new DepartmentService(); switch (type) { case "学校": School school = (School)ds.get(typeof(School), id); ds.del(school); break; case "院系": Faculty faculty = (Faculty)ds.get(typeof(Faculty), id); ds.del(faculty); break; case "专业": Profession profession = (Profession)ds.get(typeof(Profession), id); ds.del(profession); break; case "班级": ClassGrade classGrade = (ClassGrade)ds.get(typeof(ClassGrade), id); ds.del(classGrade); break; } context.Response.Write("1"); } catch (Exception e) { context.Response.Write("0"); } }
private void searchExamResult() { DepartmentService ds = new DepartmentService(); IList professionList = new ArrayList(); string ProfessionID = context.Request.Form.Get("ProfessionID"); string YearNo = context.Request.Form.Get("YearNo"); string LevelNo = context.Request.Form.Get("LevelNo"); if (!string.IsNullOrEmpty(ProfessionID)) { Profession profession = ds.getProfessionByID(ProfessionID); professionList.Add(profession); } PlanService ps = new PlanService(); object[] planObjArr = ps.searchPlan(professionList, YearNo, LevelNo, int.MaxValue, 1); if (planObjArr[1] != null) { IList<ExamPlan> examPlanList = (IList<ExamPlan>)planObjArr[1]; if (examPlanList == null || examPlanList.Count == 0) return; ExamResultService ers = new ExamResultService(); IList<ExamPlan> planList = new List<ExamPlan>(); planList.Add(examPlanList[0]); object[] examResultObjArr = ers.searchExamResult(planList, int.MaxValue, 1); if (examResultObjArr[1] != null) { IList<ExamResult> examResultList = (IList<ExamResult>)examResultObjArr[1]; IList<Hashtable> examRsultMapList = new List<Hashtable>(); foreach (ExamResult er in examResultList) { Hashtable cht = new Hashtable(); cht.Add("Id", er.Id); cht.Add("StudentSN", er.StudentSN); cht.Add("StudentName", er.StudentName); cht.Add("ExamPlanName", er.ExamPlanName); if (er.CouresScoreMap != null) { ArrayList newArrayList = new ArrayList(); foreach (Coures c in planList.ElementAt(0).CouresSet) { newArrayList.Add(c.Name); } newArrayList.Sort(); foreach (string key in newArrayList) { if (er.CouresScoreMap.ContainsKey(key)) { cht.Add(key, er.CouresScoreMap[key]); } } } examRsultMapList.Add(cht); } Hashtable ht = new Hashtable(); ht.Add("total", examResultObjArr[0]); ht.Add("rows", examRsultMapList); String json = JsonConvert.SerializeObject(ht); context.Response.Write(json); } } }
private void searchPlan() { try { PlanService planService = new PlanService(); DepartmentService ds = new DepartmentService(); IList professionList = new ArrayList(); string ProfessionID = context.Request.Form.Get("ProfessionID"); string YearNo = context.Request.Form.Get("YearNo"); string LevelNo = context.Request.Form.Get("LevelNo"); if (!string.IsNullOrEmpty(ProfessionID)) { Profession profession = ds.getProfessionByID(ProfessionID); professionList.Add(profession); } int rows = Convert.ToInt32(context.Request.Form["rows"]); int page = Convert.ToInt32(context.Request.Form["page"]); object[] data = planService.searchPlan(professionList, YearNo, LevelNo, rows, page); Hashtable ht = new Hashtable(); ht.Add("total", data[0]); ht.Add("rows", data[1]); String json = JsonConvert.SerializeObject(ht); context.Response.Write(json); } catch (Exception e) { context.Response.Write("0"); } }
public void getFacultyCombo() { DepartmentService ds = new DepartmentService(); IList<Faculty> facultyList = ds.getFacultyList(); String json = JsonConvert.SerializeObject(facultyList); context.Response.Write(json); }