コード例 #1
0
        public static Class_niveau_bac get_niveau_bac_by_id(int id)
        {
            Class_niveau_bac bac = new Class_niveau_bac();

            try
            {
                if (connection_x.State != ConnectionState.Open)
                {
                    connection_x.Open();
                }
                string query = "select n.Type_,n.Niveau from niveau_Bac n where n.ID_niveau_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 = reader[1].ToString();
                }

                connection_x.Close();
            }
            catch (Exception t)
            {
                MessageBox.Show(t.ToString());
            }
            return(bac);
        }
コード例 #2
0
        public void niveau_bac_proc()
        {
            Class_niveau_bac x = new Class_niveau_bac();

            try
            {
                int a = int.Parse(metroTextBox_add_year_niveau_bac.Text);
                if (a > 1990 && a < 2030)
                {
                    x.annee = metroTextBox_add_year_niveau_bac.Text;
                }
                else
                {
                    MessageBox.Show("error typing in the year");
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
                x.annee = "Null";
            }


            x.type = metroTextBox_add_niveau_bac_type.Text;
            //MessageBox.Show(x.Niveau);
            myLIST.Add(x);
        }
コード例 #3
0
 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";
         }
     }
 }