private void grdContact_DoubleClick(object sender, EventArgs e) { if (grdContact.CurrentRow != null) { idContact = (Int32)grdContact.CurrentRow.Cells[0].Value; Console.WriteLine("id : " + idContact); } foreach (Contact c in client.ListContacts) { if (c.IdContact == idContact) { contact = c; } } frmContact frmContact = new frmContact(ref contact, false); DialogResult result = frmContact.ShowDialog(); if (result == DialogResult.OK || result == DialogResult.Yes) { if (result == DialogResult.Yes) { client.ListContacts.Remove(contact); } this.controlesVisuels(); this.afficheContacts(); } }
//BEGIN - GESTION DES BOUTONS/////////////////////////////////////:: /// <summary> /// Affiche un Contact individuel vide pour ajout /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void btnAjouter_Click(object sender, EventArgs e) { frmContact frmContact = new frmContact(); if (frmContact.ShowDialog() == DialogResult.OK) { controlesVisuels();// réaffiche la liste des Contacts afficheContacts(); } }
/// <summary> /// Doubvle Clic sur le Grid : ouvre le Client Sellectionnne /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected override void grdCltDsp_DoubleClick(object sender, EventArgs e) { if (this.grdCltDsp.CurrentRow != null) { this.idContact = (Int32)this.grdCltDsp.CurrentRow.Cells[0].Value; } Donnees.idClientActif = this.idContact; frmContact frmContact = new frmContact(Donnees.ListeFicheClient[this.idClient].ListContacts[this.idContact]); if (frmContact.ShowDialog() == DialogResult.OK) { this.afficheContacts(); } }
//BEGIN - GESTION DES BOUTONS/////////////////////////////////////:: /// <summary> /// Affiche un client individuel vide pour ajout /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAjouter_Click(object sender, EventArgs e) { contact = new Abi.Contact(client.NbrContact++); frmContact frmNewContact = new frmContact(ref contact, true); DialogResult result = frmNewContact.ShowDialog(); if (result == DialogResult.OK || result == DialogResult.Yes) { if (result == DialogResult.Yes) { client.ListContacts.Remove(contact); } if (result == DialogResult.OK) { client.ListContacts.Add(contact); } this.controlesVisuels(); this.afficheContacts(); } }