Beispiel #1
0
        public override Annee find(string nom)
        {
            Annee annee = null;

            using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_departement, description FROM annee WHERE nom='" + nom + "';", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <Departement>  TPSQL    = factoSQL.getDepartementDAO();

                            Departement dep2 = TPSQL.find(reader_f.GetInt32(2));

                            annee = new Annee(reader_f.GetInt32(0), reader_f.GetString(1), dep2, reader_f.GetString(3));
                        }
                    }

                    reader_f.Close();
                }
                // Connexion.getInstance().Close();
                return(annee);
            }
        }
Beispiel #2
0
        public override List <InfosAssignation> findAll()
        {
            List <InfosAssignation> IAs = new List <InfosAssignation>();


            using (SqlCommand command_f = new SqlCommand("SELECT * FROM infos_assignation;", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <EC>           TPSQLEC  = factoSQL.getECDAO();
                            DAO <TypeCours>    TPSQLTP  = factoSQL.getTypeCoursDao();
                            DAO <Enseignant>   TPSQLEns = factoSQL.getEnseignantDAO();

                            EC         ec  = TPSQLEC.find(reader_f.GetInt32(2));
                            TypeCours  tp  = reader_f.IsDBNull(3) ? default(TypeCours) : TPSQLTP.find(reader_f.GetInt32(3));
                            Enseignant ens = reader_f.IsDBNull(4) ? default(Enseignant) : TPSQLEns.find(reader_f.GetInt32(4));


                            IAs.Add(new InfosAssignation(reader_f.GetInt32(0), reader_f.GetString(1), ec, tp, ens, reader_f.GetDouble(5)));
                        }
                    }
                }
            }

            return(IAs);
        }
Beispiel #3
0
        public override List <Enseignant> findAll()
        {
            List <Enseignant> enss = new List <Enseignant>();


            using (SqlCommand command_f = new SqlCommand("SELECT * FROM enseignant;", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <Categorie>    TPSQL    = factoSQL.getCategorieDAO();

                            Categorie categ2 = TPSQL.find(reader_f.GetInt32(4));

                            enss.Add(new Enseignant(reader_f.GetInt32(0), reader_f.GetString(1), reader_f.GetString(2), reader_f.GetDouble(3), categ2, reader_f.GetString(5)));
                        }
                    }
                }
            }

            return(enss);
        }
Beispiel #4
0
        public override List <Annee> findAll()
        {
            List <Annee> ans = new List <Annee>();


            using (SqlCommand command_f = new SqlCommand("SELECT * FROM annee;", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <Departement>  TPSQL    = factoSQL.getDepartementDAO();

                            Departement dep2 = TPSQL.find(reader_f.GetInt32(2));

                            ans.Add(new Annee(reader_f.GetInt32(0), reader_f.GetString(1), dep2, reader_f.GetString(3)));
                        }
                    }
                }
            }

            return(ans);
        }
Beispiel #5
0
        public override List <Enseignement> findAll()
        {
            List <Enseignement> enses = new List <Enseignement>();


            using (SqlCommand command_f = new SqlCommand("SELECT * FROM enseignement;", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <PartieAnnee>  TPSQL    = factoSQL.getPartieAnneeDAO();

                            PartieAnnee partannee2 = TPSQL.find(reader_f.GetInt32(2));
                            enses.Add(new Enseignement(reader_f.GetInt32(0), reader_f.GetString(1), partannee2, reader_f.GetString(3)));
                        }
                    }
                }
            }

            return(enses);
        }
Beispiel #6
0
        public override Enseignant find(string nom)
        {
            Enseignant ens = null;

            using (SqlCommand command_f = new SqlCommand("SELECT id, nom, prenom, nb_heures_assignees, id_categorie_enseignant, image FROM enseignant WHERE nom='" + nom + "';", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <Categorie>    TPSQL    = factoSQL.getCategorieDAO();

                            Categorie categ2 = TPSQL.find(reader_f.GetInt32(4));

                            ens = new Enseignant(reader_f.GetInt32(0), reader_f.GetString(1), reader_f.GetString(2), reader_f.GetDouble(3), categ2, reader_f.GetString(5));

                            reader_f.NextResult();
                        }
                    }

                    reader_f.Close();
                }
            }
            return(ens);
        }
Beispiel #7
0
        public override Enseignement find(int id)
        {
            Enseignement ens = null;

            using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_partie_annee, description FROM enseignement WHERE id=" + id + ";", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <PartieAnnee>  TPSQL    = factoSQL.getPartieAnneeDAO();

                            PartieAnnee partannee2 = TPSQL.find(reader_f.GetInt32(2));

                            ens = new Enseignement(reader_f.GetInt32(0), reader_f.GetString(1), partannee2, reader_f.GetString(3));

                            reader_f.NextResult();
                        }
                    }
                    else
                    {
                        throw new Exception("Aucun objet avec cet id n'a été trouvé.");
                    }

                    reader_f.Close();
                }
            }
            return(ens);
        }
