private void btnSave_Click(object sender, EventArgs e) { clsClient client = new clsClient(); client.Name = txtName.Text; client.PhoneNumber = txtPhone.Text; client.EMail = txtEmail.Text; client.Status = cboStatus.Text; client.RefHouse = Convert.ToInt32(cboRefHouse.Text); if (Addmode) { if (admin.Add_New_Client(client)) { MessageBox.Show("New Client : " + client.Name + " is successfully added", "New Client Added"); } else { MessageBox.Show("The Client " + client.Name + " is not added.", "Try Again"); } admin.Refresh_Database(); } else { client.RefClient = (int)gridAll.Rows[gridAll.CurrentRow.Index].Cells[0].Value; if (admin.Edit_Client(client)) { MessageBox.Show("Client ID " + client.RefHouse + " is successfully modified", "Client Modified"); } else { MessageBox.Show("Client ID : " + client.RefHouse + " is not modified.", "Try Again"); } } if (permission == 2) { List <clsClient> temp = new List <clsClient>(); temp.Add(agent.Searched_Cleint_For_This_Agent(refagent)); gridAll.DataSource = temp; } else { gridAll.DataSource = admin.All_Client(); } ButtonControl(true, true, false, false, true, false); }