private void btn_Save_Click(object sender, EventArgs e) { // שומר את המידע שקיבלנו לטבלה if (CheckForm()) { Client client = FormtoClient(); if (client.Id == 0) { if (!IsDataExsits(client.Email, client.PhoneNumber)) { if (client.Insert()) { MessageBox.Show("Data saved successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearForm(); ClientArr clientArr = new ClientArr(); clientArr.Fill(); client = clientArr.GetClientWithMaxId(); ClientArrToForm(client); } } } else { if (client.Update()) { MessageBox.Show("Data updated successfully", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearForm(); } } } }