private void btnDeleteSaff_Click(object sender, EventArgs e) { //DeleteAll data asociated with the clientID string[] split = cmbClients.Text.Split(' '); string clientID = split[0]; bool flag = new GeneralAdminHandler().DeleteClient(clientID); if (flag) { MessageBox.Show("Client was deleted", "Delete Success", MessageBoxButtons.OK, MessageBoxIcon.Error); clients = new ClientTracker().GetClients(); cmbClients.Items.Clear(); foreach (Clients item in clients) { cmbClients.Items.Add(item.ClientID + " " + item.Name); } } else { MessageBox.Show("Error client was not deleted", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnEditClient_Click(object sender, EventArgs e) { switch (cmbData.Text) { case "Name": { client.Name = txtNewData.Text; } break; case "Surname": { client.Surname = txtNewData.Text; } break; case "Phone": { client.PhoneNumber = txtNewData.Text; } break; case "Email": { client.EMail = txtNewData.Text; } break; case "Address": { client.Address = txtNewData.Text; } break; default: { MessageBox.Show("Please select data to edit in the drop down menu", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; } bool flag = new GeneralAdminHandler().EditClient(client); if (flag) { MessageBox.Show("New client data was edited", "Update Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("There was a error updating client data", "Update Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); } }