Beispiel #8
0
        public override Enseignement find(string nom)
        {
            Enseignement ens = null;

            using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_partie_annee, description FROM enseignement WHERE nom='" + nom + "';", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <PartieAnnee>  TPSQL    = factoSQL.getPartieAnneeDAO();

                            PartieAnnee partannee2 = TPSQL.find(reader_f.GetInt32(2));

                            ens = new Enseignement(reader_f.GetInt32(0), reader_f.GetString(1), partannee2, reader_f.GetString(3));

                            reader_f.NextResult();
                        }
                    }

                    reader_f.Close();
                }
            }
            return(ens);
        }
Beispiel #9
0
        public override InfosAssignation find(string nom)
        {
            InfosAssignation IA = null;

            using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_ec, id_typecours, id_enseignant, nb_heures FROM infos_assignation WHERE nom='" + nom + "';", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <EC>           TPSQLEC  = factoSQL.getECDAO();
                            DAO <TypeCours>    TPSQLTP  = factoSQL.getTypeCoursDao();
                            DAO <Enseignant>   TPSQLEns = factoSQL.getEnseignantDAO();

                            EC         ec  = TPSQLEC.find(reader_f.GetInt32(2));
                            TypeCours  tp  = TPSQLTP.find(reader_f.GetInt32(3));
                            Enseignant ens = TPSQLEns.find(reader_f.GetInt32(4));

                            IA = new InfosAssignation(reader_f.GetInt32(0), reader_f.GetString(1), ec, tp, ens, reader_f.GetDouble(5));
                        }
                    }

                    reader_f.Close();
                }
                // Connexion.getInstance().Close();
                return(IA);
            }
        }
Beispiel #10
0
        public override Annee find(int id)
        {
            Annee annee = null;

            using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_departement, description FROM annee WHERE id=" + id + ";", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <Departement>  TPSQL    = factoSQL.getDepartementDAO();

                            Departement dep2 = TPSQL.find(reader_f.GetInt32(2));

                            annee = new Annee(reader_f.GetInt32(0), reader_f.GetString(1), dep2, reader_f.GetString(3));

                            reader_f.NextResult();
                        }
                    }
                    else
                    {
                        throw new Exception("Aucun objet avec cet id n'a été trouvé.");
                    }

                    reader_f.Close();
                }
            }
            return(annee);
        }
Beispiel #11
0
        public override List <EC> findAll()
        {
            List <EC> ECs = new List <EC>();


            using (SqlCommand command_f = new SqlCommand("SELECT * FROM ec;", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <Enseignement> TPSQL    = factoSQL.getEnseignementDAO();

                            Enseignement ens = TPSQL.find(reader_f.GetInt32(2));
                            ECs.Add(new EC(reader_f.GetInt32(0), reader_f.GetString(1), ens));
                        }
                    }
                }
            }

            return(ECs);
        }
Beispiel #12
0
        public override EC find(string nom)
        {
            EC ec = null;

            using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_enseignement FROM ec WHERE nom='" + nom + "';", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <Enseignement> TPSQL    = factoSQL.getEnseignementDAO();

                            Enseignement ens = TPSQL.find(reader_f.GetInt32(2));

                            ec = new EC(reader_f.GetInt32(0), reader_f.GetString(1), ens);

                            reader_f.NextResult();
                        }
                    }

                    reader_f.Close();
                }
            }
            return(ec);
        }
Beispiel #13
0
        public override EC find(int id)
        {
            EC ec = null;

            using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_enseignement FROM ec WHERE id=" + id + ";", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <Enseignement> TPSQL    = factoSQL.getEnseignementDAO();

                            Enseignement ens = TPSQL.find(reader_f.GetInt32(2));

                            ec = new EC(reader_f.GetInt32(0), reader_f.GetString(1), ens);

                            reader_f.NextResult();
                        }
                    }
                    else
                    {
                        throw new Exception("Aucun objet avec cet id n'a été trouvé.");
                    }

                    reader_f.Close();
                }
            }
            return(ec);
        }
        public override List <EnseignementEnseignant> findAll()
        {
            List <EnseignementEnseignant> enss = new List <EnseignementEnseignant>();


            using (SqlCommand command_f = new SqlCommand("SELECT * FROM enseignement_enseignant;", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <Enseignement> TPSQL    = factoSQL.getEnseignementDAO();
                            DAO <Enseignant>   TPSQL2   = factoSQL.getEnseignantDAO();

                            Enseignement ensfacto  = TPSQL.find(reader_f.GetInt32(1));
                            Enseignant   ensfacto2 = TPSQL2.find(reader_f.GetInt32(2));

                            enss.Add(new EnseignementEnseignant(reader_f.GetInt32(0), ensfacto, ensfacto2));
                        }
                    }
                }
            }

            return(enss);
        }
