public static Class_ateliers get_atelier_by_id(int id) { Class_ateliers atelier = new Class_ateliers(); try { if (connection_x.State != ConnectionState.Open) { connection_x.Open(); } string query = "select t.Date_Debut_atelier,t.Date_Fin_atelier,t.observation,t.theme from Atelier t where t.ID_Atelier = "; query += id.ToString(); SqlCommand command3 = new SqlCommand(query, connection_x); SqlDataReader reader = command3.ExecuteReader(); while (reader.Read()) { atelier.date_debut = (DateTime)reader[0]; atelier.date_Fin = (DateTime)reader[1]; atelier.observation = reader[2].ToString(); atelier.theme = reader[4].ToString(); } connection_x.Close(); } catch (Exception t) { MessageBox.Show(t.ToString()); } return(atelier); }
public void afficher_atelier() { foreach (int i in ateliers_ids) { Class_ateliers atelier = Class_Database_app.get_atelier_by_id(i); richTextBox_ateliers.Text += atelier.theme + "\t" + atelier.observation + "\n"; richTextBox_ateliers.Text += atelier.date_debut.ToString() + "\t" + atelier.date_Fin.ToString() + "\n"; } }
public void atelier_proc() { Class_ateliers atelier = new Class_ateliers(); atelier.date_debut = dateTimePicker_add_atelier_debut.Value; atelier.date_Fin = dateTimePicker_add_atelier_fin.Value; atelier.observation = metroTextBox_add_atelier_observation.Text; atelier.theme = metroTextBox_add_atelier_theme.Text; Program.new_candidat_to_add.son_ateliers.Add(atelier); }