コード例 #1
0
        private void ajouterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            switch (indiceType)
            {
            case 1:
                AjouterIntervenant formAjoutIntervenant = new AjouterIntervenant();
                formAjoutIntervenant.Text = "Ajout d'un intervenant";
                formAjoutIntervenant.ShowDialog();
                chargerIntervenants();
                break;

            case 2:
                AjouterProf formAjoutProf = new AjouterProf();
                formAjoutProf.Text = "Ajout d'un professeur";
                formAjoutProf.ShowDialog();
                chargerProfs();
                break;

            case 3:
                AjouterEleve formAjoutEleve = new AjouterEleve();
                formAjoutEleve.Text = "Ajout d'un elève";
                formAjoutEleve.ShowDialog();
                chargerEleves();
                break;

            default:

                break;
            }
        }
コード例 #2
0
        private void modifierToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 1)
            {
                switch (indiceType)
                {
                case 1:
                    int    idi        = Convert.ToInt32(dataGridView1.CurrentRow.Cells["IDI"].Value);
                    string nomi       = dataGridView1.CurrentRow.Cells["NOMI"].Value.ToString();
                    string prenomi    = dataGridView1.CurrentRow.Cells["PRENOMI"].Value.ToString();
                    string profession = dataGridView1.CurrentRow.Cells["PROFESSIONI"].Value.ToString();
                    bool   externe    = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["EXTERIEUR"].Value);

                    AjouterIntervenant formAjoutIntervenant = new AjouterIntervenant(idi, nomi, prenomi, profession, externe);
                    formAjoutIntervenant.Text = "Modifier un Intervenant";
                    formAjoutIntervenant.ShowDialog();
                    chargerIntervenants();
                    break;

                case 2:
                    int    idp     = Convert.ToInt32(dataGridView1.CurrentRow.Cells["IDU"].Value);
                    string nomp    = dataGridView1.CurrentRow.Cells["NOMU"].Value.ToString();
                    string prenomp = dataGridView1.CurrentRow.Cells["PRENOMU"].Value.ToString();
                    int    idPerm  = Convert.ToInt32(dataGridView1.CurrentRow.Cells["IDP"].Value);

                    AjouterProf formAjoutProf = new AjouterProf(idp, nomp, prenomp, idPerm);
                    formAjoutProf.Text = "Modifier un Professeur";
                    formAjoutProf.ShowDialog();
                    chargerProfs();
                    break;

                case 3:
                    int    ide     = Convert.ToInt32(dataGridView1.CurrentRow.Cells["IDU"].Value);
                    string nome    = dataGridView1.CurrentRow.Cells["NOMU"].Value.ToString();
                    string prenome = dataGridView1.CurrentRow.Cells["PRENOMU"].Value.ToString();
                    string classe  = dataGridView1.CurrentRow.Cells["LIBELLEC"].Value.ToString();
                    bool   valide  = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["VALIDE"].Value);

                    AjouterEleve formAjoutEleve = new AjouterEleve(ide, nome, prenome, classe, valide);
                    formAjoutEleve.Text = "Modifier un Eleve";
                    formAjoutEleve.ShowDialog();
                    chargerEleves();
                    break;

                default:

                    break;
                }
            }
            else
            {
                MessageBox.Show("Sélectionner une ligne à modifier");
            }
        }