예제 #1
0
        private void metroButton_save_update_infos_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show("Voulez vraiment entregistrer", "Enregistrer", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (d == DialogResult.OK)
            {
                //update infos here
                string query_to_update_infos = "update Candidat set ";
                query_to_update_infos += " Nom = '" + metroTextBox_show_update_candidat_nom.Text + "' ,Prenom = '" + metroTextBox_show_updat_candidat_prenom.Text + "' , ";
                string genre = "";
                if (metroRadioButton_show_update_candidat_monsieur.Checked)
                {
                    genre = "True";
                }
                else
                {
                    genre = "False";
                }
                query_to_update_infos += " Genre = '" + genre + "' ,DateNaissance = '" + dateTimePicker_show_update_candidat_naissance.Value + "',";
                query_to_update_infos += " Ville = '" + metroTextBox_show_update_candidat_ville.Text + "' ,Quartier = '" + metroTextBox_show_update_candidat_quartier.Text + "',";
                query_to_update_infos += "  CIN = '" + metroTextBox_show_update_candidat_CIN.Text + "' ,Email = '" + metroTextBox_show_update_candidat_email.Text + "' , ";
                string vcc = "";
                if (metroRadioButton_show_update_candidat_vcc_oui.Checked)
                {
                    vcc = "True";
                }
                else
                {
                    vcc = "False";
                }
                query_to_update_infos += " vcc = '" + vcc + "' where ID = " + (int)chercher_for_update_ids[position_to_update];
                MessageBox.Show(query_to_update_infos);
                Boolean is_updated_ok = Class_Database_app.update_candidat_infos(query_to_update_infos);
                //code here to save updating data
                if (is_updated_ok)
                {
                    MessageBox.Show("Enregister bien fait", "Enregistrer", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("procedure n'a pas ressu");
                }
            }
            else
            {
                MessageBox.Show("Le produre d'enregistrer à ete annuler", "Annuler", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            metroPanel_update_candidat_data.Enabled = false;
            vider_panel_update_candidate_data();
        }