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 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"); } }