public List <Club> getAllClubs() { List <Club> lesClubsRecuperes = new List <Club>(); string requete = "select * from club"; MySqlCommand cmd = new MySqlCommand(requete, conn); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Club c = new Club(); c.Code = rdr[0].ToString(); c.Nom = rdr[1].ToString(); c.Rue = rdr[2].ToString(); c.Cp = rdr[3].ToString(); c.Ville = rdr[4].ToString(); c.Gps_lat = Convert.ToDouble(rdr[5].ToString()); c.Gps_lon = Convert.ToDouble(rdr[6].ToString()); c.Tel = rdr[7].ToString(); c.Email = rdr[8].ToString(); c.Licencie = Convert.ToInt16(rdr[9].ToString()); DAOTrou daot = new DAOTrou(); c.setLesTrous(daot.getAllTrousFromClub(c)); lesClubsRecuperes.Add(c); } rdr.Close(); return(lesClubsRecuperes); }
private void button2_Click(object sender, EventArgs e) { Trou t = new Trou(Convert.ToInt16(tb_numero.Text), Convert.ToInt16(tb_distance.Text), Convert.ToInt16(tb_par.Text)); ApplicationData.actuel.ajouterTrou(t); DAOTrou dao = new DAOTrou(); dao.recordATrou(t); }
public List<Club> getAllClubs() { List<Club> lesClubsRecuperes = new List<Club>(); string requete = "select * from club"; MySqlCommand cmd = new MySqlCommand(requete, conn); MySqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Club c = new Club(); c.Code = rdr[0].ToString(); c.Nom = rdr[1].ToString(); c.Rue = rdr[2].ToString(); c.Cp = rdr[3].ToString(); c.Ville = rdr[4].ToString(); c.Gps_lat = Convert.ToDouble(rdr[5].ToString()); c.Gps_lon = Convert.ToDouble(rdr[6].ToString()); c.Tel = rdr[7].ToString(); c.Email = rdr[8].ToString(); c.Licencie = Convert.ToInt16(rdr[9].ToString()); DAOTrou daot = new DAOTrou(); c.setLesTrous(daot.getAllTrousFromClub(c)); lesClubsRecuperes.Add(c); } rdr.Close(); return lesClubsRecuperes; }