private void tsbDelete_Click(object sender, EventArgs e) { var userAccess = userAccessRepository.GetAll(); bool isAllowed = userAccess.Exists(u => u.FullName == Store.ActiveUser && u.ObjectName == "Hak Akses" && u.IsDelete); if (isAllowed == false && Store.IsAdministrator == false) { MessageBox.Show("Anda tidak dapat menghapus", "Perhatian", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { if (MessageBox.Show("Anda yakin ingin menghapus hak akses '" + cboUser.Text + "' untuk '" + cboFormReport.Text + "'", "Perhatian", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { userAccessRepository.Delete(new Guid(txtID.Text)); GetLastUserAccess(); LoadUserAccess(); } if (lvwUserAccess.Items.Count == 0) { tsbEdit.Enabled = false; tsbDelete.Enabled = false; ClearForm(); } } }