private void btn_delete_user_Click(object sender, EventArgs e) { try { if (listview_users.SelectedItems.Count == 1) { DialogResult result = MessageBox.Show("Are you sure you want to delete user?", "WARNING", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); if (result == DialogResult.Cancel) { return; } else { string email = listview_users.SelectedItems[0].SubItems[1].Text; user_service.DeleteUser(email); FillUsers(); listview_users.SelectedItems.Clear(); //Send email notification if used is succesfully added Notifications_Service.Email_UserDelete(email); } } else { MessageBox.Show("Oops, you are not able to delete multiple users at the same time. please make sure you have one user selected.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception) { MessageBox.Show("Oops, something went wrong. please try again.", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnDelete_userManager_Click(object sender, EventArgs e) { Control lblID = FindControl("lblUserId"); User_Service userService = new User_Service(); userService.DeleteUser(lblID.Tag.ToString()); }
private void btnAdminUsersDelete_Click(object sender, EventArgs e) { if (lvAdminUsers.SelectedItems.Count > 0) { int userId = int.Parse(lvAdminUsers.SelectedItems[0].SubItems[0].Text); string name = lvAdminUsers.SelectedItems[0].SubItems[1].Text; userService.DeleteUser(userId); FillLVAdminUsers(); CallErrorPanel($"De gebruiker: {name} is verwijderd."); } else { CallErrorPanel($"Selecteer eerst een gebruiker om te verwijderen."); } }