public IEnumerable <LesNotes> notesMod(string idMod)
        {
            eleveDAO = new EleveDAO("eleves");
            string req = "select e.nom,e.prenom,ma.codeMat,ma.codeModule,mo.code_Fil,n.note "
                         + "from eleves e,matieres ma, modules mo ,notes n "
                         + "where ma.codeModule = mo.codeModule "
                         + "and n.codeElev = e.codeElev "
                         + "and n.codeMat = ma.codeMat and mo.codeModule='" + idMod + "' ";
            List <Dictionary <string, string> > data = new List <Dictionary <string, string> >();

            data = eleveDAO.Select(req);
            List <LesNotes> les_notes = new List <LesNotes>();

            foreach (Dictionary <string, string> elt in data)
            {
                LesNotes m = new LesNotes(elt["nom"], elt["prenom"], elt["codeMat"],
                                          elt["codeModule"], elt["code_Fil"], elt["note"]);
                les_notes.Add(m);
            }
            int length = les_notes.Count;

            return(Enumerable.Range(0, length).Select(index => new LesNotes {
                Nom = les_notes[index].Nom,
                Prenom = les_notes[index].Prenom,
                CodeMat = les_notes[index].CodeMat,
                CodeModule = les_notes[index].CodeModule,
                CodeFiliere = les_notes[index].CodeFiliere,
                Note = les_notes[index].Note
            }));
        }
예제 #2
0
        public IEnumerable <Absence> absences(string codeMat)
        {
            eleveDAO = new EleveDAO("eleves");
            int    length  = codeMat.Length;
            char   niveau  = codeMat[length - 3];
            string filiere = codeMat.Substring(0, length - 3);
            string req     = "select e.codeElev,e.nom,e.prenom " +
                             "from eleves e " +
                             " where e.niveau=" + niveau + " and e.code_fil='" + filiere + "';";
            List <Dictionary <string, string> > data = new List <Dictionary <string, string> >();

            data = eleveDAO.Select(req);
            if (data != null)
            {
                List <Absence> absences_list = new List <Absence>();
                foreach (Dictionary <string, string> elt in data)
                {
                    Absence a = new Absence(elt["codeElev"], elt["nom"], elt["prenom"]);
                    absences_list.Add(a);
                }
                length = absences_list.Count;
                return(Enumerable.Range(0, length).Select(index => new Absence {
                    Nom = absences_list[index].Nom,
                    Prenom = absences_list[index].Prenom,
                    CodeEleve = absences_list[index].CodeEleve
                }));
            }
            else
            {
                return(Enumerable.Range(0, 1).Select(index => new Absence {
                    Nom = "",
                    Prenom = "",
                    CodeEleve = ""
                }));
            }
        }