示例#1
0
        private void btModifier_Click(object sender, EventArgs e)
        {
            ListViewItemPersonne lviPers = (ListViewItemPersonne)(lstPersonnes.SelectedItems[0]);
            Personne             p       = lviPers.Qui;
            //EditeurPersonne edtPers = new EditeurPersonne();
            EditeurPersonne edtPers = EditeurPersonne.getInstance();

            edtPers.Modifier(p);
            edtPers.ShowDialog(this);
            if (edtPers.DialogResult == DialogResult.OK)
            {
                lviPers.changerNom(p.Nom);
                txtSalut.Text = p.Salut();
            }
            else
            {
                MessageBox.Show("La modification a été annulée !", "Remarque", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
示例#2
0
        private void btAjouter_Click(object sender, EventArgs e)
        {
            Personne p;
            String   titre = txtTitre.Text.Trim();
            String   nom   = txtNom.Text.Trim();

            if (titre != "")
            {
                p = new VIP(titre, nom);
            }
            else
            {
                p = new Personne(nom);
            }
            lstPersonnes.Items.Add(new ListViewItemPersonne(p));
            txtTitre.Text = "";
            txtNom.Text   = "";
            txtSalut.Text = "";
            desactiveSaluerAjouter();
            desactiveModifierSupprimer();
        }
示例#3
0
 public ListViewItemPersonne(Personne p) : base()
 {
     qui  = p;
     Text = qui.ToString();
 }
示例#4
0
 public void Modifier(Personne qui)
 {
     this.qui    = qui;
     txtNom.Text = qui.Nom;
 }