Exemplo n.º 1
0
 private void metroButton_add_bac_save_another_Click(object sender, EventArgs e)
 {
     valider();
     Program.new_candidat_to_add.son_bac.Add(bac);
     bac = new Class_bac();
     vider_form();
 }
        public static Class_bac get_bac_by_id(int id)
        {
            Class_bac bac = new Class_bac();

            try
            {
                if (connection_x.State != ConnectionState.Open)
                {
                    connection_x.Open();
                }
                string query = "select b.Type_,b.annee_obtention from baccalaureat b where b.ID_bac = ";
                query += id.ToString();
                SqlCommand    command3 = new SqlCommand(query, connection_x);
                SqlDataReader reader   = command3.ExecuteReader();
                while (reader.Read())
                {
                    bac.Type            = reader[0].ToString();
                    bac.annee_obtention = (int)reader[1];
                }

                connection_x.Close();
            }
            catch (Exception t)
            {
                MessageBox.Show(t.ToString());
            }
            return(bac);
        }
 public void afficher_bac()
 {
     if (bac_ids.Count > 0)
     {
         foreach (int i in bac_ids)
         {
             Class_bac bac = Class_Database_app.get_bac_by_id(i);
             richTextBox_baccalaureat.Text += bac.Type + "\t" + bac.annee_obtention;
             richTextBox_baccalaureat.Text += "\n ------------------ \n";
         }
     }
     else if (niveu_bac_ids.Count > 0)
     {
         foreach (int i in niveu_bac_ids)
         {
             Class_niveau_bac niveau = Class_Database_app.get_niveau_bac_by_id(i);
             richTextBox_baccalaureat.Text += "Niveau Bac :" + niveau.type + "\t" + niveau.annee;
             richTextBox_baccalaureat.Text += "\n --------------------- \n";
         }
     }
 }