Esempio n. 1
0
        public static clsListEmployee GetEmployee()
        {
            //Liste temporaire
            clsListEmployee tmpListEmployee = new clsListEmployee();

            //Connection a la BDD
            //OleDbConnection myCon = new OleDbConnection(); //connection
            //myCon.ConnectionString = @"Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Users\pc\Documents\Visual Studio 2015\Projects\prjCSWinADONET\prjCSWinADONET\bin\Debug\data\Sport.mdb";
            //myCon.Open();

            //Commande + Requete SQL
            OleDbCommand cmd = new OleDbCommand();     //commande

            cmd.Connection  = clsGlobal.myCon;
            cmd.CommandText = "SELECT * FROM Employees";
            OleDbDataReader rd = cmd.ExecuteReader();

            while (rd.Read())
            {
                clsEmployee eq = new clsEmployee(rd["User"].ToString(),
                                                 rd["Password"].ToString(), rd["Email"].ToString(),
                                                 rd["RefEmployee"].ToString(), rd["Poste"].ToString(),
                                                 rd["RefCompany"].ToString(), rd["Phone"].ToString(),
                                                 rd["FirstName"].ToString(), rd["LastName"].ToString());
                tmpListEmployee.Ajouter(eq);
                eq = null;
            }
            //fermer le reader
            rd.Close();
            //fermer la connection
            // myCon.Close();
            //retourne la valeur tmpList
            return(tmpListEmployee);
        }
Esempio n. 2
0
 public bool Ajouter(clsEmployee Employee)
 {
     //verification si le joueur existe ou pas
     if (Exist(Employee.RefEmployee))
     {
         return(false); //s'il existe retourne faux
     }
     //si le joueur n'existe pas
     else
     {
         //ajout du joueur dans le dictionnaire
         maListe.Add(Employee.RefEmployee, Employee);
         //retourne vrai
         return(true);
     }
 }