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; } }
private void metroButton_update_Click(object sender, EventArgs e) { if (metroButton_update.Text == "Save") { DialogResult c = MessageBox.Show("Do you wanna to save", "save", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (c == DialogResult.OK) { string query = "update diplome set Niveau = '" + metroComboBox_add_diploma_niveau.SelectedItem.ToString() + "',"; query += "specialite='" + metroTextBox_add_diploma_specialite.Text + "',Etablissement='" + metroTextBox_etablissement.Text + "',date_obtention='" + metroTextBox_date_obtention.Text + "' "; query += "where ID_diplome = " + (int)my_list_diploma[position]; Boolean is_updated = Class_Database_app.update_diplome_infos(query); if (is_updated) { MessageBox.Show("it is updated"); } //---------------------- } position = 0; Class_diplome diplome = Class_Database_app.get_diploma_by_id((int)my_list_diploma[position]); afficher(diplome); metroButton_update.Text = "Modifier"; disable_false_all(); enable_true_nav_buttons(); metroButton_add_new.Enabled = true; } else if (metroButton_update.Text == "Modifier") { metroButton_update.Text = "Save"; disable_true_all(); enable_false_nav_buttons(); metroButton_add_new.Enabled = false; } }