Exemple #1
0
        public static Participation GetParticipation(int _Id)
        {
            Participation participation = new Participation();

            try
            {
                DbConnect db = new DbConnect();
                db.Command.CommandText = "GetOneParticipation";
                db.Command.Parameters.AddWithValue("_id", _Id);

                MySqlDataReader reader = db.Command.ExecuteReader();
                reader.Read();

                participation.Id       = (int)reader[0];
                participation._Employe = new Employe();
                participation._Employe = Employe.GetEmploye((int)reader[1]);
                participation._Projet  = new Projet();
                participation._Projet  = Projet.GetProjet((string)reader[2]);
                participation.Fonction = (string)reader[3];

                db.Connection.Close();
            }
            catch
            {
            }
            return(participation);
        }
Exemple #2
0
        public static List <Projet> Projets()
        {
            List <Projet> AllProjets = new List <Projet>();

            try
            {
                DbConnect db = new DbConnect();
                db.Command.CommandText = "GetAllProjets";
                MySqlDataReader reader = db.Command.ExecuteReader();
                while (reader.Read())
                {
                    Projet p = new Projet()
                    {
                        CodeP = (string)reader[0],
                        NomP  = (string)reader[1]
                    };
                    AllProjets.Add(p);
                }
                db.Connection.Close();
            }
            catch
            {
            }

            return(AllProjets);
        }
Exemple #3
0
        public static List <Participation> Participations()
        {
            List <Participation> AllParticipation = new List <Participation>();

            try
            {
                DbConnect db = new DbConnect();
                db.Command.CommandText = "GetAllParticipations";
                MySqlDataReader reader = db.Command.ExecuteReader();
                while (reader.Read())
                {
                    Participation p = new Participation()
                    {
                        Id       = (int)reader[0],
                        _Employe = new Employe()
                    };
                    p._Employe = Employe.GetEmploye((int)reader[1]);
                    p._Projet  = new Projet();
                    p._Projet  = Projet.GetProjet((string)reader[2]);
                    p.Fonction = (string)reader[3];
                    AllParticipation.Add(p);
                }
                db.Connection.Close();
            }
            catch
            {
            }

            return(AllParticipation);
        }
Exemple #4
0
        /// <summary>
        /// Supprimer un <paramref name="projet"/> dans la table Projet de la base de données.
        /// </summary>
        /// <returns>
        /// Nombre de lignes affectées
        /// </returns>
        /// <param name="pers">un objet Projet</param>
        public int supprimerProjet(Projet projet)
        {
            DbCommand cmd = db.CreerCommande();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "DELETE FROM Projet " +
                              "WHERE id_projet ='" + projet.idProjet + "'";
            return(db.ExecuterRequete(cmd));
        }
Exemple #5
0
        /// <summary>
        /// Ajouter un <paramref name="projet"/> dans la table Personnel de la base de données.
        /// </summary>
        /// <returns>
        /// Nombre de lignes affectées
        /// </returns>
        /// <param name="projet">un objet Projet</param>
        public int ajouterProjet(Projet projet)
        {
            DbCommand cmd = db.CreerCommande();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "INSERT INTO Projet(id_projet  , date_projet , lien_SVN_projet, id_personnel) " +
                              "VALUES ('" + projet.idProjet + "',  '" + projet.formatDateSql() + "', '" + projet.lienSnvProjet + "', '" + projet.personnel.idPersonnel + "')";

            return(db.ExecuterRequete(cmd));
        }
Exemple #6
0
        /// <summary>
        /// Modifier un <paramref name="projet"/> dans la table Projet de la base de données.
        /// </summary>
        /// <returns>
        /// Nombre de lignes affectées
        /// </returns>
        /// <param name="projet">un objet projet</param>
        public int modifierProjetByNom(Projet projet, string nom)
        {
            DbCommand cmd = db.CreerCommande();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "UPDATE Projet " +
                              "SET id_projet = '" + projet.idProjet + "',date_projet = '"
                              + projet.formatDateSql() + "', lien_SVN_projet='"
                              + projet.lienSnvProjet + "' , id_personnel ="
                              + projet.personnel.idPersonnel + " " +
                              "WHERE id_projet ='" + nom + "'";
            return(db.ExecuterRequete(cmd));
        }
Exemple #7
0
 public static void UpdateProjet(Projet projet)
 {
     try
     {
         DbConnect db = new DbConnect();
         db.Command.CommandText = "UpdateProjet";
         db.Command.Parameters.AddWithValue("_CodeP", projet.CodeP);
         db.Command.Parameters.AddWithValue("_NomP", projet.NomP);
         db.Command.ExecuteNonQuery();
         db.Connection.Close();
     }
     catch
     {
     }
 }
Exemple #8
0
        /// <summary>
        /// Obtenir un Projet par son <paramref name="idProjet"/>
        /// </summary>
        /// <returns>
        /// Un objet Projet
        /// </returns>
        /// <param name="idProjet">nom du projet</param>
        public Projet getProjetById(string idProjet)
        {
            Projet    projet = new Projet();
            DbCommand cmd    = db.CreerCommande();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "Select * from Projet where id_projet='" + idProjet + "'";
            DataTable table = db.CreerDatatable(cmd);

            if (table.Rows.Count >= 1)
            {
                projet.idProjet      = (string)table.Rows[0][0];
                projet.dateProjet    = (DateTime)table.Rows[0][1];
                projet.lienSnvProjet = (string)table.Rows[0][2];
                projet.personnel     = persD.getPersonneById((int)table.Rows[0][3]);
            }
            return(projet);
        }
Exemple #9
0
        // <summary>
        /// Obtenir une liste de tout les projets
        /// </summary>
        /// <returns>
        /// Une liste de projet
        /// </returns>
        public List <Projet> getListProjet()
        {
            List <Projet> listProjet = new List <Projet>();

            DbCommand cmd = db.CreerCommande();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "Select * from Projet";
            DataTable table = db.CreerDatatable(cmd);

            foreach (DataRow row in table.Rows)
            {
                Projet projet = new Projet();
                projet.idProjet      = (string)row[0];
                projet.dateProjet    = (DateTime)row[1];
                projet.lienSnvProjet = (string)row[2];
                projet.personnel     = persD.getPersonneById((int)row[3]);
                listProjet.Add(projet);
            }
            return(listProjet);
        }
Exemple #10
0
        public static Projet GetProjet(string Code)
        {
            Projet projet = new Projet();

            try
            {
                DbConnect db = new DbConnect();
                db.Command.CommandText = "GetOneProjet";
                db.Command.Parameters.AddWithValue("_CodeP", Code);
                MySqlDataReader reader = db.Command.ExecuteReader();
                reader.Read();
                projet.CodeP = (string)reader[0];
                projet.NomP  = (string)reader[1];

                db.Connection.Close();
            }
            catch
            {
            }
            return(projet);
        }