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 deleteCoures()
 {
     try
     {
         string CouresID = context.Request.Form.Get("CouresID");
         CouresService cs = new CouresService();
         cs.del(cs.getCouresByID(CouresID));
         context.Response.Write("1");
     }
     catch (Exception e)
     {
         context.Response.Write("0");
     }
 }
 private void getCouresByID()
 {
     try
     {
         string CouresID = context.Request.Form.Get("CouresID");
         CouresService cs = new CouresService();
         Coures coures = cs.getCouresByID(CouresID);
         String json = JsonConvert.SerializeObject(coures);
         context.Response.Write(json);
     }
     catch (Exception e)
     {
         context.Response.Write("0");
     }
 }
        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");
            }
        }