/// <summary> /// 5. Save or update the info client in the data base /// </summary> private void btnSave_Click(object sender, EventArgs e) { try { // 1. Get client info from text boxes string idclient = txtidclient.Text.Trim(); string clientNumber = txtclientNumber.Text.Trim(); string name = txtname.Text.Trim(); string lastName = txtlastName.Text.Trim(); string email = txtemail.Text.Trim(); string img = txtimg.Text.Trim(); string address = txtaddress.Text.Trim(); string cardNumber = txtcardNumber.Text.Trim(); string nip = txtnip.Text.Trim(); string idagencies = cmbAgencies.SelectedValue.ToString(); string idemployee = cmbEmployees.SelectedValue.ToString(); string sexe = txtsexe.Text.Trim(); // 2. Obj Controller clsInfo Controller = new clsInfo(); // 3. Save or update client info Controller.SaveClient(idclient, clientNumber, name, lastName, email, img, address, cardNumber, nip, idagencies, idemployee, sexe); if (idclient != "0") { MessageBox.Show("Msg : " + " " + " client has been updated"); } else { MessageBox.Show("Msg : " + " " + " client has been saved"); } } catch (Exception ex) { MessageBox.Show("Error : " + " " + ex.Message); } // Refresh the dataGridView DisplayClients(); // Cleans the text boxws in the form CleanTextboxes(); }