Beispiel #1
0
 /// <summary>
 /// Demande d'ajout ou de modification d'un développeur
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnEnregDeveloppeur_Click(object sender, EventArgs e)
 {
     if (!txtNom.Text.Equals("") && !txtPrenom.Text.Equals("") && !txtTel.Text.Equals("") && !txtMail.Text.Equals("") && cboProfil.SelectedIndex != -1)
     {
         Profil profil        = (Profil)bdgProfils.List[bdgProfils.Position];
         int    iddeveloppeur = 0;
         if (enCoursDeModif)
         {
             iddeveloppeur = (int)dgvDeveloppeurs.SelectedRows[0].Cells["iddeveloppeur"].Value;
         }
         Developpeur developpeur = new Developpeur(iddeveloppeur, txtNom.Text, txtPrenom.Text, txtTel.Text, txtMail.Text, profil.Idprofil, profil.Nom);
         if (enCoursDeModif)
         {
             controle.UpdateDeveloppeur(developpeur);
             enCoursDeModif             = false;
             grbLesDeveloppeurs.Enabled = true;
             grbDeveloppeur.Text        = "ajouter un développeur";
         }
         else
         {
             controle.AddDeveloppeur(developpeur);
         }
         RemplirListeDeveloppeurs();
         ViderDeveloppeur();
     }
     else
     {
         MessageBox.Show("Tous les champs doivent être remplis.", "Information");
     }
 }
Beispiel #2
0
        private void btn_devEnregistrer_Click(object sender, EventArgs e)
        {
            if (txb_nom.Text != "" && txb_prenom.Text != "" && txb_mail.Text != "" && txb_tel.Text != "")
            {
                if (MessageBox.Show("Voulez vous vraiment ajouter " + txb_prenom.Text + " " + txb_nom.Text + "?", "Confirmation de la suppression", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    int    idDeveloppeur = controle.trouverIdDeveloppeurDisponible();
                    string nom           = txb_nom.Text;
                    string prenom        = txb_prenom.Text;
                    string tel           = txb_tel.Text;
                    string mail          = txb_mail.Text;
                    int    idProfil      = ((Profil)cmb_profil.SelectedItem).idProfil;
                    string profil        = ((Profil)cmb_profil.SelectedItem).nom;
                    string Pwd           = "";

                    Developpeur developpeur = new Developpeur(idDeveloppeur, nom, prenom, tel, mail, idProfil, profil, Pwd);
                    controle.AddDeveloppeur(developpeur);
                    RemplirLesDeveloppeurs();
                }
            }
        }