예제 #1
0
        private void metroButton_modifier_search_first_Click(object sender, EventArgs e)
        {
            position = 0;
            Class_langage langue = Class_Database_app.get_langue_by_id((int)my_arry_ids[position]);

            afficher(langue);
        }
예제 #2
0
 private void metroButton_add_langage_save_close_Click(object sender, EventArgs e)
 {
     if (metroButton_add_langage_save_close.Text == "Modifier")
     {
         metroButton_add_new.Enabled = false;
         DialogResult c = MessageBox.Show("Do you wanna to save", "save", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (c == DialogResult.OK)
         {
             string  query      = "update langues set langue = '" + metroTextBox_update_langage_number1.Text + "' ,Niveau='" + metroComboBox_niveau_langage_1.SelectedItem.ToString() + "' where ID_langue = " + (int)my_arry_ids[position];
             Boolean is_updated = Class_Database_app.update_diplome_infos(query);
             if (is_updated)
             {
                 MessageBox.Show("it is updated");
             }
         }
         position = 0;
         Class_langage langue = Class_Database_app.get_langue_by_id((int)my_arry_ids[position]);
         afficher(langue);
         metroButton_add_langage_save_close.Text = "save";
         enable_false();
     }
     else if (metroButton_add_langage_save_close.Text == "save")
     {
         enable_true();
         metroButton_add_langage_save_close.Text = "Modifier";
         metroButton_add_new.Enabled             = true;
     }
 }
예제 #3
0
        private void metroButton_add_new_Click(object sender, EventArgs e)
        {
            if (metroButton_add_new.Text == "Ajouter Nouveau")
            {
                enable_true();
                metroButton_add_langage_save_close.Enabled = false;

                vider_form();
                metroButton_add_new.Text = "Save";
            }
            else if (metroButton_add_new.Text == "Save")
            {
                DialogResult x = MessageBox.Show("do you wanna save", "save", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (x == DialogResult.OK)
                {
                    string query = "insert into langues(ID_candidat,langue,Niveau) values(" + (int)my_arry_ids[position] + ",'" + metroTextBox_update_langage_number1.Text + "','" + metroComboBox_niveau_langage_1.SelectedItem.ToString() + "')";

                    Class_Database_app.add_data(query);
                }
                position = 0;
                Class_langage langue = Class_Database_app.get_langue_by_id((int)my_arry_ids[position]);
                afficher(langue);
                enable_false();
                metroButton_add_langage_save_close.Enabled = true;
            }
        }
        public static Class_langage get_langue_by_id(int id)
        {
            Class_langage langue = new Class_langage();

            try
            {
                if (connection_x.State != ConnectionState.Open)
                {
                    connection_x.Open();
                }
                string query = "select l.langue,l.Niveau from langues l where l.ID_langue = ";
                query += id.ToString();
                SqlCommand    command3 = new SqlCommand(query, connection_x);
                SqlDataReader reader   = command3.ExecuteReader();
                while (reader.Read())
                {
                    langue.langue = reader[0].ToString();
                    langue.niveau = reader[1].ToString();
                }

                connection_x.Close();
            }
            catch (Exception t)
            {
                MessageBox.Show(t.ToString());
            }
            return(langue);
        }
예제 #5
0
        public void proc_langages()
        {
            Class_langage v = new Class_langage();

            if (metroTextBox_add_langage_number1.Text != "")
            {
                v.langue = metroTextBox_add_langage_number1.Text;
                v.niveau = metroComboBox_niveau_langage_1.SelectedItem.ToString();
                c.Add(v);
            }
            v = new Class_langage();
            if (metroTextBox_add_langage_number2.Text != "")
            {
                v.langue = metroTextBox_add_langage_number2.Text;
                v.niveau = metroComboBox_niveau_langage_2.SelectedItem.ToString();
                c.Add(v);
            }
            v = new Class_langage();
            if (metroTextBox_add_langage_number3.Text != "")
            {
                v.langue = metroTextBox_add_langage_number3.Text;
                v.niveau = metroComboBox_niveau_langage_3.SelectedItem.ToString();
                c.Add(v);
            }
        }
 public void afficher_langues()
 {
     foreach (int i in langues_ids)
     {
         Class_langage langue = Class_Database_app.get_langue_by_id(i);
         richTextBox_langues.Text += langue.langue + "\t" + langue.niveau + "\n";
     }
 }
예제 #7
0
        private void metrobuutton_modifier_search_next_Click(object sender, EventArgs e)
        {
            position++;
            if (position > my_arry_ids.Count - 1)
            {
                position = 0;
            }
            Class_langage langue = Class_Database_app.get_langue_by_id((int)my_arry_ids[position]);

            afficher(langue);
        }
예제 #8
0
        private void Form_update_langues_Load(object sender, EventArgs e)
        {
            Class_Candidat candidat = Class_Database_app.get_candidate_by_id(myid_candidat);

            metroTextBox_update_langage_nom.Text    = candidat.Nom;
            metroTextBox_update_langage_prenom.Text = candidat.Prenom;
            my_arry_ids = Class_Database_app.get_langues_by_id_candidat(myid_candidat);
            if (my_arry_ids.Count > 0)
            {
                Class_langage langue = Class_Database_app.get_langue_by_id((int)my_arry_ids[position]);
                afficher(langue);
            }
            else
            {
                MessageBox.Show("aucune langue à afficher");
            }
        }
예제 #9
0
 public void afficher(Class_langage langue)
 {
     metroTextBox_update_langage_number1.Text    = langue.langue;
     metroComboBox_niveau_langage_1.SelectedItem = langue.niveau;
 }