/// <summary> /// Ajoute un nouvel élément dans le data grid view. /// </summary> /// <param name="client"></param> public void AjouterUnEnregistrement(Client client) { //L'ordre d'insertion : id->prenom->nom->email->sexe->date_debut. if(client != null) { this.dataGridClients.Rows.Add(client.Id, client.Prenom, client.Nom, client.Email, client.Sexe, client.DateDebut.ToString(Form1.DATE_FORMAT)); } }
private void btnConfirmer_Click(object sender, EventArgs e) { if (this.ValidateChildren()) { Client client = new Client(); client.Nom = txtNom.Text; client.Prenom = txtPrenom.Text; client.Sexe = txtSexe.Text; client.Email = txtEmail.Text; client.DateDebut = dateTimePicker1.Value.Date; DernierClientAjoute = client; this.DialogResult = DialogResult.OK; } }
public void Supprimer(Client client) { ListeClient.Remove(client); ClientDAO.SaveData(ListeClient, PathToData); }
public void Inserer(Client client) { client.Id = GetLastId() + 1; ListeClient.Add(client); ClientDAO.SaveData(ListeClient, PathToData); }