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); }
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); }