Ejemplo n.º 1
0
        public bool InsererSeance(EmploiObj seance)
        {
            using (var dbContext = new emploiEntities())
            {
                emploi emp = new emploi();

                emp.id_enseignant = seance.id_en;
                emp.id_creneau    = seance.id_creaneau;
                emp.id_salle      = seance.salle;
                emp.groupe        = seance.group;
                emp.section       = seance.section;
                emp.id_module     = seance.id_module;
                emp.est_supp      = seance.est_supp;
                dbContext.emplois.Add(emp);


                int changed = dbContext.SaveChanges();



                if (changed == 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
Ejemplo n.º 2
0
        public ArrayList acceder_emploi(int id_etudiant)
        {
            using (var dbContext = new emploiEntities()) {
                Console.WriteLine("in");
                var liste = (from ep in dbContext.utilisateurs
                             join e in dbContext.inscriptions on ep.id_utilisateur equals e.id_etudiant
                             join t in dbContext.modules on e.id_module equals t.id_module
                             join m in dbContext.emplois on t.id_module equals m.id_module
                             join s in dbContext.salles on m.id_salle equals s.id_salle
                             where e.id_etudiant == id_etudiant
                             select new
                {
                    creneau = m.id_creneau,
                    titre_module = t.designation,
                    type = s.type,
                    salle = s.num_salle
                }).ToList();

                ArrayList lt = new ArrayList();
                foreach (var item in liste)
                {
                    EmploiObj n = new EmploiObj();
                    n.id_creaneau = item.creneau;
                    n.module      = item.titre_module;
                    n.type        = item.type;
                    n.salle       = item.salle;
                    lt.Add(n);
                }

                return(lt);
            }
        }
Ejemplo n.º 3
0
 private void ajouterSeaBtn_Click(object sender, EventArgs e)
 {
     if (moduleDrop.selectedIndex != -1 && sectionDrop.selectedIndex != -1 && typeDrop.selectedIndex != -1 &&
         grDrop.selectedIndex != -1 && enDrop.selectedIndex != -1 && salleDrop.selectedIndex != -1 &&
         CreneauDrop.selectedIndex != -1 || moduleDrop.selectedIndex != -1 && sectionDrop.selectedIndex != -1 && typeDrop.selectedIndex != -1 &&
         grDrop.selectedIndex == -1 && enDrop.selectedIndex != -1 && salleDrop.selectedIndex != -1 &&
         CreneauDrop.selectedIndex != -1)
     {
         Boolean   ajoute = true;
         EmploiObj seance = new EmploiObj();
         String[]  tbl    = enDrop.selectedValue.Split(' ');
         seance.id_en     = Int32.Parse(tbl[0]);
         seance.id_module = modules[moduleDrop.selectedValue];
         seance.section   = Int32.Parse(sectionDrop.selectedValue);
         tbl = salleDrop.selectedValue.Split(' ');
         MessageBox.Show(tbl[tbl.Length - 1]);
         seance.salle       = salles[Int32.Parse(tbl[tbl.Length - 1])];
         seance.id_creaneau = listcr[CreneauDrop.selectedValue];
         if (est_suppBox.Checked)
         {
             seance.est_supp = 1;
         }
         if (typeDrop.selectedValue.Equals("Cours"))
         {
             ArrayList groupes = obj.acceder_Groupes(modules[moduleDrop.selectedValue], Int32.Parse(sectionDrop.selectedValue));
             foreach (String item in groupes)
             {
                 seance.group = Int32.Parse(item);
                 if (!obj.InsererSeance(seance))
                 {
                     ajoute = false;
                 }
             }
         }
         else
         {
             seance.group = Int32.Parse(grDrop.selectedValue);
             if (!obj.InsererSeance(seance))
             {
                 ajoute = false;
             }
         }
         if (ajoute)
         {
             MessageBox.Show("Seance ajoutée avec succés");
             this.Close();
         }
         else
         {
             MessageBox.Show("Seance non ajoutée");
         }
     }
     else
     {
         MessageBox.Show("veuillez remplir tout les champs");
     }
 }
Ejemplo n.º 4
0
        public ModifierSeance(IScolarite obj, EmploiObj seance)
        {
            ModifierSeance.seance = seance;
            m_aeroEnabled         = false;
            ModifierSeance.obj    = obj;
            InitializeComponent();

            listcr = obj.acceder_creneaux(loginForm.user.specialite, seance.niveau, seance.section);

            CreneauDrop.Clear();
            foreach (var item in listcr)
            {
                CreneauDrop.AddItem(item.Key);
            }
        }
Ejemplo n.º 5
0
        public ArrayList acceder_emploi(int?id_specialite, int niveau, int section)
        {
            ArrayList liste = new ArrayList();

            using (var dbContext = new emploiEntities())
            {
                var items = (from emp in dbContext.emplois
                             join m in dbContext.modules on emp.id_module equals m.id_module
                             join s in dbContext.salles on emp.id_salle equals s.id_salle
                             where m.id_specialite == id_specialite &&
                             m.niveau == niveau && emp.section == section
                             select new
                {
                    creneau = emp.id_creneau,
                    titre_module = m.designation,
                    type = s.type,
                    salle = s.num_salle,
                    niveau = m.niveau,
                    groupe = emp.groupe,
                    id_seance = emp.id_seance,
                    section = emp.section,
                    id_en = emp.id_enseignant
                }).ToList();
                ArrayList lt = new ArrayList();
                foreach (var item in items)
                {
                    EmploiObj n = new EmploiObj();
                    n.id_creaneau = item.creneau;
                    n.module      = item.titre_module;
                    n.type        = item.type;
                    n.salle       = item.salle;
                    n.niveau      = item.niveau;
                    n.group       = item.groupe;
                    n.id_seance   = item.id_seance;
                    n.section     = item.section;
                    n.id_en       = item.id_en;
                    lt.Add(n);
                }

                return(lt);
            }
        }
Ejemplo n.º 6
0
        public ArrayList Acceder_emploi(int id_enseignant)
        {
            using (var dbContext = new emploiEntities())
            {
                var liste = (from emp in dbContext.emplois
                             join m in dbContext.modules on emp.id_module equals m.id_module
                             join s in dbContext.salles on emp.id_salle equals s.id_salle

                             where emp.id_enseignant == id_enseignant orderby m.niveau ascending
                             select new
                {
                    creneau = emp.id_creneau,
                    titre_module = m.designation,
                    type = s.type,
                    salle = s.num_salle,
                    niveau = m.niveau,
                    groupe = emp.groupe,
                    id_seance = emp.id_seance,
                    section = emp.section
                }).ToList();

                ArrayList lt = new ArrayList();
                foreach (var item in liste)
                {
                    EmploiObj n = new EmploiObj();
                    n.id_creaneau = item.creneau;
                    n.module      = item.titre_module;
                    n.type        = item.type;
                    n.salle       = item.salle;
                    n.niveau      = item.niveau;
                    n.group       = item.groupe;
                    n.id_seance   = item.id_seance;
                    n.section     = item.section;
                    lt.Add(n);
                }

                return(lt);
            }
        }
Ejemplo n.º 7
0
 public static Boolean ShowBox(EmploiObj seance, IScolarite obj)
 {
     sBox = new ModifierSeance(obj, seance);
     sBox.ShowDialog();
     return(supp);
 }