Beispiel #15
0
        public override InfosAssignation find(int id)
        {
            InfosAssignation IA = null;

            using (SqlCommand command_f = new SqlCommand("SELECT id, nom, id_ec, id_typecours, id_enseignant, nb_heures FROM infos_assignation WHERE id=" + id + ";", Connexion.getInstance()))
            {
                using (SqlDataReader reader_f = command_f.ExecuteReader())
                {
                    if (reader_f.HasRows)
                    {
                        while (reader_f.Read())
                        {
                            AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
                            DAO <EC>           TPSQLEC  = factoSQL.getECDAO();
                            DAO <TypeCours>    TPSQLTP  = factoSQL.getTypeCoursDao();
                            DAO <Enseignant>   TPSQLEns = factoSQL.getEnseignantDAO();

                            EC         ec  = TPSQLEC.find(reader_f.GetInt32(2));
                            TypeCours  tp  = TPSQLTP.find(reader_f.GetInt32(3));
                            Enseignant ens = TPSQLEns.find(reader_f.GetInt32(4));

                            IA = new InfosAssignation(reader_f.GetInt32(0), reader_f.GetString(1), ec, tp, ens, reader_f.GetDouble(5));

                            reader_f.NextResult();
                        }
                    }
                    else
                    {
                        throw new Exception("Aucun objet avec cet id n'a été trouvé.");
                    }

                    reader_f.Close();
                }
            }
            return(IA);
        }
Beispiel #16
0
 ServiceFacade()
 {
     rateDao   = AbstractDAOFactory.getFactory().getRateDAO();
     moviesDao = AbstractDAOFactory.getFactory().getMovieDAO();
     userDao   = AbstractDAOFactory.getFactory().getUserDAO();
 }
Beispiel #17
0
        /// <summary>
        /// Initialise l'objet d'application de singleton.  Il s'agit de la première ligne du code créé
        /// à être exécutée. Elle correspond donc à l'équivalent logique de main() ou WinMain().
        /// </summary>
        ///



        public App()
        {
            Connexion connexion = new Connexion();

            connexion.creerConnexion();

            AbstractDAOFactory factoSQL  = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
            DAO <Categorie>    categorie = factoSQL.getCategorieDAO();



            Categorie categorieDefaut = new Categorie {
                Id = 1, Nom = "Catégorie par défaut", Heures = 0
            };

            if (!(categorie.find(categorieDefaut.Id).Id == 1))
            {
                categorie.create(categorieDefaut);
            }

            //TypeCours CM = new TypeCours { Id = 1, Nom = "CM", Groupes = 1};
            //if (!(typeCours.find(CM.Nom) is TypeCours))
            //    typeCours.create(CM);

            //TypeCours TD = new TypeCours { Id = 2, Nom = "TD", Groupes = 2 };
            //if (!(typeCours.find(TD.Nom) is TypeCours))
            //    typeCours.create(TD);

            //TypeCours TP = new TypeCours { Id = 3, Nom = "TP", Groupes = 2 };
            //if (!(typeCours.find(TP.Nom) is TypeCours))
            //    typeCours.create(TP);

            /*TypeCours tp = new TypeCours("TP", true);
             * Categorie maitreDeConference = new Categorie("maitre de conférences", 240);
             * Departement dpt = new Departement("Informatique");
             * Departement dpt2 = new Departement("Informatique2");
             * AbstractDAOFactory factoSQL = AbstractDAOFactory.getFactory(types.SQL_FACTORY);
             *
             * DAO<Departement> depart = factoSQL.getDepartementDAO();
             * //depart.create(dpt2);
             *
             * DAO<Annee> an = factoSQL.getAnneeDAO();
             * an.create(new Annee("M1", depart.find(1)));
             * an.create(new Annee("M2", depart.find(1)));
             * an.create(new Annee("M3", depart.find(2)));
             *
             * DAO<PartieAnnee> pan = factoSQL.getPartieAnneeDAO();
             * PartieAnnee test = new PartieAnnee("Semestre 1", an.find(1));
             * pan.create(test);
             * pan.create(new PartieAnnee("Semestre 2", an.find(1)));
             * pan.create(new PartieAnnee("Semestre 3", an.find(2)));
             *
             * DAO<Enseignement> en = factoSQL.getEnseignementDAO();
             * en.create(new Enseignement("EC1", pan.find(1)));
             *
             * //Console.WriteLine(maitreDeConference);
             * //Console.ReadLine();
             * DAO<Categorie> categorie = factoSQL.getCategorieDAO();
             * categorie.create(new Categorie("maitre de conference", 130));
             *
             *
             * DAO<Enseignant> ens = factoSQL.getEnseignantDAO();
             * ens.create(new Enseignant("John", "Bob", categorie.find(1)));
             * ens.create(new Enseignant("Bobby", "Malik", categorie.find(1)));
             * ens.create(new Enseignant("Benoit", "Martin", categorie.find(1)));
             * ens.create(new Enseignant("Make", "Crelo", categorie.find(1)));*/

            Connexion.getInstance().Close();
            this.InitializeComponent();
            this.Suspending += OnSuspending;
        }