예제 #1
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;
            }
        }
 private void metroButton_add_new_Click(object sender, EventArgs e)
 {
     if (metroButton_add_new.Text == "Ajouter Nouveau")
     {
         enable_false_nav_buttons();
         metroButton_update.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 = "";
             if (!metroCheckBox_add_diploma_En_cours.Checked)
             {
                 query = "insert into diplome(ID_candidat,Niveau,specialite,Etablissement,date_obtention) values(" + my_id + ",'" + metroComboBox_add_diploma_niveau.SelectedItem.ToString() + "'," +
                         "'" + metroTextBox_add_diploma_specialite.Text + "','" + metroTextBox_etablissement.Text + "','" + metroTextBox_date_obtention.Text + "')";
             }
             else
             {
                 query = "insert into diplome(ID_candidat,Niveau,specialite,Etablissement,date_obtention) values(" + my_id + ",'" + metroComboBox_add_diploma_niveau.SelectedItem.ToString() + "'," +
                         "'" + metroTextBox_add_diploma_specialite.Text + "','" + metroTextBox_etablissement.Text + "','0')";
             }
             Class_Database_app.add_data(query);
         }
         position = 0;
         Class_diplome diplome = Class_Database_app.get_diploma_by_id((int)my_list_diploma[position]);
         afficher(diplome);
         enable_true_nav_buttons();
         metroButton_update.Enabled = true;
     }
 }